[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: KVM networking.



Arno Schuring <aelschuring@hotmail.com> wrote:
> I don't think qemu gives you NAT for free...

If you use "-net user" you get a NAT-based solution (you then need to
punch "inbound" holes using the hostfwd parameter, as necessary). This
solution also requires no root priviledge, so it's an easy win.

Personally, I'd rather run up a bridge and use the libvirt tools to run
my VM for me (avoids giving root rights to a user, but allows the guest
to run with the necessary root network privs).

    auto eth0
    iface eth0 inet static
	    address 192.168.1.1
	    netmask 255.255.255.0
	    network 192.168.1.0
	    broadcast 192.168.1.255
	    gateway 192.168.1.254
	    dns-nameservers 192.168.1.200 192.168.1.201
	    dns-search roaima.co.uk
	    pre-up ip link set eth0 name peth0
	    post-down ip link set peth0 name eth0
	    bridge_ports peth0
	    bridge_stp off
	    bridge_maxwait 2

This little lot brings up eth0 with a static address (change the "static"
for "dhcp" if you prefer, and drop the address, netmask, network,
broadcast, gateway, dns-* entries). In the process of doing so, it
renames eth0 to peth0 ("physical-eth0") and creates a bridge called eth0.

Net effect is that you can still think about "eth0", but actually it's
a bridge, to which your VMs can also connect.

Chris


Reply to: