Presentation is loading. Please wait.

Presentation is loading. Please wait.

Networking 12.1 Introduction VxWorks Network Configuration

Similar presentations

Presentation on theme: "Networking 12.1 Introduction VxWorks Network Configuration"— Presentation transcript:

2 Networking 12.1 Introduction VxWorks Network Configuration
Routing Protocols Remote Access Services Network Stack VxWorks Network Configuration Available Network Facilities

3 Network Protocols Machines on a network must agree to exchange data in some standard way. Internet protocol suite (also called TCP/IP) provides system independent protocols. VxWorks provides an implementation of TCP/IP protocol suite based on the 4.4BSD release Features include: Increased configurability and scalability MUX layer Support for contemporary Internet features Internet protocols are standardized through Requests for Comments (RFCs) circulated by the Internet Engineering Task Force (IETF). These RFCs are the authoritative guide to how these protocols should work. RFCs can be found at Good books on network programming: Unix Network Programming, volume I, 2nd ed. (Stevens), 1997. Internetworking with TCP/IP volume III, 2nd ed. (Comer), 1996. For an overview and internals of network protocols: TCP/IP Illustrated, Volume 1 (Stevens), 1994. TCP/IP Illustrated, Volume 2 (Wright and Stevens), 1995. Internetworking with TCP/IP volume I, 3rd ed. (Comer), 1995. Internetworking with TCP/IP volume II, 2nd ed. (Comer), 1994. The Design and Implementation of the 4.4 BSD UNIX Operating System (McKusick et. al.), 1996.

4 Network Components The MUX layer is a thin API layer that decouples network interface drivers from the network protocol. IP, the Internet Protocol, is responsible for point-to-point delivery of datagrams. TCP, Transmission Control Protocol, and UDP, User Datagram Protocol, are both transport level protocols. UDP is a lightweight datagram delivery service, and TCP is a full-featured connection-based protocol which provides reliable data transport. Berkeley sockets, zbuf sockets, and RPC are supported network programming APIs. The zbuf Sockets API uses buffer loaning to speed up network communication.

5 Network Scalability Selective inclusion of core TCP/IP networking protocols is provided. TCP/IP parameters can be set by setting properties of individual components. Examples: TCP Connection Timeout, IP Time-to-Live value, TCP/UDP receive and send buffer sizes, and tuning of internal buffers. (See VxWorks Network Programmer’s Guide.) ICMP (Internet Control Message Protocol), configurable separately from IP, handles error and informational messages at the IP layer. Two such messages are echo reply (used by ping()) and redirect (used to repair bad routing entries). IGMP (Internet Group Management Protocol) is used by hosts and routers to support multicasting. The network library support component includes the library netLib which provides support for network drivers through the system task tNetTask. Internal buffering is in the form of pre-allocated memory pools of fixed- size mBlks and clBlks. The size and number of blocks in these pools can be changed to tune stack performance, but be sure to read the VxWorks Network Programmer’s Guide description first!

6 Network Services VxWorks network services include:
DHCP/BOOTP Simple Network Time Protocol (SNTP) DNS resolver Dynamic Routing (RIPv1/RIPv2/OSPF) rlogin/telnet Remote command execution Remote file access Multicasting, including IGMP User can build other network services as needed. To use these network services the appropriate components must be included in the VxWorks image. DHCP, Dynamic Host Configuration Protocol, and BOOTP are two protocols supporting booting a target from a remote boot server. DHCP will be discussed in in this chapter. DNS, Domain Name Service, allows a target to look up remote hosts by name. DNS will be discussed in this chapter. A number of optional networking products are available, including: WindWeb server (HTTP server) SNMP STREAMS eNavigator (an embeddable browser and toolkit)

7 Networking Introduction 12.2 VxWorks Network Configuration
Routing Protocols Remote Access Services Host Names and Tables Domain Name Service Dynamic Host Configuration Protocol

8 hostAdd (hostName, hostAddr)
Host Names To associate a name with an internet address: hostAdd (hostName, hostAddr) To display host name table use: hostShow () The name of the boot host is automatically added to the table from the boot parameters. Example: -> hostAdd “tuolumne”, “ ” value = 0 = 0x0 -> hostAdd “todd”, “ ” -> hostShow hostname inet address aliases t localhost wolverine tuolumne todd

9 Domain Name System Domain Name System (DNS) is a distributed client/server application supporting host names being stored in a distributed database. DNS requires a name server and, on the client side, a resolver. VxWorks supports resolver functionality in resolvLib. resolvLib includes the following routines: resolvGetHostByName() -- send a DNS query to the name server for the IP address of a host. resolvGetHostByAddr() -- send a DNS query to the name server for the host name of an IP address. The name server must have a corresponding route in the target routing table. hostLib contains two related routines, hostGetByName() and hostGetByAddr(), which normally use the local host name table. However, if resolvLib is configured and a host name or IP address is not found locally, then a DNS query will be sent. DNS is described in RFC’s 1034 and 1035.

10 DNS Resolver Configuration
The DNS resolver component (/network components/networking applications/DNS resolver) must be added to VxWorks. The resolver must be initialized before use. Required information includes RESOLVER_DOMAIN and RESOLVER_DOMAIN_SERVER. This can be done through the project facility or by calling resolvInit(). Example configuration: RESOLVER_DOMAIN “” RESOLVER_DOMAIN_SERVER “ ” DNS_DEBUG FALSE Setting the DNS_DEBUG flag will result in diagnostic messages being sent to the console when DNS queries are made.

11 DHCP Basics Dynamic Host Configuration Protocol (DHCP) allows a host to acquire an IP address, and possibly boot parameters, from a remote host. A DHCP client can obtain a temporary lease of an IP address from a DHCP server, which maintains a database of available addresses and other parameters. A DHCP relay agent is necessary to support DHCP operation across subnet boundaries. The DHCP server database can contain entries that allow BOOTP client requests to be handled. (BOOTP is a simpler protocol allowing remote clients to obtain boot parameters.) The VxWorks implementation of DHCP conforms to RFC 1541. See the VxWorks Network Programmer’s Guide chapter on Booting over the Network for more details on DHCP boot configuration.

12 DHCP Configuration The DHCP relay agent configuration is described in the help page for dhcpsLib. (Yes, the server help file!) A DHCP server requires a database of addresses and boot parameters. A default database is found in .../target/config/comps/src/net/usrNetDhcpsCfg.c. Details on database entries and a server hook to assign permanent storage for dynamically added addresses can be found on the help page for dhcpsLib.

13 Networking Introduction VxWorks Network Configuration
12.3 Routing Protocols Remote Access Services Routing Overview Static Routing Dynamic Routing

14 Routing Overview Internet Protocol (IP) routing algorithm:
The target routing table can be built in two ways: Statically, by adding routes to a local routing table using mRouteAdd() or routeAdd( ). Or dynamically, where hosts exchange routing information using a routing protocol. VxWorks supports two routing protocols: Routing Information Protocol (RIP) and Open Shortest Path First (OSPF). if (destination on a directly attached network) send data to destination else use routing table to find correct router send data to router mRouteAdd(), strangely enough, is found in routeLib. RIPv1 and RIPv2 are both supported by ripLib. Differences between these versions is discussed later. OSPF is an optional product.

15 Adding Static Routes in VxWorks
To add multiple routes to the same location, use mRouteAdd (dest, gateway, mask, tos, flags) Can use a destination/gateway internet address in dot notation. Specify destination subnet mask and IP type-of-service. See routeLib help page for details. To add a route to the /24 network through the router gatehost: mRouteAdd (“ ”, “gatehost”, 0xffffff00, 0, 0) Routing table show routines, mRouteShow() or routeShow() require the component /network components/networking protocols/network debugging/ Network show routines. To delete a route, use mRouteEntryDelete( ) or mRouteDelete( ). routeAdd() and routeShow(), while obsolete, are provided for backwards compatibility. Routing example: ->mRouteAdd (“ ”, “ ”, 0xffffff00, 0, 0) value = 0 = 0x0 ->mRouteShow Destination Mask TOS Gateway Flags RefCnt Use Interface Proto nt lo ffffff nt

16 Network Show Routines Are used to display network statistics and debugging information. Configuration information and statistics can be shown for protocols (IP, ICMP, TCP, etc.) , buffering, network interfaces, etc. Example (ARP table entries): ->arptabShow LINK LEVEL ARP TABLE destination gateway flags Refcnt Use Interface :00:20:7b:06:fb ei0 :60:97:4f:d5: ei0 value = 75 = 0x4b = ‘K’ ARP is the Address Resolution Protocol, a protocol to find link layer addresses (ethernet addresses in this example) given an IP address. A flag value of 0x405 is 0x400 (generated by ARP) + 0x4 (host specific entry) + 0x1 (route is “up”) The components for network show routines are:

17 Dynamic Routing Overview
Dynamic routing protocols allow hosts (typically routers) to exchange routing information. Advantages over statically created routing tables include: Faster update as link states change Ability to calculate the most efficient route if there are multiple routes to a destination Easier maintenance These protocols do not affect the Internet routing algorithm, but instead impose a routing policy when constructing the routing table. VxWorks supports RIP versions 1 and 2 and OSPF (an optional component). The common UNIX routing daemon routed uses RIP. RIP and OSPFs are examples of IGPs (Interior Gateway Protocols) which allow routers within an organization (in formal networking lingo, an autonomous system) to exchange routing information.

18 Routing Internet Protocol
RIP uses UDP to exchange routing information. RIP is a distance vector protocol -- each route includes a number of hop counts. If multiple paths to a destination exist, RIP chooses the most efficient route by minimizing this count. RIPv2 updates RIPv1 by including: support for classless addressing ability to use multicasting and broadcasting support for authentication use ping( ) for testing routes See ripLib in the VxWorks Reference Manual for details. RIPv2 can also process RIPv1 messages. RIPv1 is described in RFC 1058 and RIPv2 in RFC 1388. OSPF is a link state protocol -- such protocols do not require wholesale exchange of routing tables. Instead, OSPF routers exchange information about link states. This information is used by each router to calculate an optimal routing table. Link state information includes a link weight, which reflects delays and bandwidth restrictions on that network segment. Advantages of OSPF over RIP: Link state metrics lead to better optimized routes than hop counts. Routing updates occur more promptly. OSPF can accomodate larger and more complex organization networks (RIP is limited to hop counts < 16). Networking implements OSPF version 2, as defined in RFC 1583.

19 Networking Introduction VxWorks Network Configuration
Routing Protocols 12.4 Remote Access Services Remote Access Services Supported by VxWorks Server Services: rlogin, telnet, FTP, NFS Client Services: NFS, RSH, FTP

20 VxWorks Remote Services
A TFTP (Trivial File Transfer Protocol) client and server are also supplied. TFTP is a light-weight version of FTP implemented using UDP. It does not support any authentication. See tftpLib and tftpdLib for details. The Target Server File System (TSFS) allows a target to access a host-based file system using the target server - WDB agent connection. For details, see the WindView chapter.

21 Remote Login and Telnet
rlogin and telnet offer an alternative to cross- development using the Tornado target server. Target-based tools may be useful for in-the-field debugging and upgrading when a Tornado target server is unavailable. Inclusion of these tools increases your image size significantly. Security can be installed: Add the component /network components/networking protocols/network applications/RLOGIN|TELNET password protection Modify LOGIN_USER_NAME and LOGIN_PASSWORD parameters . Add additional users with loginUserAdd( ). An example of initializing the user login table: ... loginInit(); loginUserAdd(“marco”, “bcRzQdybze”); In the above code, loginUserAdd( ) adds a user to the login table. The second argument “bcRzQdybze” is the pasword “poloPonY” encrypted with the vxencrypt tool.

22 NFS Server Overview Allows remote hosts to access a target’s DOS file systems using NFS protocol. By default no authentication is performed. Add the component /network components/networking protocols/network filesystems/NFS server. NFS server configuration supports: 1. Create a mountable DOS file system: dosFsDevInitOptionsSet (DOS_OPT_EXPORT); 2. Export DOS file system: nfsExport (name, fsId, rdOnly, notUsed); 3. Mount file system on remote host. NFS server provides: mountLib Implements Mount Protocol as defined in Internet RFC 1094. nfsdLib Implements Network File System Protocol as defined in Internet RFC 1094. NFS server requires the following tasks: tMountd Manages mount requests tNfsd Enqueues incoming NFS requests tNfsd0-tNfsd3 Process incoming NFS requests (number of tasks configurable) To access file systems other than DOS from a remote host, use the VxWorks FTP server. Refer to your host documentation for details on mounting a NFS file system on the remote system.

23 VxWorks FTP Server The FTP server component is included by configuring /network components/networking protocols/network filesystems/FTP server. When target is booted, should see tFtpdTask (server daemon) running. FTP security, which will require a valid user name and password from clients, can be included by configuring /network components/networking protocols/network filesystems/FTP server security. The RLOGIN/TELNET password protection component allows a single user name and encrypted password. Additional users can be added by calling loginUserAdd() in application initialization code. Example: VxWorks Server and VxWorks Client Can also use FTP to boot one VxWorks target from another.

24 NFS vs. FTP Server NFS Advantages: FTP Advantages:
Efficient file access. Configurable number of servers pre-spawned. FTP Advantages: Can access file systems other than DOS. All network hosts have FTP client.

25 NFS Client Service Network File System (NFS) was developed by Sun Microsystems. Allows efficient access to files. NFS transfers and buffers files in pieces (usually 8 Kbytes). Remote file systems are mounted, then accessed as if they were local file systems. VxWorks provides NFS client and server. The NFS client component can be found under /network components/networking protocols/network filesystems/NFS client. Windows NT, Windows 98, and Windows 95 require additional software to support NFS. Numerous third-party packages are available.

26 NFS Client Configuration
To access files on a remote machine using NFS: 0. Export server’s file system: Makes the local file system available to remote host with appropriate access permissions 1. Mount the file system on the client. nfsMount (host, fileSystem, localName) 2. Set the client’s authentication parameters: nfsAuthUnixSet (hostName, uid, gid, ngids,aup_gids) Defaults (NFS_GROUP_ID = 100 and NFS_USER_ID = 2001) will need to be changed. UNIX users can get the required values using: % id uid=219(marc) gid=700(training) Exporting the server’s file system, is host-dependent: For UNIX hosts, exported file systems and access permissions are often specified in /etc/exports. Under Solaris, the appropriate file is /etc/dfs/dfstab. (UNIX Host) For PC hosts, export and access information are stored as specified by NFS software. Authentication may not be necessary. (PC Host) To find the remote host a file system is mounted from: -> nfsDevShow device name file system /usrNfs styx:/usr /dinoNfs columbia:/dino value = 0 = 0x0

27 netDrv File Access Clients
netDrv allows access to remote files: Entire file read into target memory on open( ). read( )/write( ) act on copy of file in memory. File not written to remote host until close( ). Can’t access large files (constrained by available memory). ioctl (fd, FIOSYNC, 0) is not supported. dirLib routines opendir / readdir do not work on netDrv directories. stat / fstat are only partially implemented. stat and fstat only work on regular files. The only fields that are filled in are the file size, file type (always IFREG if netDrv can open it), and device pointer

28 Creating network Devices
STATUS netDevCreate (devName, host, protocol) devName Local name of device to create. By convention, ends with ‘:’. host Name of remote machine (from previous hostAdd( )). protocol Protocol to transfer files to/from VxWorks (0= RSH or 1= FTP). Example -> netDevCreate (“ohio:”, “ohio”, 1) -> fd = open (“ohio:/u/teamN”, 2) FTP file access requires a name and a password set via remCurIdSet( ) or: iam (“team8”, “team8Password”); RSH access requires your target name in ~/.rhosts. When using FTP, the netDrv routines call lower level functions implemented in the FTP client library, ftpLib.

29 Executing Remote Commands
Commercial RSH servers are available for Windows machines, for instance from Denicomp Systems. Shareware implementations are also available on the web. Access permission requires a user name to be set on the target via remCurIdSet( ) or iam(). For RSH permission, can put target name in either ~/.rhosts, or in /etc/hosts.equiv. The latter is dangerous, as it allows a VxWorks user to set a name and access files arbitrarily. The former only allows a VxWorks user to access files as a single, usually non-root, user. rcmd() and rlogin() to UNIX also use the RSH protocol. VxWorks programs can invoke remote shell (RSH) commands on a UNIX host. A file descriptor called a socket is created. Can read( ) from this socket to get command output.

30 UNIX: Remote Command Execution
int rcmd (host, remotePort, localUser, remoteUser, cmd, pFd2) host Host name or inet number. remotePort Remote port number to connect to, typically (RSH server). localUser Name of local user. remoteUser User name on remote host. cmd Shell command string to execute. pFd2 If non-zero, a socket for stderr is foreach I (*.o)returned through this pointer. Returns a socket file descriptor or ERROR. The remoteUser parameter is used by the RSH server to find a .rhosts file. The RSH server can restrict access by a target to a specific user name, i.e., the localUser parameter. For additional remote command execution routines see remLib in the Reference Manual. Close the socket file descriptor when your task has finished using it.

31 netDrv Client Services Comparison
Advantages of FTP over RSH: FTP is part of the TCP/IP protocol suite, so it is available on all networked hosts. FTP is faster on open/close, since there is no shell delay. FTP server is supplied with VxWorks. Advantages of RSH over FTP: FTP clear text password goes over the network on each open( ) and close( ). A netDrv device for accessing files on the boot host is automatically created at boot time. Remote shell protocol (RSH) is a UNIX protocol for executing commands remotely. (UNIX Host) File transfer protocol (FTP) is an internet protocol for remote file transfer.

32 netDrv vs. nfsDrv Advantages of nfsDrv over netDrv:
Reads and writes only needed parts of the file. Can access arbitrarily large files. open( )/close( ) much faster. Can use dirLib routines. Can flush file changes with FIOSYNC. Advantages of netDrv over nfsDrv: All networked hosts have an FTP server. Easier to configure. read( )/write( ) slightly faster.

33 Summary Internet Protocol for node-to-node routing.
MUX layer decouples link-layer driver and network protocol. Configuring the network Configure host name table using hostAdd() or use DNS resolver. Configure host’s routing table using mRouteAdd() or use RIP/OSPF. Show routines are available to troubleshoot network configuration.

34 Summary DHCP allows a host to obtain IP address leases and boot parameters from a remote server. DHCP components: DHCP Server DHCP Relay Agent DHCP Client rlogin (UNIX Host) and telnet support. FTP and NFS servers allows local VxWorks files to be accessed by a remote machine.

35 Summary nfsDrv mounts remote file systems with nfsMount( )
Reads and writes portion of remote file. File system must be exported by remote host. netDrv devices created with netDevCreate( ). Entire file is read into VxWorks on open( ), and not updated until close( ). Uses either RSH (UNIX Host) or FTP for file transfer. RSH requires name and entry in .rhosts. (UNIX Host) FTP requires name and password. rcmd ( ) and rlogin() (UNIX Host)

Download ppt "Networking 12.1 Introduction VxWorks Network Configuration"

Similar presentations

Ads by Google