I have a qemu machine that i connect to the network using a bride virtual network but since I am using a bridge interface the host can't connect to the internet and the lan.

is there any way to have the guest and the host in the same network given by the router ( so both can access to internet and lan? With the bridge network of course the host does not have internet and lan access

1 Answer 1


There are several options for internet access with qemu, including bridging and sharing the interface with NAT.

From the command line, my VM uses the following net device options for a NAT interface:

-netdev tap,fd=26,id=hostnet0 -device rtl8139,netdev=hostnet0,id=net0,mac=52:54:00:2b:4f:a8,bus=pci.0,addr=0x3

with these iptables rules in POSTROUTING:

Chain POSTROUTING (policy ACCEPT 36650 packets, 6409K bytes)
 pkts bytes target     prot opt in     out     source               destination         
    5   312 RETURN     all  --  *      *        
    0     0 RETURN     all  --  *      *     
    5   300 MASQUERADE  tcp  --  *      *    !     masq ports: 1024-65535
   10  1380 MASQUERADE  udp  --  *      *    !     masq ports: 1024-65535
    0     0 MASQUERADE  all  --  *      *    !    

These are the defaults configured by virt-manager, which is much simpler and easier than building up your command line. For example, it also configures a DNS caching server and a DHCP server. Virt-manager also gives you the option of selecting interfaces to bridge, or selecting a NAT configuration on your primary interface, all with just a drop-down.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .