如何在宿主機上查看kvm虛擬機的IP


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 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM