linux給網卡增加多個內網ip的方法

  1. 在網卡eth0上增加一個IP地址192.168.1.22

[root@AS-1 poccharging0]# ifconfig eth0:1 192.168.1.22 netmask 255.255.255.0
[root@AS-1 poccharging0]# ifconfig

eth0:1 Link encap:Ethernet HWaddr 5C:26:0A:FB:D8:88
inet addr:192.168.1.22 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:90 Memory:da000000-da012100

如果還要增加一個,執行 ifconfig eth0:2 192.168.1.23 netmask 255.255.255.0 就可以。

要刪除該IP地址,執行 ifconfig eth0:2 down 即可。
. 在網卡eth0上增加一個IP地址192.168.1.22 另外一種方法

[root@AS-1 poccharging0]# ip addr add 192.168.1.22/24 dev eth0

[root@AS-1 poccharging0]# ip addr
2: eth0:

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章