12

I am trying to setup KVM in ubuntu 14.04 host machine.

  1. I use a wireless interface to access the internet in my machine. I have setup the wireless interface in my /etc/networks/interfaces as below.

    auto wlan0
    iface wlan0 inet static
    address 192.168.1.9
    netmask 255.255.255.0
    gateway 192.168.1.1
    wpa-ssid My_SSID
    wpa-psk SSID_Password
    dns-nameservers 8.8.8.8
    dns-search lan
    dns-domain lan
    
  2. I checked if my machine is available for virtualization and this command confirms that my hardware supports virtualization.

    egrep '(vmx|svm)' /proc/cpuinfo
    
  3. I installed the necessary packages for kvm virtualization as below.

    apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder
    
  4. I also installed the bridge utils package to configure bridge network for my kvm.

    apt-get install bridge-utils
    
  5. I modified my /etc/network/interfaces to allow the bridged network as below.

    auto br0
    iface br0 inet static
    address 192.168.1.40
    network 192.168.1.0
    netmask 255.255.255.0
    broadcast 192.168.1.255
    gateway 192.168.1.1
    dns-nameservers 8.8.8.8
    dns-search lan
    dns-domain lan
    bridge_ports wlan0
    bridge_stp 0ff
    bridge_fd 0
    bridge_maxwait 0
    wpa-ssid my_ssid
    wpa-psk ssid_password
    
  6. After the above step, I am able to ping 192.168.1.40 and also I could see there is br0 and virbr0 listed in the output of ifconfig -a command. I am also able to access the internet without any problem with my wireless interface.

  7. However, after the above step if I try to add another OS using ubuntu-vm-builder command, I am not able to add a new OS. This is the command I use to add a new OS.

    sudo ubuntu-vm-builder kvm trusty \
    --domain rameshpc \
    --dest demo1 \
    --hostname demo1 \
    --arch amd64 \
    --mem 1024 \
    --cpus 4 \
    --user ladmin \
    --pass password \
    --bridge br0 \
    --ip 192.168.1.40 \
    --mask 255.255.255.0 \
    --net 192.168.1.0 \
    --bcast 192.168.1.255 \
    --gw 192.168.1.1 \
    --dns 8.8.8.8 \
    --components main,universe \
    --addpkg acpid \
    --addpkg openssh-server \
    --addpkg linux-image-generic \
    --libvirt qemu;///system;  
    

I have seen that setting a bridged network using a wireless interface is quiet complicated as discussed in this question. However, as the answer describes it is possible using a tunneling device. I have tried the option as suggested in this link. But I couldn't get it to work.

16

As someone rightly said once, Nothing is impossible in LinuxTM, I could achieve the kvm in my host with a bridged network over a wireless interface.

These are the steps I followed to accomplish the same.

  1. I installed the virt-manager package to manage the installation more efficiently. I installed it as below.

    sudo apt-get install virt-manager
    
  2. Now, create a new sub-network using Virt Manager’s GUI as highlighted below. This is basically a sub network of our existing host network.

    enter image description here

  3. After setting this new sub-network, check if the network is available and ping some sites to check the network connectivity.

  4. Also, check the routing information using route command and make sure wlan0 and virbr2 doesn't have the same destination.

  5. Now, the final step to make it work is to issue the below command. Here 192.168.1.9 is the host machine address.

    arp -i wlan0 -Ds 192.168.1.9 wlan0 pub
    
  6. After the above step, I was able to successfully install a Fedora guest OS using the virt-manager.

References

http://specman1.wordpress.com/2014/01/02/wireless-bridging-virtual-machines-kvm/ https://superuser.com/questions/694929/wireless-bridge-on-kvm-virtual-machine

  • 1
    I had to enable ARP proxying on the interface: sudo sysctl net.ipv4.conf.wlan0.proxy_arp=1 – Leon Van Zyl Jun 28 '16 at 20:03
  • Instead of the Step 5 arp command instructions here, I used the instructions under "The future is here…" at specman1.wordpress.com/2014/01/02/… with success. echo 1 > /proc/sys/net/ipv4/conf/wlan0/proxy_arp and echo 1 > /proc/sys/net/ipv4/conf/virbr1/proxy_arp (I'm not necessarily saying the Step 5 arp command instructions here won't work; I'm just saying I didn't use them.) – dbank Mar 19 '18 at 2:29
  • I couldn't get it to work... every article says something different, none are clear enough to follow. Linux host windows guest. – TetraDev Apr 10 at 21:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.