在ubuntu系统环境中遇到需要对一个网卡配置2个ip的需求,特此记录
sudo vi /etc/network/interfaces
配置内容如下
auto eth0
auto eth0:0
auto eth0:1
iface eth0 inet static
address 192.168.1.1
netmask 255.255.0.0
gateway 192.168.1.254
iface eth0:0 inet static
address 192.168.1.2
netmask 255.255.0.0
gateway 192.168.1.254
iface eth0:1 inet static
address 192.168.1.3
netmask 255.255.0.0
gateway 192.168.1.254
设置网卡生效
sudo /etc/init.d/networking restart
本文介绍如何在Ubuntu系统中为单一网卡配置两个静态IP地址,包括具体的配置文件修改步骤及命令,适用于需要在同一网卡上使用多个IP地址的场景。
1866

被折叠的 条评论
为什么被折叠?



