Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1279466
  • 博文数量: 168
  • 博客积分: 3483
  • 博客等级: 中校
  • 技术积分: 1696
  • 用 户 组: 普通用户
  • 注册时间: 2006-02-06 13:17
文章分类

全部博文(168)

文章存档

2015年(6)

2014年(9)

2013年(47)

2012年(11)

2011年(13)

2010年(18)

2009年(11)

2008年(42)

2007年(11)

分类: LINUX

2009-09-28 22:50:40

ifconfig drops every virtual interface of the same sub-net instead of just the one you want
Description of problem:
Background: a physical interface (i.e.: eth0) with a few virtual interfaces associated to 
it (i.e.: eth0:0, eth0:1, eth0:2...).

When you try to drop just one of the virtual interfaces (i.e.: eth0:3) with 
"ifconfig eth0:x down", it drops that interface AND all the next interfaces of the same 
subnet (i.e.: eth0:3, 3th0:4, eth0:5).

A weird thing is that previous interfaces remain "up" even if they belong to the same 
subnet (i.e.: eth0:2).
---------------------------------------------------------------------
Have you tried to set promote secondaries sysctl variable?
I.e.:
ifconfig eth0:x 192.168.10.x/24
... sysctl net.ipv4.conf.eth0.promote_secondaries=1 ifconfig eth0:0 down

Addresses on the same subnets are noted as secondaries, when you remove the very
first, i.e. primary one, kernel kills others. When you don't want this
behaviour, enable promoting of secondaries and kernel will choose the following
address (virtual device) and set is as primary.

Tip: try to convert to ip(8), it says you they're secondary.  
=====================================================================
# sysctl net.ipv4.conf.eth0.promote_secondaries=1

# ifconfig eth0:1 10.1.1.2
# ifconfig eth0:0 10.1.1.1
# ifconfig eth0:2 10.1.1.3
# ifconfig eth0:4 10.1.1.4

# ifconfig eth0:1 down

# ip addr show dev eth0 secondary
2: eth0: mtu 1500 qdisc pfifo_fast state UP qlen 100
    link/ether 00:44:ee:11:ff:dd brd ff:ff:ff:ff:ff:ff
    inet 10.1.1.1/8 brd 10.255.255.255 scope global secondary eth0:0
    inet 10.1.1.3/8 brd 10.255.255.255 scope global secondary eth0:2
    inet 10.1.1.4/8 brd 10.255.255.255 scope global secondary eth0:4

阅读(1295) | 评论(0) | 转发(0) |
0

上一篇:问题备忘

下一篇:poll() 操作经验点滴

给主人留下些什么吧!~~