首页 > 系统相关 >ubuntu系统单网卡配置多网段IP

ubuntu系统单网卡配置多网段IP

时间:2023-03-24 15:13:54浏览次数:55  
标签:iface 网段 IP address 网卡 255.255 auto inet eth0

环境

系统版本: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

相关文章