Source IP address selection

TCP/IP determines the source IP address for a TCP outbound connection, or for a UDP or RAW outbound packet, by using the following sequence, which is listed in descending order of priority.

  1. Sendmsg( ) using the IPV6_PKTINFO ancillary option specifying a nonzero source address (RAW and UDP sockets only)
  2. Setsockopt( ) IPV6_PKTINFO option specifying a nonzero source address (RAW and UDP sockets only)
  3. Explicit bind to a specific local IP address
  4. bind2addrsel socket function (AF_INET6 sockets only)
  5. PORT profile statement with the BIND parameter
  6. SRCIP profile statement (TCP connections only)
  7. TCPSTACKSOURCEVIPA parameter on the IPCONFIG or IPCONFIG6 profile statement (TCP connections only)
  8. SOURCEVIPA: Static VIPA address from the HOME list or from the SOURCEVIPAINTERFACE parameter
  9. HOME IP address of the link over which the packet is sent

For a TCP connection, the source address is selected for the initial outbound packet, and the same source IP address is used for the life of the connection. For the UDP and RAW protocols, a source IP address selection is made for each outbound packet. A more detailed description of this sequence follows.