liunx 加ip

2011-03-11 6:02 am
CentOS 5.x
liunx 加ip
例如:192.168.1.1(主IP)
如果要加192.168.1.2-5
要點加呀!!!
純用指令!!!
thx!!!!

回答 (3)

2011-03-11 7:20 pm
✔ 最佳答案
$ /sbin/ifconfig eth0:0 192.168.0.4
$ /sbin/route add -host 192.168.0.4 dev eth0:0

(replace that IP with the one you'd like to add)
This change will no longer be in effect after rebooting. Thereforyou must add the two commands to the bottom of your /etc/rc.local file. Your NIC should now be listening and responding on both this and the original IP address found in /etc/sysconfig/network-scripts/ifcfg-eth0

If you want to add add more than one additional IP address, continuelike this:

$ /sbin/ifconfig eth0:0 192.168.0.4
$ /sbin/ifconfig eth0:1 192.168.0.5
$ /sbin/ifconfig eth0:2 192.168.0.6
$ /sbin/route add -host 192.168.0.4 dev eth0:0
$ /sbin/route add -host 192.168.0.5 dev eth0:1
$ /sbin/route add -host 192.168.0.6 dev eth0:2
2011-03-12 6:37 am
不是router set
2011-03-11 6:55 am
那不是router set 的嗎- -


收錄日期: 2021-04-26 00:01:20
原文連結 [永久失效]:
https://hk.answers.yahoo.com/question/index?qid=20110310000051KK01271

檢視 Wayback Machine 備份