如何在linux网卡上添加多个IP

  最简单的方法是使用命令行:

  ifconfig add eth0 192.168.0.2 netmask 255.255.255.0

  ifconfig add eth0:1 192.168.0.2 netmask 255.255.255.0

  ifconfig add eth0:2 192.168.0.2 netmask 255.255.255.0

  其中eth0:1和eth0:2是添加上的两个IP.

  在添加后必需加入启动项,否则重启后,虚拟添加的IP将会失去.

  将以上命令加入到:

  /etc/rc.d/rc.local

  即可.