KVM

如何在宿主机上查询虚拟机的ip

marksugar
2015-12-03 / 0 评论 / 5,029 阅读 / 正在检测是否收录...

如何在宿主机上查询虚拟机的ip
1) virsh dumpxml 虚拟机名字

<interface type='bridge'>
<mac address='52:54:00:89:58:9d'/>
<source bridge='br0'/>
<target dev='vnet0'/>
<model type='e1000'/>
<alias name='net0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>

看下虚拟机的mac地址,
2) 然后在宿主机上arp -a

arp -a
? (192.168.0.1) at 00:0f:e2:d4:f5:33 [ether] on br0
? (192.168.0.161) at 00:e0:81:d5:5f:c7 [ether] on br0

看下mac和ip的对应表,如果没有的,写一个脚本,把同一个网段所有机器ping一遍。
在arp -a

#!/bin/bash
for (( i=0; i<254;i++))
do
{
ping 192.168.0.$i -c 1
}&
done

1111111111111111111111.png

0

评论

博主关闭了所有页面的评论