首页 > 系统服务 > 详细

ubuntu 16 添加多个IP

时间:2020-07-30 21:20:48      阅读:178      评论:0      收藏:0      [点我收藏+]

多个不同IP段的 /etc/network/interfaces 配置文件的范例如下:

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static
address 8.8.8.2
netmask 255.255.255.248
gateway 8.8.8.1 要注意这里,多个不同IP段,只要1个gateway配置即可,其他IP不需要配置gateway
dns-nameservers 8.8.8.8 8.8.4.4

auto eth0:0
iface eth0:0 inet static
address 8.8.8.3
netmask 255.255.255.248
dns-nameservers 8.8.8.8 8.8.4.4

auto eth0:1
iface eth0:1 inet static
address 8.8.8.4
netmask 255.255.255.248
dns-nameservers 8.8.8.8 8.8.4.4

auto eth0:2
iface eth0:2 inet static
address 8.8.8.5
netmask 255.255.255.248
dns-nameservers 8.8.8.8 8.8.4.4

auto eth0:3
iface eth0:3 inet static
address 8.8.8.6
netmask 255.255.255.248
dns-nameservers 8.8.8.8 8.8.4.4

auto eth0:4
iface eth0:4 inet static
address 6.6.6.130 注意这里,虽然这是不同的IP段,但是不需要配置gateway,只需要配置netmask即可
netmask 255.255.255.224
dns-nameservers 8.8.8.8 8.8.4.4

 

更多ip也类似配置即可。

配置文件完成后,用命令 /etc/init.d/networking restart /reload重启网络

 转载于:https://www.cnblogs.com/qunshu/p/3236807.html

ubuntu 16 添加多个IP

原文:https://www.cnblogs.com/rui517hua20/p/13405873.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!