找回密码
 注册会员
搜索

本文来自

Linux

Linux

订阅|关注

请添加对本版块的简短描述

297

主题

314

帖子

2343

积分

管理员

Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20

积分
2343

[教程] 在Debian中批量添加多个IP地址的方法

[复制链接]
跳转到指定楼层
楼主
30100 xiaoxiao 发表于 2016-8-16 21:49:15
在使用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
复制代码





回复

使用道具 举报

快速回复 返回顶部 返回列表