如何在特定的vlan上配置两个IP地址
我不确定这里的语法: /etc/network/interfaces
接口名称,VLAN或别名中的第一个是什么? 我想要的是在同一个VLAN上(临时)设置两个不同的子网。
它看起来如下所示,在同一VLAN(id 33)上有10.20.100.100/24和10.20.200.200/24:
iface eth0:1.33 inet static address 10.20.100.100 netmask 255.255.255.0 iface eth0:2.33 inet static address 10.20.200.200 netmask 255.255.255.0
我希望Debian Wiki能够回答这个问题,但事实并非如此: https : //wiki.debian.org/NetworkConfiguration#Multiple_IP_addresses_on_One_Interface
我不知道什么时候和什么改变了,但你现在可以在vlan上定义虚拟接口:
auto eth0.10 iface eth0.10 inet static address 192.168.1.61 netmask 255.255.255.0 gateway 192.168.1.11 auto eth0.10:1 iface eth0.10:1 inet static address 10.20.100.100 netmask 255.255.255.0 auto eth0.10:2 iface eth0.10:2 inet static address 10.20.100.200 netmask 255.255.255.0
将vlan接口视为物理接口。 您将虚拟接口添加到“物理”接口。
看起来这实际上不受支持。 您可以做的是添加几个up
或post-up
节,然后可以向接口添加地址。 我选择了这个解决方案:
auto eth0.10 iface eth0.10 inet static address 192.168.1.61 netmask 255.255.255.0 post-up ip address add 192.168.1.62 dev $IFACE