IT码农库

您当前所在位置:首页 > 操作系统 > Linux

Linux

如何在linux网卡上添加多个IP

佚名 jb51.net2009-03-10Linux5454
最简单的方法是使用命令行:ifconfig add eth0 192.168.0.2 netmask 255.255.255.0ifconfig add eth0:1 192.168.0.2 netmask 255.255.255.0ifconfig add eth0:2 192.168.0.2 netmask 255.255.255.0其中eth0:1和eth0:2是添加上的两个IP.在添加后必需加入启动项,
最简单的方法是使用命令行:
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
即可.
大图广告(830*140)