0

I have a virtual machine/LXC container that is using a bridge (on br0) to access the network.

On the system that is hosting the virtual machine and the bridge, I would like to be able to tell what IP address was assigned (dhcp).

I don't want to go into the virtual machine and use ifconfig...I want to be able to tell from the host of the virtual machine.

When I use ifconfig on the host system I get the following:

br0       Link encap:Ethernet  HWaddr 08:00:27:28:05:9e  
          inet addr:192.168.42.216  Bcast:192.168.42.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fe28:59e/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1652 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2577 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:174997 (174.9 KB)  TX bytes:256212 (256.2 KB)

eth0      Link encap:Ethernet  HWaddr 08:00:27:28:05:9e  
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1729 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2580 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:206750 (206.7 KB)  TX bytes:256022 (256.0 KB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:4239 errors:0 dropped:0 overruns:0 frame:0
          TX packets:4239 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:758585 (758.5 KB)  TX bytes:758585 (758.5 KB)

vethUcRl21 Link encap:Ethernet  HWaddr 92:70:c3:64:6c:bc  
          inet6 addr: fe80::9070:c3ff:fe64:6cbc/64 Scope:Link
          UP BROADCAST RUNNING PROMISC MULTICAST  MTU:1500  Metric:1
          RX packets:7 errors:0 dropped:0 overruns:0 frame:0
          TX packets:28 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:546 (546.0 B)  TX bytes:3280 (3.2 KB)

vethUcRl21 is the virtual interface created which uses the br0 interface.

MDMarra
  • 100,734
  • 32
  • 197
  • 329

3 Answers3

3

I came here looking for the answer to the same problem. After reading Fox's answer, I discovered arp tables management command (now obsolete). Try ip neigh this is the same as arp. This will show you the VMs IP address being propagated via DHCP from the host sharing the same link (the virtual bridge).

tuxadelic
  • 46
  • 3
1

Short of looking at DHCP logs... or capturing packets and filtering for DHCP packets... you're going to be out of luck. The host doesn't care what IP address is assigned to the virtual machines it's hosting. The bridge simply takes all data from one interface in the bridge and broadcasts it to all other interfaces in the bridge. The host itself knows nothing about how the data is processed by the other devices in the bridge.

TheCompWiz
  • 7,409
  • 17
  • 23
0

You probably could use ARP daemon (ie. arpd) to monitor the bridge interface. As long as you know the MAC address of the virtual machine, you can get it from it's database. And MACs you can find in brctl showmacs br0.

Fox
  • 3,977
  • 18
  • 23