12. Networking

thoughtlessskytopNetworking and Communications

Oct 29, 2013 (3 years and 9 months ago)

82 views

®

12
-
2

Networking

12.1

Introduction



VxWorks Network Configuration



Routing Protocols



Remote Access Services

®

12
-
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

®

12
-
4

Network Components

®

12
-
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
.)

®

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

®

12
-
7

Networking



Introduction

12.2

VxWorks Network Configuration



Routing Protocols



Remote Access Services

®

12
-
8

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.

®

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

®

12
-
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
().

®

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

®

12
-
12

DHCP Configuration

®

12
-
13


Networking



Introduction



VxWorks Network Configuration

12.3

Routing Protocols



Remote Access Services

®

12
-
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

®

12
-
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 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
components/networking protocols/network debugging/ Network
show routines
.

®

12
-
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

--------------------------------------------------------------------------

147.11.12.14 08:00:20:7b:06:fb 405 0 45 ei0

147.11.12.165 00:60:97:4f:d5:16 405 0 0 ei0

--------------------------------------------------------------------------

value = 75 = 0x4b = ‘K’

®

12
-
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).

®

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

®

12
-
19

Networking



Introduction



VxWorks Network Configuration



Routing Protocols

12.4

Remote Access Services

®

12
-
20

VxWorks Remote Services

®

12
-
21

Remote Login and Telnet










rlogin

and
telnet

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

®

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

®

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

®

12
-
24

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


®

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

®

12
-
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)

®

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

®

12
-
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)

®

12
-
29

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

®

12
-
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


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
stderr

is foreach I


(*.o)returned through this pointer.


Returns a socket file descriptor or ERROR.


®

12
-
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(

)
.

®

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

®

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

®

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

®

12
-
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)