Em 16-11-2011 17:48, Dale Dellutri escreveu: > I have an ethernet device in my lan with a primary address 192.168.5.205 > 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 192.168.5.217/24 broadcast 192.168.5.255 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 192.168.5.205/24 brd 192.168.5.255 scope global eth0 > inet 192.168.5.217/24 brd 192.168.5.255 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 11.11.11.11 via 192.168.5.148 src 192.168.5.217 > > And the ip route show command shows that it knows the source. > > # ip route show > 11.11.11.11 via 192.168.5.148 dev eth0 src 192.168.5.217 > > But where is the source address kept? If I look at /proc/net/route, > it shows the route (0B0B0B0B = 11.11.11.11), but not the source > address. > > # cat /proc/net/route > Iface Destination Gateway Flags RefCnt Use Metric Mask MTU Window IRTT > eth0 0B0B0B0B 9405A8C0 0007 0 0 0 FFFFFFFF 0 0 0 > ... > > Where is the source address kept? > ip route uses NETLINK to obtain info I did: strace -o /tmp/strace.out ip route show and inside strace.out: bind(3, {sa_family=AF_NETLINK, pid=0, groups=00000000}, 12) = 0 sendto(3, "\24\0\0\0\22\0\1\0031\25\304N\0\0\0\0\0\0\0\0", 20, 0, {sa_family=AF_NETLINK, pid=0, groups=00000000}, 12) = 20 recvmsg(3, {msg_name(12)={sa_family=AF_NETLINK, pid=0, groups=00000000}, msg_iov(1)=[{"\364\0\0\0\20\0\2\0001\25\304N\"\r\0\0\0\0\4\3\1\0\0\0I\0\1\0\0\0\0\0"..., 16384}], msg_controllen=0, msg_flags=0}, 0) = 1688 You can see /proc/net/rt_cache, there is a Source column there. -- Marcelo Beckmann Suporte Corporativo - suporte at webers.com.br Webers Tecnologia - http://www.webers.com.br Curitiba (PR) (41) 3094-6600 Rio de Janeiro (RJ) (21) 4007-1207 São Paulo (SP) (11) 4007-1207