红联Linux门户
Linux帮助

实战Ubuntu下单网卡绑定多IP

发布时间:2012-03-18 10:09:59来源:Ubuntu社区作者:linux使用者

  常常我们有需要一个网卡象windows一样设置多个IP。


  下面我们看看在ubuntu下怎么样做。


  我们先打开网络接口的文件

  sudo gedit /etc/network/interfaces


  照上边eth0添加eth0:0

  auto eth0

  iface eth0 inet static

  name Ethernet Lan card

  address 192.168.1.1

  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.1.2

  netmask 255.255.255.0

  network 192.168.1.0

  broadcast 192.168.1.255

  gateway 192.168.1.1


  重启服务

  sudo /etc/init.d/networking restart


  测试新的ip地址是否生效

  ping 192.168.0.1

  ping 192.168.0.2