® 12-2 Networking 12.1Introduction VxWorks Network Configuration Routing Protocols Remote Access...

34
® 12-1 Networking Networking 12.1 Introduction VxWorks Network Configuration Routing Protocols Remote Access Services

Transcript of ® 12-2 Networking 12.1Introduction VxWorks Network Configuration Routing Protocols Remote Access...

Page 1: ® 12-2 Networking 12.1Introduction VxWorks Network Configuration Routing Protocols Remote Access Services.

®12-1

NetworkingNetworking

12.1 Introduction

VxWorks Network Configuration

Routing Protocols

Remote Access Services

Page 2: ® 12-2 Networking 12.1Introduction VxWorks Network Configuration Routing Protocols Remote Access Services.

®12-2

Network ProtocolsNetwork 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

Page 3: ® 12-2 Networking 12.1Introduction VxWorks Network Configuration Routing Protocols Remote Access Services.

®12-3

Network ComponentsNetwork Components

Page 4: ® 12-2 Networking 12.1Introduction VxWorks Network Configuration Routing Protocols Remote Access Services.

®12-4

Network ScalabilityNetwork 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.)

Page 5: ® 12-2 Networking 12.1Introduction VxWorks Network Configuration Routing Protocols Remote Access Services.

®12-5

Network ServicesNetwork 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.

Page 6: ® 12-2 Networking 12.1Introduction VxWorks Network Configuration Routing Protocols Remote Access Services.

®12-6

NetworkingNetworking

Introduction

12.2 VxWorks Network Configuration

Routing Protocols

Remote Access Services

Page 7: ® 12-2 Networking 12.1Introduction VxWorks Network Configuration Routing Protocols Remote Access Services.

®12-7

Host NamesHost 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.

Page 8: ® 12-2 Networking 12.1Introduction VxWorks Network Configuration Routing Protocols Remote Access Services.

®12-8

Domain Name SystemDomain 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 resolvLibresolvLib.

resolvLibresolvLib 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.

Page 9: ® 12-2 Networking 12.1Introduction VxWorks Network Configuration Routing Protocols Remote Access Services.

®12-9

DNS Resolver ConfigurationDNS Resolver Configuration

The DNS resolver component ((//network components/networking network components/networking

applications/DNS resolverapplications/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().

Page 10: ® 12-2 Networking 12.1Introduction VxWorks Network Configuration Routing Protocols Remote Access Services.

®12-10

DHCP BasicsDHCP 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.

Page 11: ® 12-2 Networking 12.1Introduction VxWorks Network Configuration Routing Protocols Remote Access Services.

®12-11

DHCP ConfigurationDHCP Configuration

Page 12: ® 12-2 Networking 12.1Introduction VxWorks Network Configuration Routing Protocols Remote Access Services.

®12-12

NetworkingNetworking

Introduction

VxWorks Network Configuration

12.3 Routing Protocols

Remote Access Services

Page 13: ® 12-2 Networking 12.1Introduction VxWorks Network Configuration Routing Protocols Remote Access Services.

®12-13

Routing OverviewRouting 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

elseuse routing table to find correct

routersend data to router

Page 14: ® 12-2 Networking 12.1Introduction VxWorks Network Configuration Routing Protocols Remote Access Services.

®12-14

Adding Static Routes in VxWorksAdding 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 routeLibrouteLib help page for details.

To add a route to the 90.0.0.0 /24 network through the router gatehost:

mRouteAdd (“90.0.0.0”, “gatehost”, 0xffffff00, 0, 0) Routing table show routines, mRouteShow() or

routeShow() require the component /network /network components/networking protocols/network debugging/ Network components/networking protocols/network debugging/ Network show routinesshow routines.

Page 15: ® 12-2 Networking 12.1Introduction VxWorks Network Configuration Routing Protocols Remote Access Services.

®12-15

Network Show RoutinesNetwork 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 TABLEdestination gateway flags Refcnt Use Interface--------------------------------------------------------------------------147.11.12.14 08:00:20:7b:06:fb 405 0 45 ei0147.11.12.165 00:60:97:4f:d5:16 405 0 0 ei0--------------------------------------------------------------------------value = 75 = 0x4b = ‘K’

Page 16: ® 12-2 Networking 12.1Introduction VxWorks Network Configuration Routing Protocols Remote Access Services.

®12-16

Dynamic Routing OverviewDynamic 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).

Page 17: ® 12-2 Networking 12.1Introduction VxWorks Network Configuration Routing Protocols Remote Access Services.

®12-17

Routing Internet ProtocolRouting 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 ripLibripLib in the VxWorks Reference Manual for details.

Page 18: ® 12-2 Networking 12.1Introduction VxWorks Network Configuration Routing Protocols Remote Access Services.

®12-18

NetworkingNetworking

Introduction

VxWorks Network Configuration

Routing Protocols

12.4 Remote Access Services

Page 19: ® 12-2 Networking 12.1Introduction VxWorks Network Configuration Routing Protocols Remote Access Services.

®12-19

VxWorks Remote ServicesVxWorks Remote Services

Page 20: ® 12-2 Networking 12.1Introduction VxWorks Network Configuration Routing Protocols Remote Access Services.

®12-20

Remote Login and TelnetRemote Login and Telnet

rlogin and telnet offer an alternative to cross-development using the Tornado target server.

Page 21: ® 12-2 Networking 12.1Introduction VxWorks Network Configuration Routing Protocols Remote Access Services.

®12-21

NFS Server OverviewNFS 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 /network components/networking protocols/network filesystems/protocols/network filesystems/NFSNFS server 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.

Page 22: ® 12-2 Networking 12.1Introduction VxWorks Network Configuration Routing Protocols Remote Access Services.

®12-22

VxWorks FTP ServerVxWorks FTP Server

The FTP server component is included by configuring /network components/networking protocols/network filesystems/FTP /network components/networking protocols/network filesystems/FTP serverserver.

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 /network components/networking protocols/network filesystems/FTP server securityserver security.

The RLOGIN/TELNET password protectionRLOGIN/TELNET password protection component allows a single user name and encrypted password. Additional users can be added by calling loginUserAdd() in application initialization code.

Page 23: ® 12-2 Networking 12.1Introduction VxWorks Network Configuration Routing Protocols Remote Access Services.

®12-23

NFS vs. FTP ServerNFS vs. FTP Server

NFS 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.

Page 24: ® 12-2 Networking 12.1Introduction VxWorks Network Configuration Routing Protocols Remote Access Services.

®12-24

NFS Client ServiceNFS 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 /network components/networking protocols/network filesystems/NFS clientcomponents/networking protocols/network filesystems/NFS client.

Page 25: ® 12-2 Networking 12.1Introduction VxWorks Network Configuration Routing Protocols Remote Access Services.

®12-25

NFS Client ConfigurationNFS 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:

% ididuid=219(marc) gid=700(training)

Page 26: ® 12-2 Networking 12.1Introduction VxWorks Network Configuration Routing Protocols Remote Access Services.

®12-26

netDrv File Access ClientsnetDrv File Access Clients

netDrvnetDrv 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.

dirLibdirLib routines opendir / readdir do not work on netDrv directories. stat / fstat are only partially implemented.

Page 27: ® 12-2 Networking 12.1Introduction VxWorks Network Configuration Routing Protocols Remote Access Services.

®12-27

Creating network DevicesCreating 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)

Page 28: ® 12-2 Networking 12.1Introduction VxWorks Network Configuration Routing Protocols Remote Access Services.

®12-28

Executing Remote CommandsExecuting Remote Commands

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.

Page 29: ® 12-2 Networking 12.1Introduction VxWorks Network Configuration Routing Protocols Remote Access Services.

®12-29

UNIX: Remote Command ExecutionUNIX: 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 514 (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 stderrstderr is foreach I

(*.o)returned through this pointer.

Returns a socket file descriptor or ERROR.

Page 30: ® 12-2 Networking 12.1Introduction VxWorks Network Configuration Routing Protocols Remote Access Services.

®12-30

netDrv Client Services ComparisonnetDrv 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( ).

Page 31: ® 12-2 Networking 12.1Introduction VxWorks Network Configuration Routing Protocols Remote Access Services.

®12-31

netDrv vs. nfsDrvnetDrv vs. nfsDrv

Advantages of nfsDrvnfsDrv over netDrvnetDrv:

– Reads and writes only needed parts of the file.

– Can access arbitrarily large files.

– open( )/close( ) much faster.

– Can use dirLibdirLib routines.

– Can flush file changes with FIOSYNC.

Advantages of netDrvnetDrv over nfsDrvnfsDrv:

– All networked hosts have an FTP server.

– Easier to configure.

– read( )/write( ) slightly faster.

Page 32: ® 12-2 Networking 12.1Introduction VxWorks Network Configuration Routing Protocols Remote Access Services.

®12-32

SummarySummary

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.

Page 33: ® 12-2 Networking 12.1Introduction VxWorks Network Configuration Routing Protocols Remote Access Services.

®12-33

SummarySummary

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.

Page 34: ® 12-2 Networking 12.1Introduction VxWorks Network Configuration Routing Protocols Remote Access Services.

®12-34

SummarySummary

nfsDrvnfsDrv mounts remote file systems with nfsMount( )

– Reads and writes portion of remote file.

– File system must be exported by remote host.

netDrvnetDrv 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.rhosts. (UNIX Host)

– FTP requires name and password.

rcmd ( ) and rloginrlogin() (UNIX Host)