[服务器配置]Ubuntu8.10 server设置多个IP

来源:互联网 发布:怎样做好数据分析 编辑:程序博客网 时间:2024/06/05 17:45
 两种方法:
     1> 修改/etc/network/interface
原来的interface文件如下:
  1. auto lo
  2. iface lo inet loopback
  3. auto eth0
  4.     iface eth0 inet static
  5.     address 192.168.7.72
  6.     netmask 255.255.255.0
现在要添加一个IP 192.168.53.75 掩码为  255.255.255.128, 在上面的文件中添加如下内容:
  1.    1. auto eth0:0
  2.    2.     iface eth0:0 inet static
  3.    3.     address 192.168.53.75
  4.    4.     netmask 255.255.255.128
依此类推,可以添加eth0:1 eth0:2 ... ...

     2> 上面的方法,在Ubuntu8.10server重启后,第2个IP添加不上。
          还可以用命令行: ifconfig eth0:0 192.168.53.75 netmask 255.255.255.128 up
          要保证开机能使用则把上面这条命令加上/etc/rc.local