1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | root@machine1:~# ls /var/run/docker/netns/ 29ad7412625bd96446acbf28default root@machine1:~# ln -s /var/run/docker/netns/29ad7412625b /var/run/netns/29ad7412625b root@machine1:~# ip netns exec 29ad7412625b ip a 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 11: ethwe0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1410 qdisc noqueue state UP group default link/ether 0a:d0:be:58:8f:c7 brd ff:ff:ff:ff:ff:ff inet 10.32.0.1/12 scope global ethwe0 valid_lft forever preferred_lft forever inet6 fe80::8d0:beff:fe58:8fc7/64 scope link valid_lft forever preferred_lft forever 13: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default link/ether 02:42:ac:12:00:03 brd ff:ff:ff:ff:ff:ff inet 172.18.0.3/16 scope global eth1 valid_lft forever preferred_lft forever inet6 fe80::42:acff:fe12:3/64 scope link valid_lft forever preferred_lft forever |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | import commands import pprint target = 'c2.weave.local' store = {} for i in range(10): raw_res = (commands.getoutput('ping -w 2 '+target).split[2]) print 'host aware ....' res = raw_res.strip('(') res = res.strip(')') if store.has_key(res) == False: store[res] = 0 print 'aware done' for i in range(20): raw_res = (commands.getoutput('ping -w 2 '+target).split[2]) print 'working ....' res = raw_res.strip('(') res = res.strip(')') store[res]=store[res]+1 print '1 done' print 'all done' pprint.pprint(store) |
欢迎光临 51学通信论坛2017新版 (http://bbs.51xuetongxin.com/) | Powered by Discuz! X3 |