常常我们有需要一个网卡像windows一样设置多个IP。
下面我们看看在ubuntu下怎么样做.
我们先打开网络接口的文件
sudo vi /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface auto eth0
iface eth0 inet static
照上边eth0添加eth0:0
auto eth0:0
iface eth0:0 inet static
name Ethernet
重启服务
sudo /etc/init.d/networking restart
测试新的ip地址是否生效
ping 202.205.XXX.XX
ping 202.205.XXX.XX
==============以上为添加同一网段内的IP地址=================
评论区