ubuntu16.04单网卡配置多ip
vim /etc/network/interfaces
1 2 3 4 5 6
| # auto lo iface lo inet loopback # auto eth0 iface eth0 inet dhcp
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| # auto lo iface lo inet loopback # auto eth0 auto eth0:0 # iface eth0 inet static address 192.168.1.23 gateway 192.168.1.1 netmask 255.255.0.0 # iface eth0:0 inet static address 192.168.1.24 gateway 192.168.1.1 netmask 255.255.255.0
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| # auto lo iface lo inet loopback # auto eth0 auto eth0:0 auto eth0:1 # iface eth0 inet static address 192.168.1.23 gateway 192.168.1.1 netmask 255.255.0.0 # iface eth0:0 inet static address 192.168.1.24 gateway 192.168.1.1 netmask 255.255.255.0 # iface eth0:1 inet static address 192.168.1.25 gateway 192.168.1.1 netmask 255.255.255.0
|
$sudo service networking restart
或者sudo /etc/init.d/networking restart