I cannot manage to have the network working as a VM

Hi all,

I am new to FreeBSD. I want it for my first server. To start, I chose to install it in a virtual machine with qemu. I already did it with OpenBSD. My Gentoo Host and my OpenBSD guest can ping one each other. So Host and qemu looks right.

I followed the same procedure to build my FreeBSD VM. Following the FreeBSD handbook (with the DVD iso). But I cannot manage to see the Host, configured as a router for the Guests with NAT - I have a bridge and a tap interface on the host at 192.168.99.1.

Here is my FreeBSD guest configuration :
Code:
#cat /etc/rc.conf
keymap="fr.iso.acc"
sshd_enable="YES"
ifconfig_re0="inet 192.168.99.66 netmask 255.255.255.0"
defaultrouter="192.168.99.1"
hostname="APPOLON"
Code:
ifconfig -a
re0 flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
          options=9b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM>
          ether 02:5a:4b:3c:2d:1e
          inet 192.168.99.66 netmask 0xffffff00 broadcast 192.168.99.255
          media: Ethernet autoselect (100baseTX <full-duplex>)
          status: active
plip0 flags=8810<POINTTOPOINT,SIMPLEX,MULTICAST> metric 0 mtu 1500
lo0 flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
          options=3<RXCSUM,TXCSUM>
          inet6 fe80::1%lo0 prefixlen 64 scopeid 0x3
          inet6 ::1 prefixlen 128
          inet 127.0.0.1 netmask 0xff000000
          nd6 options=3<PERFORMNUD,ACCEPT_RTADV>
What may be wrong ?

I did also try :
Code:
# /etc/rc.d/netif restart
# /etc/rc.d/routing restart
without more success.

I also tryed dhcp and configuration throught the sysinstall tool without success.
 
ok, then the solution is twofold:

1) the host's bridge MAC address shall be different than the guest's MAC address. The following command enables to change the FreeBSD MAC adress :
Code:
# ifconfig -n re0 ether 4a:f5:66:45:ad:14
qemu shall be called with :
Code:
kvm -hda freebsd-8.1-amd64.img -cdrom  FreeBSD-8.1-
RELEASE-amd64-dvd1.iso -boot c -m 1000 -k fr -net nic,macaddr=4a:f5:66:45:ad:14 -net tap,ifname=qtap0,script=no,downscript=no

2) Put your favorite DNS address (provided by your ISP) in /etc/resolv.conf:
Code:
nameserver 212.27.40.240 212.27.40.241

or

2bis) Use the named server included in FreeBSD : add in /etc/rc.conf:
Code:
named_enable="YES"
To start it now :
Code:
# /etc/rc.d/named onestart

What is the best solution for a web server ?
 
A couple things:

  • You may want to use a VM instead of a full blown emulator for performance reasons. There is a kernel module to accelerate qemu, kqemu, but you might just have better luck with something designed specifically for x86, like virtual box.
  • DNS, for the most part, isn't needed by the web server itself. However, to access the web server via URLs (which you will need if you plan to do any vhosting), you'll need to serve DNS records yourself, via named (or equivalent DNS server), or use one of the many providers online to serve your DNS records from their servers. If it's just an internal site, set up your own DNS server.
 
Back
Top