Bug 67171 - Didn't modify route table when change interface's second address
Summary: Didn't modify route table when change interface's second address
Status: NEW
Alias: None
Product: Networking
Classification: Unclassified
Component: IPV4 (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: Stephen Hemminger
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-12-17 03:02 UTC by Weilong Chen
Modified: 2013-12-18 03:03 UTC (History)
0 users

See Also:
Kernel Version: 3.13.0
Subsystem:
Regression: No
Bisected commit-id:


Attachments

Description Weilong Chen 2013-12-17 03:02:24 UTC
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.
Comment 1 Stephen Hemminger 2013-12-17 04:08:26 UTC
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.
Comment 2 Weilong Chen 2013-12-18 02:54:23 UTC
(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.
Comment 3 Weilong Chen 2013-12-18 03:03:35 UTC
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.

Note You need to log in before you can comment on or make changes to this bug.