- 在網卡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: