ubuntu 下一个网卡绑定2个ip
#vi /etc/network/interfaces
OR$ sudo vi /etc/network/interfaces
Modify as follows:
auto eth0 auto eth0:0 auto eth0:1 iface eth0 inet static address 192.168.1.1 netmask 255.255.255.248 gateway 192.168.1.254 iface eth0:0 inet static address 192.168.1.2 netmask 255.255.255.248 gateway 192.168.1.254 iface eth0:1 inet static address 192.168.1.3 netmask 255.255.255.248 gateway 192.168.1.254 # add rest of alias / binds below
Save and close the file.
Now restart networking, enter:# /etc/init.d/networking restart
OR$ sudo /etc/init.d/networking restart