TCP/IP uses the following sequence to select the source IP address for an outbound packet. For detailed information about the TCP/IP profile (PROFILE.TCPIP) and configuration statements, see z/OS Communications Server: IP Configuration Reference.
If this is a UDP or RAW socket, and IPV6_PKTINFO ancillary data is specified on sendmsg() with a nonzero source IP address, this address is used as the source IP address.
If this is a UDP or RAW socket, and the IPV6_PKTINFO socket option is set and it contains a nonzero source IP address, this address is used as the source IP address.
If the socket is already bound to a specific local IP address other than INADDR_ANY or in6addr_any, TCP/IP uses this specific local IP address.
The bind2addrsel socket function, which is available only to AF_INET6 sockets, binds a socket to a stack-selected local address and port that is appropriate to communicate with a given destination address.
If the socket is bound to a source port and to the INADDR_ANY or in6addr_any IP address, and there is a corresponding PORT profile statement with the BIND parameter specified, TCP/IP uses the address specified by the BIND parameter.
If this is a TCP socket and either the socket is not yet bound or the socket is bound to the INADDR_ANY or in6addr_any IP address, TCP/IP checks the job name and destination IP address against the SRCIP entries in the following order:
If a match is found, TCP/IP uses the designated source in the most specific matching entry to provide the source IP address to be used.
All of the following conditions must be met:
If these conditions are met and this is an IPv4 packet, TCP/IP uses the address specified on the TCPSTACKSOURCEVIPA parameter.
If these conditions are met and this is an IPv6 packet, TCP/IP uses the default source address selection algorithm to select one of the addresses configured for the VIPA interface referenced by the TCPSTACKSOURCEVIPA parameter. For information about the default source address selection algorithm, see z/OS Communications Server: IPv6 Network and Application Design Guide.
All of the following conditions must be met:
If these conditions are met, TCP/IP determines the interface over which the initial packet will be sent.
For an IPv4 packet, TCP/IP uses the HOME IP address of the link over which the initial packet is sent.
For an IPv6 packet, TCP/IP uses the default source address selection algorithm to select one of the addresses configured for the interface over which the initial packet is sent. For information about the default source address selection algorithm, see z/OS Communications Server: IPv6 Network and Application Design Guide.