I'm trying to access a KVM virtual machine running inside my company's network. I am VPN'ed into the network from my laptop and can ssh into other VMs, and I set up my VM to use a bridged network for my VM using virt-install ... --network bridge=virbr0,model=virtio
. The KVM host config for the network is:
# virsh dumpxml test-vm
...
<interface type='bridge'>
<mac address='52:54:00:d6:4f:f8'/>
<source bridge='virbr0'/>
<target dev='vnet3'/> <------
<model type='virtio'/>
<alias name='net0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>
...
# ifconfig
...
virbr0 Link encap:Ethernet HWaddr fe:54:00:3f:e1:8d
inet addr:192.168.122.1 Bcast:192.168.122.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1119495 errors:0 dropped:0 overruns:0 frame:0
TX packets:698753 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:105580752 (105.5 MB) TX bytes:2718266918 (2.7 GB)
...
vnet3 Link encap:Ethernet HWaddr fe:54:00:d6:4f:f8 <-----
inet6 addr: fe80::fc54:ff:fed6:4ff8/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1062543 errors:0 dropped:0 overruns:0 frame:0
TX packets:1900765 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:500
RX bytes:80152674 (80.1 MB) TX bytes:2667837704 (2.6 GB)
...
The IP address my VM was given through DHCP is 192.168.X.X, but I noticed that for VMs not running on this KVM host the IP addresses are more like 172.16.X.X. If I SSH into the physical host, then I am able to ping my VM, but from any other machine I cannot.
Given these symptoms, what have I failed to configure to allow myself to SSH directly into the VM from anywhere machine in the network?
Best Answer
I had set up my bridge targeting the
virbr0
interface, which (as described here) is just a virtual bridge, so it wasn't giving me an IP address on the physical network.Sure enough, creating a bridge which attached to my physical network interface fixed the issue -- I did this by using
virt-install ... --network bridge=br0,model=virtio
, where br0 was set up like this:(Where em3 is my physical network interface and vnet3 is the VM's interface which was created by virt-install.)