Date: Mon, 01 Aug 2005 09:11:11 -0700 From: Bakul Shah <bakul@BitBlocks.com> To: "Andrey V. Elsukov" <bu7cher@yandex.ru> Cc: freebsd-emulation@freebsd.org Subject: Re: Howto configure virtual network via tap in qemu? Message-ID: <200508011611.j71GBBmr073203@gate.bitblocks.com> In-Reply-To: Your message of "Mon, 01 Aug 2005 08:19:54 %2B0400." <42EDA2EA.4060206@yandex.ru>
index | next in thread | previous in thread | raw e-mail
> Somebody know how to configure virtual network via tap interface in qemu?
> I try to install FreeBSD 6.0-BETA1 in qemu. My system is 5.4-STABLE. I
> try so:
> 1. cat /dev/null > /dev/tap0
You don't need this.
> 4. run qemu:
> # qemu -cdrom 6.0-BETA1.iso -hda disk.img -boot d -serial pty -n /home/qemu/ifup.sh
You don't need -serial <dev>
> tap0 interface is up, i can ping it from my system. But i can't
> configure installation via network.
> When i use user mode network stack - it work.
In the user mode networking qemu does stuff on behalf of the
VM (the emulated system). This requires a lot less setup on
your host (since it is qemu that does all networking). If
you use tapN, the VM is an *external system* as far as your
host's networking stack is concerned as it will send/rcv
packets over a network interface. This is why you need to
either bridge tapN with your external ethernet interface and
give your VM an externally visible address or use your host
as a router and set it up to do network address translation.
For the latter do the following:
- make sure IP forwarding works
sysctl net.inet.ip.forwarding = 1
- set up NAT. Let us assume your external interface is fxp0.
Then if you use ipfilter, /etc/ipnat.rules will look
something like this:
map fxp0 192.168.0.0/24 -> 0/32 portmap tcp/ucp 30000:39999
map fxp0 192.168.0.0/24 -> 0/32
if you use pf, /etc/pf.conf will look something like this:
nat on fxp0 from 192.168.0.0/24 to any -> (fxp0)
Don't forget to enable whichever NAT in /etc/rc.conf
- During the installation give your VM an IP address like
192.168.0.2, chose 192.168.0.1 as your gateway and the DNS
entries same as your host.
home |
help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200508011611.j71GBBmr073203>
