从具有 VLAN 的接口中删除 IP 地址

从具有 VLAN 的接口中删除 IP 地址

在 Arch Linux 上,我在 2 个 VLAN(3 和 7)上有一个物理以太网接口,具有 VLAN 的静态 IP 地址和“主”以太网接口的 DHCP 地址。

有没有办法从 eth0 中删除 IP 地址而只保留 VLAN?或者有没有办法将 eth0 分配给 VLAN?我希望将其作为/etc/netctl/etc/systemd/network配置文件的一部分来完成。

的结果ip addr是:

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 link/ether 6c:ec:eb:5c:a3:0b brd ff:ff:ff:ff:ff:ff inet 192.168.106.55/24 brd 192.168.106.255 scope global eth0 inet6 fe80::6eec:ebff:fe5c:a30b/64 scope link valid_lft forever preferred_lft forever 3: eth0.7@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default link/ether 6c:ec:eb:5c:a3:0b brd ff:ff:ff:ff:ff:ff inet 10.0.0.1/24 brd 10.0.0.255 scope global eth0.7 inet6 fe80::6eec:ebff:fe5c:a30b/64 scope link valid_lft forever preferred_lft forever 4: eth0.3@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default link/ether 6c:ec:eb:5c:a3:0b brd ff:ff:ff:ff:ff:ff inet 192.168.1.7/24 brd 192.168.1.255 scope global eth0.3 inet6 fe80::6eec:ebff:fe5c:a30b/64 scope link valid_lft forever preferred_lft forever

结果ip -d link是:

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 promiscuity 0 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000 link/ether 6c:ec:eb:5c:a3:0b brd ff:ff:ff:ff:ff:ff promiscuity 0 3: eth0.3@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default link/ether 6c:ec:eb:5c:a3:0b brd ff:ff:ff:ff:ff:ff promiscuity 0 vlan protocol 802.1q id 3 <REORDER_HDR> 4: eth0.7@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default link/ether 6c:ec:eb:5c:a3:0b brd ff:ff:ff:ff:ff:ff promiscuity 0 vlan protocol 802.1q id 7 <REORDER_HDR>

答案1

手动:ifconfig $DEVICE 0.0.0.0 up应删除 IP 并保持接口正常运行。

某些发行版允许静态配置,而其他发行版则不允许。

也许你可以设置一个- 设备代替。

相关内容