问题原文
原帖链接 · Feuermurmel · CC BY-SA 3.0
I'm creating dummy interfaces to set up dynamic routing, which all works fine. But I found one curious detail I can't explain: For some reason, when creating a dummy interface with the name dummy0, I get an error message, even though the interface is created correctly and works, while when using another name, no error message is shown:
root@sdsdd:~# ip link
[lo and eth0 not shown]
root@sdsdd:~# ip link add dummy0 type dummy
RTNETLINK answers: File exists
root@sdsdd:~# ip link add dummy1 type dummy
root@sdsdd:~# ip link
[lo and eth0 not shown]
3: dummy0: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN mode DEFAULT group default
link/ether c6:9c:73:8b:17:77 brd ff:ff:ff:ff:ff:ff
4: dummy1: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN mode DEFAULT group default
link/ether be:50:5b:53:99:ab brd ff:ff:ff:ff:ff:ff
What gives? What makes the name dummy0 special? I could not find any mention of it anywhere in /etc/network/interfaces*. I tried this on Debian 8 and Ubuntu 16.04 with the same result.
已采纳解答
原帖链接 · Feuermurmel · CC BY-SA 4.0
It's actually really simple. When running ip link add dummy1 type dummy, ip will automatically load the dummy kernel module (it did not do that in earlier versions). That module has a parameter numdummies, which configures how many dummy devices to create automatically and which defaults to 1.
Thus, loading the module already creates a dummy0 network interface without ip knowing. ip then tries to create another interface with the same name, which fails with the error message File exists.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
