Ubuntu:
打开你的终端并运行下面的命令添加额外的 IP。 sudoip addr add 192.168.1.104/24 dev enp0s3 用命令检查是否启用了新的 IP: sudoip address show enp0s3Centos
最简单的方法是使用命令行:
ifconfig add eth0 192.168.0.2 netmask 255.255.255.0
ifconfig add eth0:1 192.168.0.2 netmask 255.255.255.0
ifconfig add eth0:2 192.168.0.2 netmask 255.255.255.0
其中eth0:1和eth0:2是添加上的两个IP.
在添加后必需加入启动项,否则重启后,虚拟添加的IP将会失去.
将以上命令加入到:
/etc/rc.d/rc.local
即可.