环境
系统版本:Ubuntu 16.04.5 LTS
配置
ubuntu系统网卡文件是interfaces
,修改网卡配置文件vim /etc/network/interfaces
添加2个IP地址:
auto eth0:1
iface eth0:1 inet static
address 192.168.7.20
netmask 255.255.255.0
auto eth0:2
iface eth0:2 inet static
address 10.10.15.1
netmask 255.255.255.0
多个IP可以在后面追加eth0:3
下面是添加上2个IP的interfaces
文件所有内容
source /etc/network/interfaces.d/*
# Network is managed by Network manager
auto eth0
#iface eth0 inet dhcp
iface eth0 inet static
address 192.168.6.22
netmask 255.255.255.0
auto eth0:1
iface eth0:1 inet static
address 192.168.7.20
netmask 255.255.255.0
auto eth0:2
iface eth0:2 inet static
address 10.10.15.1
netmask 255.255.255.0
auto lo
iface lo inet loopback
配置完成后,重启reboot
使其生效,查看ip配置
标签:iface,网段,IP,address,网卡,255.255,auto,inet,eth0 From: https://www.cnblogs.com/xujiecnblogs/p/17251769.html