小小百科网

标题: 在Debian中批量添加多个IP地址的方法 [打印本页]

作者: xiaoxiao    时间: 2016-8-16 21:49
标题: 在Debian中批量添加多个IP地址的方法
在使用VPS过程中,或多或少都会遇到需要使用多IP的时候
这里我将向大家演示Debian添加多IP的方法

我们VPS的主IP为
IP地址:119.80.24.236
子网掩码:255.255.255.248
网关:119.81.24.233

需要添加的IP段为:
IP地址:119.80.14.15~18
子网掩码:255.255.255.255
网关:119.81.24.233



1:编辑interfaces网络配置文件
  1. vi /etc/network/interfaces

  2. 在最后加上
  3. # eth1
  4. auto eth1
  5. allow-hotplug eth1
  6. iface eth1 inet static
  7.         address 119.80.24.236
  8.         netmask 255.255.255.248
  9.         gateway 119.81.24.233

  10. auto eth1:0
  11. iface eth1:0 inet static
  12.         address 119.81.14.15
  13.         netmask 255.255.255.255

  14. auto eth1:1
  15. iface eth1:1 inet static
  16.         address 119.81.14.16
  17.         netmask 255.255.255.255

  18. auto eth1:2
  19. iface eth1:2 inet static
  20.         address 119.81.14.17
  21.         netmask 255.255.255.255

  22. auto eth1:3
  23. iface eth1:3 inet static
  24.         address 119.81.14.18
  25.         netmask 255.255.255.255
复制代码



2:最后重启网络服务即可生效:
  1. /etc/init.d/networking restart
复制代码










欢迎光临 小小百科网 (http://www.aixiaoxiao.cn/) Powered by Discuz! X3.3