The bug came out by this: 1.ifconfig eth0:1 192.168.0.1 2.route add default gw 192.168.0.1 3.ifconfig eth0:1 172.168.0.1 4.route table is: Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface default 192.168.0.1 0.0.0.0 UG 0 0 0 eth0 default 128.5.130.254 0.0.0.0 UG 0 0 0 eth0 loopback * 255.0.0.0 U 0 0 0 lo 128.5.130.0 * 255.255.255.0 U 0 0 0 eth0 link-local * 255.255.0.0 U 0 0 0 eth0 172.168.0.0 * 255.255.0.0 U 0 0 0 eth0 Notice that,192.168.0.1 should be deleted because eth0:1's IP had been changed. This bug seems to be long time exist.I test on kernel version 2.6.32 and 3.0.13,they both have the question.
Network aliases are not what you think they are in Linux; in general they should not be used in the post 2.2 era! There really is not such interface as eth0:1 it exist only as a compatiablity hack for those people still wedded to the BSD model. Unless this worked wit some earlier 2.6 kernel, or you can reproduce it with modern utilities like 'ip addr add 172.168.0.1 dev eth0' then this bug will likely be ignored.
(In reply to Weilong Chen from comment #0) > The bug came out by this: > 1.ifconfig eth0:1 192.168.0.1 I made a mistake here.It was:'ifconfig eth0:1 192.168.0.2.'192.168.0.1' was the routers IP. > 2.route add default gw 192.168.0.1 > 3.ifconfig eth0:1 172.168.0.1 > 4.route table is: > Kernel IP routing table > Destination Gateway Genmask Flags Metric Ref Use Iface > default 192.168.0.1 0.0.0.0 UG 0 0 0 eth0 > default 128.5.130.254 0.0.0.0 UG 0 0 0 eth0 > loopback * 255.0.0.0 U 0 0 0 lo > 128.5.130.0 * 255.255.255.0 U 0 0 0 eth0 > link-local * 255.255.0.0 U 0 0 0 eth0 > 172.168.0.0 * 255.255.0.0 U 0 0 0 eth0 > > Notice that,192.168.0.1 should be deleted because eth0:1's IP had been > changed. > > This bug seems to be long time exist.I test on kernel version 2.6.32 and > 3.0.13,they both have the question.
Thanks for your reply. As your instruction, I used 'ip ...' to do the test.But there was an error when add the default route. 1.ip addr add 192.168.0.2/24 dev eth0 2.ip route add default via 192.168.0.2 dev eth0 RTNETLINK answers: File exists So,how about 'route add default gw 192.168.0.1' in earlier test? Maybe the command should fail as well? (In reply to Stephen Hemminger from comment #1) > Network aliases are not what you think they are in Linux; in general they > should not be used in the post 2.2 era! > There really is not such interface as eth0:1 it exist only as a > compatiablity hack for those people still wedded to the BSD model. > > Unless this worked wit some earlier 2.6 kernel, or you can reproduce it with > modern utilities like 'ip addr add 172.168.0.1 dev eth0' > then this bug will likely be ignored.