1. 查看运行的虚拟机
[root@localhost img]# virsh list Id Name State ---------------------------------------------------- 1 vpn running 2 gamedev3 running 3 gamedev1 running 4 dev3 running 5 shanghai running 6 yunwei running 7 gamedev5 running 8 dev2 running 9 dev1 running 10 gamedev4 running 11 pub running 12 git running 13 dev4 running 14 devtpl running
2、virsh dumpxml 虚拟机名称,查看服务器对应的mac地址
[root@localhost img]# virsh dumpxml pub|grep mac <partition>/machine</partition> <type arch=\'x86_64\' machine=\'pc-i440fx-rhel7.0.0\'>hvm</type> <mac address=\'52:54:00:95:5e:f2\'/>
3.查看mac地址对应的ip
[root@localhost img]# arp -a gateway (10.0.3.1) at e4:72:e2:ec:76:01 [ether] on br0 ? (10.0.3.85) at 00:50:56:b4:33:33 [ether] on br0 ? (10.0.3.44) at 52:54:00:95:5e:f2 [ether] on br0 ? (10.0.3.100) at 00:50:56:b4:33:12 [ether] on br0 ? (10.0.3.33) at 20:6a:8a:59:43:44 [ether] on br0 ? (10.0.3.198) at 60:eb:69:c5:dc:ab [ether] on br0 ? (10.0.3.58) at 52:54:00:4f:83:dc [ether] on br0 ? (10.0.3.101) at 52:54:00:3a:da:8e [ether] on br0 ? (10.0.3.11) at 00:0c:29:89:7c:7c [ether] on br0
如果arp -a看不到想要的结果,就写个脚本ping一下同网段的所有IP,然后在执行arp -a