不同的linux distribution一块网卡配置多个IP的方法基本相同,只不过编辑的文件不同。
1. Ubuntu 配置多个IP
编辑/etc/network/interfaces: sudo vi /etc/network/interfaces, 然后按照interfaces上边eth0配置,在interfaces中添加eth0:0即可。例如:
原来的interfaces为:
auto eth0
iface eth0 inet static
name Ethernet Lan card
address 192.168.1.2
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1
编辑后的interfaces为:
auto eth0
iface eth0 inet static
name Ethernet Lan card
address 192.168.1.2
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1
auto eth0:0
iface eth0:0 inet static
name Ethernet
address 192.168.2.2
netmask 255.255.255.0<