VConfig 错误:无法添加 vlan 接口

VConfig 错误:无法添加 vlan 接口

我最近才开始研究 VLAN 内核功能,发现了一个相当具有挑战性的领域。

我以为我几乎已经掌控了一切,但后来发现了一个我显然无法解决的问题。

我有一些自动脚本负责创建和销毁一些网络命名空间它必须将用户域彼此隔离。

在我的一台服务器上,这个脚本已经正常工作了 2 个月,但今天突然开始出现非常奇怪的行为。内核版本是3.13.0-24-通用在内运行Ubuntu 14.04 LTS

目前的情况如下:

cat /proc/net/vlan/config

VLAN Dev name    | VLAN ID
Name-Type: VLAN_NAME_TYPE_RAW_PLUS_VID_NO_PAD

那里什么也没有。

ip netns ls

TEST

也就是说我的命名空间仍然存在。

ip netns exec TEST cat /proc/net/vlan/config

VLAN Dev name    | VLAN ID
Name-Type: VLAN_NAME_TYPE_RAW_PLUS_VID_NO_PAD
tap0.105       | 105  | tap0

我已经在此域中定义了一个虚拟标记接口,该接口已正确配置并正确运行。

ip netns exec TEST ip addr

1: lo: <LOOPBACK> mtu 65536 qdisc noop state DOWN group default 
   link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
92: tap0.105@if12: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc 
      noqueue state UP group default 
    link/ether 5a:ff:b5:98:6f:c2 brd ff:ff:ff:ff:ff:ff
    inet 172.16.51.1/32 scope global tap0.105
      valid_lft forever preferred_lft forever
    inet6 fe80::58ff:b5ff:fe98:6fc2/64 scope link 
      valid_lft forever preferred_lft forever

然后是问题:

vconfig add eth1 10

ERROR: trying to add VLAN #10 to IF -:eth1:-  error: File exists

而且当然:

vconfig rem eth1.10

ERROR: trying to remove VLAN -:eth1.10:- error: No such device

我尝试在互联网上查找类似的错误情况,但没有成功。其他一些输出:

ip netns pids TEST

没有结果。

这是该命令的 STRACE:

root@d-intfw1:~# strace vconfig add eth1 10 execve("/sbin/vconfig", ["vconfig", "add", "eth1", "10"], [/* 17 vars */]) = 0 brk(0) = 0x1a2a000 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory) mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f361112c000 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory) open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3 fstat(3, {st_mode=S_IFREG|0644, st_size=24418, ...}) = 0 mmap(NULL, 24418, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f3611126000 close(3) = 0 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory) open("/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\320\37\2\0\0\0\0\0"..., 832) = 832 fstat(3, {st_mode=S_IFREG|0755, st_size=1845024, ...}) = 0 mmap(NULL, 3953344, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f3610b46000 mprotect(0x7f3610d02000, 2093056, PROT_NONE) = 0 mmap(0x7f3610f01000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1bb000) = 0x7f3610f01000 mmap(0x7f3610f07000, 17088, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f3610f07000 close(3) = 0 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f3611125000 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f3611123000 arch_prctl(ARCH_SET_FS, 0x7f3611123740) = 0 mprotect(0x7f3610f01000, 16384, PROT_READ) = 0 mprotect(0x601000, 4096, PROT_READ) = 0 mprotect(0x7f361112e000, 4096, PROT_READ) = 0 munmap(0x7f3611126000, 24418) = 0 open("/proc/net/vlan/config", O_RDONLY) = 3 close(3) = 0 socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 3 ioctl(3, SIOCSIFVLAN, 0x7fffeead1420) = -1 EEXIST (File exists) write(2, "ERROR: trying to add VLAN #10 to"..., 65ERROR: trying to add VLAN #10 to IF -:eth1:- error: File exists ) = 65 exit_group(3) = ? +++ exited with 3 +++

有人知道这种行为的原因是什么吗?非常感谢。

相关内容