SOCKETS TCP/IP Stack. LXE MX1-IS
Advertisement
Advertisement
SOCKETS TCP/IP Stack 77
SOCKETS TCP/IP Stack
Introduction
SOCKETS.CFG sets the options for SOCKETP.EXE. The section XXX.XXX.XXX.XXX is for this machines IP. The net mask is specified as part of the ip address. In the ip address command an optional /net_bits can be used to indicate the number of bits in the network ID.
Net Mask Class IP address range Net
Bits
8
16
255.0.0.0
255.255.0.0
A
B
0.x.x.x to 127.x.x.x
128.x.x.x to 191.x.x.x
24 255.255.255.0 C 192.x.x.x or higher
The network can be subdivided by two for every net bit added.
Net
Bits
Net
Mask
Net
Bits
Net
Mask
1 128 5 248
2 192 6 252
3 224 7 254
4 240 8 255
Bootp
BOOTP is a UDP/IP based protocol that provides a means to assign an IP address to a booting host dynamically and without user supervision. BOOTP can also supply the net mask, host name, and address of a domain name server. One obvious advantage of this procedure is the centralized management of network addresses, which eliminates the need for per-host unique configuration files. Sockets implements the BOOTP client whenever it is started with no (or the 0.0.0.0) IP address supplied. For file server based networks, Sockets workstations can be configured in a similar way using the SETHOST utility.
DHCP
DHCP is a UDP/IP based protocol that provides a means to assign the IP address dynamically to a booting host and without user supervision. It can also supply the net mask, host name, address of a domain name server, and other parameters. An advantage of this procedure is the centralized management of network addresses, which eliminates the need for per-host unique configuration files. Sockets implements the DHCP client whenever it is started with the 0.0.0.1 IP address supplied. All LAN interfaces specified when this IP address is in use will attempt to use DHCP to resolve the IP address, the subnet mask, hostname, default router and DNS server(s).
E-EQ-MX1ISRG-F MX1 I-Safe Reference Guide
78 SOCKETS TCP/IP Stack
Setting SOCKETS.CFG Parameters
Set IP Address
To enable DHCP set the IP address to 0.0.0.1
IP address XXX.XXX.XXX.XXX/16 where
XXX.XXX.XXX.XXX is the IP address
16 indicates the number of bits in the network ID
Set ARP INIT
Controls whether a DHCP ARP is sent when booting up.
ARP INIT GRAT
Using this option makes the stack behave the same as before. The stack does not send a DHCP
ARP when booting up (In this mode, the ARP contains the MAC and IP addresses in the sender’s field). This option is the default.
ARP INIT DHCP
Using this option sends a DHCP ARP on boot up (the sender’s IP address field is zero filled).
Set Interface
Interface sets the physical interfaces
Interface pdr if0 dix 1500 10 0x69 where pdr = packet driver if0 = interface_card dix = frame type
1500 = MTU
10 = Buffers
0x69 = ioaddr
Set Router IP (Gateway only)
When using a gateway (IP router) to the rest of the world, replace “XXX.XXX.XXX.XXX” with your gateway ip and remove the # at the beginning of the line.
# route add default if0 XXX.XXX.XXX.XXX
Set Domain Name Server
When using a domain name server (DNS), replace XXX.XXX.XXX.XXX with the IP address of the DNS, and remove the # at the beginning of the line.
# domain server XXX.XXX.XXX.XXX
Display IP Address
Redisplay IP information when SOCKET.CFG runs.
IP address
MX1 I-Safe Reference Guide E-EQ-MX1ISRG-F
SOCKETS TCP/IP Stack 79
Options
Refer to documentation to change. ip ttl 15 tcp mss 1460 tcp window 2920 tcp retry 8 tcp irtt 500ms
SOCKET.CFG Parameters
domain
If a host name is not a decimal (dotted) address and it is not found in the HOSTS file and at least one Domain Name Server has been defined, an attempt is made to obtain the address from the defined DNS server(s). The number of times any server is polled (retries), in addition to the time to wait for a response, can also be specified. A suffix may be specified and is attached to all names not containing any dots.
All of the following sub-commands can be issued without the optional parameters to obtain information on the current status.
Syntax domain server [host_name] domain retry [retry_count] domain time [wait_time] domain suffix [domain] domain server adds a DNS address or lists the current servers if host_name not specified. domain retry specifies the retry count for polling each server. domain retry lists the retry count if retry_count not specified. domain time specifies or lists the time (milliseconds) to wait for a response before attempting retry. domain time lists the time (milliseconds) to wait if wait_time not specified. domain suffix specifies the domain suffix to add to all simple names; names that contains no dots. domain suffix lists the domain suffix if domain is not specified.
Example domain retry 3 domain server 196.2.1.1 domain suffix myorg.co.za domain time 2000
E-EQ-MX1ISRG-F MX1 I-Safe Reference Guide
80 SOCKETS TCP/IP Stack
iface
iface is a synonym for the interface command.
interface
interface informs Sockets of the hardware or software communications interface(s) to be used at the network interface level. At least one network interface is required, and two or more are used in gateway (router) applications.
The class or mode of each interface defines the encapsulation used for packaging the data frame into the transport frame. Some types of interface support only one class.
When using more than one interface, Sockets assigns the previous given IP address in the .CFG file to this interface and uses its net mask to add a route to that net through this interface. Using the same IP address would result in multiple routes to the same network. The default route is set on the first interface with an IP address with a zero net mask (for example, IP address
19.63.10.11/0).
Each interface statement uses the IP address from the last supplied IP address statement.
Syntax (general) interface type name class other parameters
Syntax (specific) interface pdr name dix mtu numbuf intvec [irq] interface asy name [slip | cslip | ppp] mtu buflim ioaddr iovec speed [modemfile]
Parameters type type defines the type of hardware or software interface. interface supports the following software interfaces.
Interface Description
Asy Standard PC asynchronous interface (RS232 port)
Pdr packet driver interface name name defines the name by which the interface is known on the local host. name is a symbolic name known only to the local host on which it is used. name may be arbitrarily assigned. Each interface command on the same host must have a unique name assigned. This name is used by commands such as route, trace, param, and so on.
MX1 I-Safe Reference Guide E-EQ-MX1ISRG-F
SOCKETS TCP/IP Stack 81 class class specifies how IP datagrams are to be encapsulated in the link level protocol of the interface.
Some interfaces offer a choice between classes while others use a fixed class. The following classes are available and are listed with their associated types.
Type Class (defined in the following list)
Pdr
Asy dix, ieee, token, driver, slip raw, slip, cslip, ppp
Class
Dix
Token
Ieee
Driver
Slip
Cslip
Ppp
Description
The DEC/Intel/Xerox Ethernet interface also known as Blue Book Ethernet or Ethernet II.
IBM Token Ring. Source routing is supported for multiple rings.
IEEE: 802.3 Ethernet with SNAP headers.
Use the default class for the packet driver.
Serial Link Internet Protocol (SLIP) for point-to-point asynchronous links. This mode is compatible with UNIX SLIP.
Compressed Serial Link Internet Protocol (SLIP) for faster reaction over point-to-point synchronous links.
Point-to-point protocol over asynchronous links. mtu mtu specifies the Maximum Transmission Unit size, in bytes. Datagrams larger than this limit are fragmented into smaller pieces at the IP layer. The maximum value of mtu for the various interfaces is:
Ethernet - 1500
For serial links a standard value for mtu is 576. (576 is the maximum according to specifications, but may be increased on reliable connections as long as both sides use the same value.) numbuf numbuf specifies how many incoming datagrams may be queued on the receive queue at one time.
If this limit is exceeded, further received datagrams are discarded. This mechanism is used to prevent fast interfaces from filling up memory when data cannot be handled fast enough.
E-EQ-MX1ISRG-F MX1 I-Safe Reference Guide
82 SOCKETS TCP/IP Stack buflim buflim specifies the maximum number of outgoing datagrams or packets to queue before starting to discard datagrams. This mechanism is used to prevent the memory from filling up when a serial link goes down. bufsize bufsize specifies the size of the ring buffer in bytes to be allocated to the receiver in raw mode. intvec intvec specifies the software interrupt number (vector) in hexadecimal to use for resident packet drivers. ioaddr ioaddr is the I/O base address in hexadecimal of a serial port or the hardware controller and must correspond with the jumper or switch settings used during the setup of the controller board. The standard values for serial ports are:
COM1 03F8h
COM2 02F8h
COM3 03E8h
COM4 02E8h iovec iovec is the hardware interrupt vector used by the serial port or controller and must correspond with the jumper or switch settings used during setup of the controller. The standard values for serial ports are:
COM1 4
COM2 3
COM3 4
COM4 3 irq irq is the hardware interrupt vector used by the network interface controller. This is only used for faster response in Sockets. modemfile
A file containing the modem commands and scripts. speed speed specifies the transmission speed for serial interface devices (baud rate). Before using a serial connection you have to set flow control with the param command.
Examples interface pdr if0 dix 1500 5 0x60 interface asy ser0 cslip 576 15 0x3f8 4 9600 interface asy p0 ppp 1500 30 0x3f8 4 9600 pppmod.mod
MX1 I-Safe Reference Guide E-EQ-MX1ISRG-F
SOCKETS TCP/IP Stack
ip
83 ip displays or sets the values of the options selected when defining the IP (internet protocol) host address of the next interface to be defined.
Syntax ip address [hostid [/net_bits] ] ip status ip ttl [number] ip address sets the IP host address of the next interface to be defined. A route is automatically added to each interface for the default or specified net mask for its address. To make an automatic route the default, specify the net bits as zero. When specified without the optional parameters, ip address displays the current value(s) of the local host IP address(es). To assign different IP addresses to different interfaces on the same host, an ip address statement must precede each interface definition. The last IP address given is used in case of missing ip address statements. ip status displays Internet Protocol (IP) statistics, such as total packet counts and error counters of various types. It also displays statistics on the Internet Control Message Protocol (ICMP). This includes the number of ICMP messages of each type sent or received. ip ttl sets the default time-to-live value which is placed in each outgoing IP datagram. The ttl value limits the number of gateway hops the datagram is allowed to take in order to kill datagrams that got stuck in loops.
Parameters hostid hostid specifies the IP host address to assign to the next interface to be defined. This may be a symbolic name from the HOSTS file, or a dotted decimal address.
/net_bits
A net mask can be specified for the host. In the ip address command an optional /net_bits can be used to indicate the number of bits in the network ID. The net mask is used to determine whether an incoming datagram is a broadcast and also for sending UDP broadcasts.
Net masks are more easily represented in binary or hexadecimal format. For example, the IP address 128.1.1.5/24 corresponds to a net mask of 255.255.255.0 (FFFFFF00h),
25 bits to 255.255.255.128 (FFFFFF80h) and 26 bits to 255.255.255.192 (FFF FFC0h).
The default net mask used corresponds to the class of address used if not explicitly specified.
Net Bits Net Mask Class IP address range
8 255.0.0.0 A 0.x.x.x to 127.x.x.x
16 255.255.0.0 B 128.x.x.x to 191.x.x.x
24 255.255.255.0 C and higher 192.x.x.x or higher
E-EQ-MX1ISRG-F MX1 I-Safe Reference Guide
84 SOCKETS TCP/IP Stack
If you want to subdivide your network, you can divide it by two for every net bit added. The following table provides information on converting between net bits and net mask. The number of net bits to add when changing a 0 in the net mask to:
Net Bits Net Mask Net Bits Net Mask
1 128 5 248
2 192 6 252
3 224 7 254
4 240 8 255 number
When number is omitted, ip ttl displays the current value of the time to live parameter.
param
param invokes a device-specific control routine. When executed without parameters, param displays defined interface names and device-specific flags. param operates differently for each interface type and even interface mode. In many cases it is used to interrogate the status of an interface. The ifstat and param commands perform similar and, in some cases, exactly the same function.
Syntax param ifname [arg1...argn]
Parameters ifname ifname defines the name used in the interface command for the device to be controlled. arg1...argn
These parameters depend on the type of interface in use.
Example
To display current serial link settings and restart the statistics on it, use: param sl0 clear param, Alternative Routing Control Sub-commands
The Alternative Routing Control Sub-commands set up and check the Sockets alternative route mechanism. More than one route can be specified to a target host or network. The first route which has an associated interface in the up state is used.
An interface is in the up state when it is defined by the interface command. It enters the query state when it does not receive valid input within a specified up-time period after sending data expecting a response. At this stage three (catering for links with a high data loss) ICMP echo requests (ping) are sent to a query IP address. It enters the down state by a Sockets command or when it does not receive valid input within the specified up-time period after entering the query
MX1 I-Safe Reference Guide E-EQ-MX1ISRG-F
SOCKETS TCP/IP Stack 85 state. If an up-time has never been specified or a value of 0 is specified, the interface will stay in the up state whether valid input is received or not.
An interface enters the up state by a Sockets command or when valid input is received on that interface when in the down or query states. An ICMP echo request is sent on an interface in the down state every down-time period. If a down-time has never been specified or a value of 0 is specified, the ICMP echo request will not be sent. Up-time and down-time is specified in seconds.
Syntax param ifname [ uptime | downtime ] time param ifname query hostname
Example Alternative Routing
Two X.25 interfaces are used to get to the target network 192.6.1.0. The first interface, named if0 should preferably be used, but if it stops receiving for a period of 20 seconds, it should try to ping
192.6.1.2 and if no response is received within another 20 seconds, if1 should take over, but if0 should be tried every five seconds. Interface if1 should disconnect after 80 seconds of no traffic.
The SOCKET.CFG file should contain the following: interface x25 if0 ... ... ... param if0 uptime 20 param if0 downtime 5 param if0 query 192.6.1.2 interface x25 if1 ... ... ... param if1 uptime 80 param if1 downtime 5 param if1 query 192.6.1.2 route add 192.6.1.0 if0 route add 192.6.1.0 if1
In the case of both if0 and if1 failing, both are tried every five seconds until one comes up. The return paths should also be maintained in a similar way with Sockets or by using RIP. param, RIP Advertising Sub-command for Interfaces
When the rip advertise command has been used, this param sub-command makes allowance to disable and re-enable RIP advertising on a specific interface.
Syntax param ifname [ ripadv | noripadv ]
Examples param if0 noripadv param if1 ripadv
E-EQ-MX1ISRG-F MX1 I-Safe Reference Guide
86
route
SOCKETS TCP/IP Stack route creates an entry in the IP routing table for Sockets to determine where to send data. The
Alternative Routing mechanism allows more than one route to be specified to a particular host or network. Failure of one route causes an automatic switch to the next route.
Refer also to the ip address command for specifying the net mask, because a route is automatically added to each interface for the default or specified net mask for that address. When multiple routes are defined to the same address, Sockets uses the route with the network size (largest number of bits in the net mask).
Syntax (general) route [ add | drop destination ifname [gateid |none [ metric
[proxy] [private] [static] ] ] ]
Syntax (specific) route add [ hostid | netid ] ifname [gateid] route add [ hostid | netid[/mask] ] ifname [gateid] route add default ifname route drop [ hostid | netid ] route drop [ hostid | netid[/mask] ] route drop default
Parameters add or drop
Sub-command to add or drop (remove) a route from the routing table. default
All transmissions to IP addresses not otherwise defined in routing commands are sent via the network interface specified by ifnam e. hostid hostid is the IP address of a destination remote host to which data must be sent, or a remote host which must be removed from the routing table (dropped).
netid netid is the IP address of a destination network to which data must be sent. Any host with this IP network address is able to receive the data. Whether a particular host will use the data depends on the host portion of the specific IP address in the IP header. mask mask specifies the number of bits in the network portion of the address if sub-netting is used. If not used, the network portion of the address is determined according to the class (A, B or C) of the address.
MX1 I-Safe Reference Guide E-EQ-MX1ISRG-F
SOCKETS TCP/IP Stack 87 ifname ifname defines the name used in the interface command for the immediate network on which the data for the designated host must be sent. This is the network level interface to be used by the local host to reach the remote host. gateid gateid parameter specifies the IP address of a host, on the same physical network as the local host, which is used as a gateway or router to a different network. The gateway or router host specified in gateid must be directly reachable on the same physical network as the local host defining this gateway. In other words, this must be the nearest gateway to this local host. metric
When using RIP or Proxy ARP a value from 0 to 16 for metric must be specified indicating the distance or cost of that route. A metric of 16 indicates that the route is down. proxy, private and static
To support the Routing Information Protocol (RIP) the route command utilizes the proxy, private and static key words. These words can be used in any order following metri c.
Proxy ARP should be used with care and not in conjunction with RIP. When more than one host responds to an ARP request, it can cause confusion and even lead to system crashes. This is possible in situations where more than one gateway implements Proxy ARP to a common destination.
When “RIP advertising” is selected, all interfaces advertise all routes except those routes making use of that specific interface (split horizon) and routes marked private. A route which is dropped as a result of a RIP update or which becomes unavailable as a result if its associated interface going into the down state, is immediately advertised as being infinite (metric = 16) and is not advertised until it becomes available again. In order for an interface to be used for advertising, a route without a gateway using that interface must be available. The advertisement is sent as a subnet broadcast using the net mask of the host and the IP address of the interface.
When “RIP using” is selected, routes are updated according to received RIP advertisements.
Routes added or amended as a result of RIP, have a timeout associated with them. If another RIP advertisement is not received during that time, the route is dropped. A route is also dropped if an advertisement of infinity (metric = 16) is received. To prevent dropping a route, it must be marked as static. The metric of a route marked static is never updated by a RIP advertisement. Instead a duplicate route is added before the static route. If the duplicate route is dropped as a result of a timeout or RIP, the static route is used again.
Examples route add default ipx0 route add unix_net eth0 route add unix_host ipx1 unx_gate route add unix_net2 eth0 /eth 1 route add unix_ net ipx0 unx_ gate route add subnet/26 eth0 sub_gw route drop unix_net route can specify a Proxy ARP on a route, as follows: route add net interface gateway metric [proxy]
When using Proxy ARP, gateway and metric must be specified. If no gateway is used, none can be specified. For example: route add 192.6.1.0 ifx25 none 5 proxy
E-EQ-MX1ISRG-F MX1 I-Safe Reference Guide
88 SOCKETS TCP/IP Stack
tcp
tcp commands display or set various TCP operating parameters. The TCP configuration commands are put into SOCKET.CFG.
Syntax tcp irtt [time] tcp lport [port_number] tcp mss [size] tcp retry [number] tcp rtt [time] tcp smss [size] tcp timemax [time] tcp window [size]
Parameters time time is the new time value in seconds, or milliseconds if “ms” is appended to the number, as in
2000ms. port_number port_number is the local port starting number. size
For tcp mss, size is the maximum segment size in bytes sent on all outgoing TCP connect requests
(SYN segments). size tells the remote host the size of the largest segment that may be received by this host. When changing the MSS value, any existing connections remain unchanged.
For tcp smss, size is the send maximum segment size in bytes sent on all outgoing TCP connect requests. This limits the size of the largest segment that may be sent by this host. When changing the SMSS value, any existing connections remain unchanged.
For tcp window, size is the size of the receive window in bytes for any new TCP connections.
Existing connections are unaffected. number number is the number of retries attempted without receiving an acknowledge from the remote host before the connection is broken. If the value exceeds 255, it implies an infinite number of retries; such a connection does not time-out. The default value for number is 6. tcp irtt Sub-command tcp irtt displays or sets the initial round-trip-time estimate. When specified without an argument, the command displays the current values of TCP parameters including the initial round-trip-time in milliseconds. time is the initial round-trip-time (IRTT) estimate and is used for new TCP connections until the actual value can be measured and adapted to. By increasing this value when operating over slow communication links, unnecessary retransmissions that otherwise occur before the smoothed estimate value approaches the correct value are minimized. The system default is 5000 milliseconds.
MX1 I-Safe Reference Guide E-EQ-MX1ISRG-F
SOCKETS TCP/IP Stack 89
To affect incoming connections, tcp irtt should be executed before the servers are started.
Example tcp irtt 120
Sample Output
TCP: IRTT 5 ms Retry 6 MSS 1460 SMSS 1460 Window 2920 tcp lport Sub-command tcp lport specifies the local port starting number. When specified without a number the current value of the next free local port number is displayed.
Example tcp lport 2004
Sample output
Lport = 2004 tcp mss Sub-command tcp mss displays or sets the TCP maximum segment size in bytes. When size is not specified, the current values of the TCP parameters, including the maximum segment size, are displayed. It is recommended to reduce the MSS and SMSS on bad network connections.
Example tcp mss 1460 tcp retry Sub-command tcp retry displays or sets the retry count before a connection is broken. When specified without the number parameter, tcp retry displays the current values of TCP parameters, including the retry count. tcp rtt sub-command tcp rtt replaces the automatically computed round-trip time (RTT) for the specified con nection with the time in milliseconds. Sockets calculates the RTT as a smooth average of past measured RTTs, starting with the IRTT on a new connection.
To get the current RTT in use for a connection n, use the tcp status n command that will give the smoothed average RTT indicated by SRTT.
Because tcp rtt provides a manual override of the normal back-off retransmission timing mechanisms, it may be used to speed up recovery from a series of lost packets.
Example tcp rtt 4 100
E-EQ-MX1ISRG-F MX1 I-Safe Reference Guide
90 SOCKETS TCP/IP Stack tcp smss sub-command tcp mss displays or sets the TCP send maximum segment size in bytes. When size is not specified, the current values of the TCP parameters, including the SMSS, are displayed.
A small SMSS causes the remote to reduce its segment size. tcp mss can reduce the MSS and
SMS S on bad network connections with high loss rates or where large packets get lost.
Example tcp smss 512 tcp window sub-command tcp window displays or sets the default and maximum receive window size.
When specified without the size parameter the current TCP parameters, including the current window size, are displayed.
Example tcp window 2920 tcp timemax sub-command tcp timemax sets the maximum duration of a tcp retry. If a value greater than 255 seconds is specified, connections will never timeout.
This is very useful in wireless applications where nodes roam in and out of service.
Example tcp timemax 2000ms
MX1 I-Safe Reference Guide E-EQ-MX1ISRG-F

Public link updated
The public link to your chat has been updated.
Advertisement