[CentOS] Where is source address info of a route kept?

Wed Nov 16 20:00:53 UTC 2011
Mike Burger <mburger at bubbanfriends.org>

> I have an ethernet device in my lan with a primary address
> and a secondary address .217.  I added the secondary address after network
> startup established the primary address by an ip addr add command:
> # ip addr add broadcast dev eth0
> # ip addr show
> ...
> 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen
> 1000
>     link/ether 78:2b:cb:23:21:4c brd ff:ff:ff:ff:ff:ff
>     inet brd scope global eth0
>     inet brd scope global secondary eth0
>     inet6 fe80::7a2b:cbff:fe23:214c/64 scope link
>        valid_lft forever preferred_lft forever
> ...
> Then I add a new route via a network gateway but I want the route to use
> the secondary address as a source.
> # ip route add via src
> And the ip route show command shows that it knows the source.
> # ip route show
> via dev eth0  src
> But where is the source address kept?  If I look at /proc/net/route,
> it shows the route (0B0B0B0B =, but not the source
> address.
> # cat /proc/net/route
> Iface Destination Gateway  Flags RefCnt Use Metric Mask     MTU Window
> eth0  0B0B0B0B    9405A8C0 0007  0      0   0      FFFFFFFF 0   0      0
> ...
> Where is the source address kept?

It's not kept anywhere, statically.

You have two IPs on the same interface within the same subnet, one listed
as primary, one as secondary. The routing subsystem is using the primary
IP as the source.

Mike Burger

Visit the Dog Pound II BBS
telnet://dogpound2.citadel.org or http://dogpound2.citadel.org

To be notified of updates to the web site, visit:


or send a blank email message to:

site-update-subscribe at bubbanfriends.org