如何在宿主机上查看kvm虚拟机的IP

1、 查看运行的虚拟机

```
[root@localhost img]# virsh list

 Id    Name                           State
----------------------------------------------------
 1     vpn                            running

2、 virsh dumpxml 虚拟机名称,查看服务器对应的mac地址

```
[root@localhost img]# virsh dumpxml vpn|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***
````bash
[root@localhost img]# arp -a

gateway (10.0.3.1) at e4:72:e2:ec:76:01 [ether] on br0

如果arp -a看不到想要的结果,就写个脚本ping一下同网段的所有IP,然后在执行arp -a

posted @ 2021-02-11 23:39  魏阳晨  阅读(551)  评论(0)    收藏  举报
AmazingCounters.com