基本信息
宿主机: 172.28.12.2
KVM: 172.28.56.8
添加的别名: 172.28.56.18
操作实例
# 网卡上添加 ip:
$ ifconfig eth0:1 172.28.56.18 netmask 255.255.255.0 up
# 网卡上删除 ip:
$ ip addr del 172.28.56.18 dev eth0
$ ifconfig
eth0 Link encap:Ethernet HWaddr FA:16:3E:AB:3E:B2
inet addr:172.28.56.8 Bcast:172.28.56.255 Mask:255.255.255.0
inet6 addr: fe80::f816:3eff:feab:3eb2/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:929 errors:0 dropped:0 overruns:0 frame:0
TX packets:649 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:87345 (85.2 KiB) TX bytes:79252 (77.3 KiB)
eth0:1 Link encap:Ethernet HWaddr FA:16:3E:AB:3E:B2
inet addr:172.28.56.18 Bcast:172.28.56.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
# 用原有 IP ping 一个外部ip
$ ping -I 172.28.56.8 172.28.12.2
PING 172.28.12.2 (172.28.12.2) from 172.28.56.8: 56 data bytes
64 bytes from 172.28.12.2: seq=0 ttl=63 time=0.278 ms
64 bytes from 172.28.12.2: seq=1 ttl=63 time=0.271 ms
^C
--- 172.28.12.2 ping statistics ---
2 packets transmitted, 2 packets received, 0% packet loss
round-trip min/avg/max = 0.271/0.274/0.278 ms
# 用添加的虚拟IP ping 一个外部 IP
$ ping -I 172.28.56.18 172.28.12.2
PING 172.28.12.2 (172.28.12.2) from 172.28.56.18: 56 data bytes
^C
--- 172.28.12.2 ping statistics ---
24 packets transmitted, 0 packets received, 100% packet loss
扩展阅读:
http://www.chenshake.com/openstack-mirror-and-password/
网友评论