Re: primary and secondary ip addresses

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Martin A. Brown wrote:

Hello Hasso and Andrea,

We've gotten a little far afield from Neil Horman's initial question about why there are primary and secondary IPs, and I can't address your concern Andrea about the (route cache?) 500ms latency between the time that an address is added (or removed) from an interface and the time that the address is actually used. Even so, the Linux routing code allows the kernel to suggest an IP with the "src" keyword.



I apologize if I moved the topic too far from its original scope.

: > Why change the primary address? What is wrong with simply changing the
: > route to use the other source IP?
: : There is no support for it in most of user space software.
: None of the routing protocols suites support it etc.


Though some software provides support for explicit configuration of source address for initiated sockets, you can use INADDR_ANY and let the kernel perform source address selection for you.

Linux select an IP based on the routing table. [0]  Example:

 # ip route show 192.168.90.0/24
 192.168.90.0/24 dev eth0  scope link  src 192.168.90.250
 # ip route change 192.168.88.0/24 dev eth0 scope link src $SECONDARY

If you want to be fancy about it, you can have a higher preference routing table (make sure there's an entry in /etc/iproute2/rt_tables for $SECONDARY_TABLE). Then you can add and remove tables in this routing table instead of changing the route in the main routing table.

 # ip rule add prio table $SECONDARY_TABLE
 # ip route add table $SECONDARY_TABLE $DESTNET dev $REALDEV src $SECONDARY



I will give it a try and see if I get any improvement.
However, as last question (after this I will stop moving this topic further away from its original scope), do you guys know where I can find the code related to the routing cache in the kernel? I would like to see if there is a kind of timer for the update of such a cache.


Thank you again for all of your help.
Andrea


Best of luck!

-Martin

[0] http://linux-ip.net/gl/ip-cref/node155.html




- : send the line "unsubscribe linux-net" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux