gtpc1m1t | Transmission Control Protocol/Internet Protocol |
To connect the TPF system to multiple TCP/IP networks, you can use the IP routing table (IPRT). You can set up IPRT entries to associate local IP addresses with a remote IP address or subnet of addresses.
When you use OSA-Express support, you can set up IPRT entries to associate remote networks and the gateways to them.
When a TPF TCP client application attempts to connect to a remote server, a bind function for a local TPF IP address may not have been explicitly issued. If this occurs, TCP/IP native stack support uses the IPRT to select a local IP address. This local IP address determines the set of channel-attached IP routers or OSA-Express connections that can be used for the connection to the remote server.
The IPRT entry that contains the best match for the IP address of the remote server is used. The IPRT entry with the most specific network mask becomes the best match for the IP address. The network mask represents a subnet of IP addresses or a specific IP address if it is equal to 255.255.255.255. If multiple entries qualify as the best match, the TPF system selects one entry on a round-robin basis. If a best match cannot be found, the default local IP address is used. If an entry is the best match, but it has a local TPF IP address that does not have active IP routers or OSA-Express connections, the entry is not selected.
In the following example, the TPF system is connected to two IP routers. IP router A has a local IP address of 4.4.4.4 and is connected to a remote network having a subnet IP address of 8.8.8.0. IP router B has a local IP address of 5.5.5.5 and is connected to a different remote network that has a subnet IP address of 10.10.10.0. The default local address is 5.5.5.5. There are no entries in the IPRT.
A client application wants to establish a connection to a remote server that has an IP address of 8.8.8.1. The client application issues a connect function without issuing a bind function. The TPF system searches the IP routing table for a remote address of 8.8.8.1 to determine which local IP address to use when sending the packet. The TPF system determines that the IPRT is empty and continues processing using the default local IP address of 5.5.5.5. The packet for the remote server is sent out across IP router B (5.5.5.5.); however, a connection is not established because IP router B is not connected to the 8.8.8.0. network.
You can use the IP routing table to resolve this condition. Enter
the ZTRTE command with the ADD parameter specified to add two entries to the
IPRT.
ZTRTE ADD RIP-8.8.8.1 LIP-4.4.4.4 NETMASK-255.255.255.255
ZTRTE ADD RIP-10.10.10.0 LIP-5.5.5.5 NETMASK-255.255.255.0
The IPRT now contains the following information:
Remote IP Address | Network Mask | Local IP Address |
---|---|---|
8.8.8.1 | 255.255.255.255 | 4.4.4.4 |
10.10.10.0 | 255.255.255.0 | 5.5.5.5 |
The client application again tries to establish a connection to the remote server that has an IP address of 8.8.8.1. The client application issues a connect function without issuing a bind function. The TPF system searches the IP routing table for a remote address of 8.8.8.1 to determine which local IP address to use when sending the packet. The TPF system finds an entry in the IPRT indicating that the local IP address of 4.4.4.4 is associated with IP router A and should be used for this connection. The packet for the remote server is sent out across IP router A (4.4.4.4) and a successful connection is established between the client application (4.4.4.4) and the remote server (8.8.8.1).
If more than one entry exists for a remote IP address or subnet of remote
IP addresses, the TPF system will search through the IPRT entries for each
connection. It is possible to have more than one entry for the same IP
address only if the local IP address is unique from all other entries with the
same remote IP address. For example, a third IP router, IP router C,
with an IP address of 7.7.7.7 is added to the TPF
system. IP router C is also connected to the remote network of
8.8.8.0. Another entry can be added to the IPRT
for the remote server (8.8.8.1). Now you have
multiple paths in the IP routing table to get to the remote server with the IP
address of 8.8.8.1. The IPRT now looks like
this:
Remote IP Address | Network Mask | Local IP Address |
---|---|---|
8.8.8.1 | 255.255.255.255 | 7.7.7.7 |
8.8.8.1 | 255.255.255.255 | 4.4.4.4 |
10.10.10.0 | 255.255.255.0 | 5.5.5.5 |
The IPRT can be created and managed by the ZTRTE command. See TPF Operations for more information about the ZTRTE command.
When the TPF system sends an IP packet to a destination that is on the network where the OSA-Express card is connected, the packet is sent directly to the destination. However, if the destination of the packet is a remote network, the TPF system must inform the OSA-Express card through which gateway to send the packet. For this, a gateway is a router that connects the local network (to which the OSA-Express card is attached) to remote networks. You can define up to two default gateways for each OSA-Express connection to your TPF system by entering the ZOSAE command specifying the DEFINE or MODIFY parameters and the GATEWAY1 or GATEWAY2 parameter.
For complex networks where you want to use specific gateways based on the remote destination, you can define IP routing table entries to specify which gateways the TPF system will use when sending packets to a specific remote node or network. Enter the ZTRTE command with the following parameters to define an IP routing table entry:
For example, your local network is 1.1.1.x and has five gateways whose IP addresses are 1.1.1.10, 1.1.1.11, 1.1.1.30, 1.1.1.40, and 1.1.1.43. You want all traffic destined for remote network 3.3.3.x to go through gateways 1.1.1.30 and 1.1.1.40. To do this, enter the following:
ZTRTE ADD RIP-3.3.3.0 NETMASK-255.255.255.0 NEXTHOP-1.1.1.30 ZTRTE ADD RIP-3.3.3.0 NETMASK-255.255.255.0 NEXTHOP-1.1.1.40
When multiple IP routing table entries exist for the same destination, the TPF system will use a round-robin method for selecting a gateway.
When a socket is created with a node that resides in a remote network and the TPF system has the first packet to send on that socket, a gateway is selected as follows: