# Wired or wireless interfaces
auto eth0
iface eth0 inet static
address 192.168.144.25
netmask 255.255.255.0
auto eth0:1
iface eth0:1 inet static
address 192.168.36.25
netmask 255.255.255.0
auto eth1
iface eth1 inet dhcp
auto eth1:1
iface eth1:1 inet static
address 192.168.72.25
netmask 255.255.255.0
如上会产生eth0,eth0:1,eth1,eth1:1四个网卡,其中eth1为dhcp client,其他三个为静态ip,eth0:1和eth1:1为VLAN,同理可以有eth0:2,eth1:2...
需要配置网关和路由如下:
iface eth0 inet static
address 192.168.79.25
netmask 255.255.255.0
network 192.168.79.0
gateway 192.168.79.1
因为我的固定IP仅用于内网通信,为了避免填写网关后可能修改/etc/resolve.conf造成无法访问DNS服务器没填写。具体内部原理未考证。
auto应该是开机自动配置,没有auto开机不回配置,这块是猜的,具体没考证。
本设置在米尔imx6ul系统上测试成功。仅供参考。