You are not logged in.

#1 2009-07-05 19:35:16

plurt
Member
Registered: 2008-10-16
Posts: 88

[SOLVED] Virtualbox FreeBSD guest

Hi,

I installed a FreeBSD7.1 guest in Virtualbox. First I went with NAT but this didn't do because I wanted to be able to ssh to the guest os.
So I went with network bridging.

Host is Archlinux which used dhcp through wlan0 (wireless)
I created the tap0 and got bridging working after a lot of hassle. dhcp didn't work for the guest, so I chose a static ip.

ifconfig on host looks like this:

tap0      Link encap:Ethernet  HWaddr 52:1D:7A:68:8C:A2  
          inet addr:192.168.1.150  Bcast:0.0.0.0  Mask:255.255.255.255
          inet6 addr: fe80::501d:7aff:fe68:8ca2/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:773 overruns:0 carrier:0
          collisions:0 txqueuelen:500 
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

wlan0     Link encap:Ethernet  HWaddr 00:1B:77:D9:94:E6  
          inet addr:192.168.1.100  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::21b:77ff:fed9:94e6/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:23179 errors:0 dropped:0 overruns:0 frame:0
          TX packets:22496 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:12572152 (11.9 Mb)  TX bytes:2707629 (2.5 Mb)

on the guest it looks like this

em0:  flags=8843<UP,BROADCAST?RUNNING?SIMPLEX?MULTICAST> metric 0 mtu 1500
              options=9b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM>
              ether 08:00:27:19:b3:ee
              inet 192.168.1.151 netmask 0xffffff00 broadcast 192.168.1.255
              media: Ethernet autoselect (1000baseTX <full-duplex>)
              status: active

Now, where host name lookup worked perfectly with NAT, it doesn't with this tap0 solution.
I discovered my FreeBSD didn't have an /etc/resolv.conf, so I copied the one on my archlinux host to the guest.
it looks like this:

# Generated by dhcpcd from wlan0
# /etc/resolv.conf.head can replace this line
domain WAG200G
nameserver 193.109.184.72
nameserver 193.109.184.75
# /etc/resolv.conf.tail can replace this line

but that doesn't make it happen smile

my networking skills are minimal, been looking all over the net for any solutions, but nothing so far .. any ideas anyone?

Last edited by plurt (2009-07-07 10:20:50)


When everything's coming your way, you're in the wrong lane I say.
FAQ / Beginners Guide / The Arch Way

Offline

#2 2009-07-06 17:36:05

tkdfighter
Member
From: Switzerland
Registered: 2009-01-28
Posts: 126

Re: [SOLVED] Virtualbox FreeBSD guest

Well, to me your resolve.conf looks fine. Could you post more details of how you set up the tap device? Especially the commands would be useful.

Offline

#3 2009-07-06 18:40:30

Ashren
Member
From: Denmark
Registered: 2007-06-13
Posts: 1,229
Website

Re: [SOLVED] Virtualbox FreeBSD guest

Have you tried the built in bridging functionality in VirtualBox? It works well enough with my Arch guest practice server. You bascially don't need to set up bridging manually.

Just set it when chosing network setup inside the vbox gui. You need to load the vboxnetflt module before it will work.

Offline

#4 2009-07-06 22:57:59

R00KIE
Forum Fellow
From: Between a computer and a chair
Registered: 2008-09-14
Posts: 4,734

Re: [SOLVED] Virtualbox FreeBSD guest

You can setup port forwarding if you use the nat interface in virtualbox with something like this

VBoxManage setextradata "vmachine" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh_port/Protocol" TCP
VBoxManage setextradata "vmachine" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh_port/HostPort" 2222
VBoxManage setextradata "vmachine" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh_port/GuestPort" 22

Where vmachine is the name you gave to the virtual machine name, 2222 is the port you will contact from the outside, and 22 is the ssh port on the guest.

I use this to forward other ports and it works really well. Just remember that to use ports lower than 1024 on the host you need to have root privileges (if I'm not mistaken).


R00KIE
Tm90aGluZyB0byBzZWUgaGVyZSwgbW92ZSBhbG9uZy4K

Offline

#5 2009-07-07 10:20:26

plurt
Member
Registered: 2008-10-16
Posts: 88

Re: [SOLVED] Virtualbox FreeBSD guest

tkdfighter wrote:

Well, to me your resolve.conf looks fine. Could you post more details of how you set up the tap device? Especially the commands would be useful.

it was something like this:

sudo sysctl net.ipv4.ip_forward=1
sudo tunctl -u $USER
sudo ip addr add 192.168.1.150/32 dev tap0
sudo ip link set tap0 up
sudo parprouted -d wlan0 tap0

that part worked, apart from using dhcp, I had to go for a static ip (wanted to use something like dhcp-helper, dhcp3-relay, bcrelay, but none of those tools I could find in packages/aur)


Ashren wrote:

Have you tried the built in bridging functionality in VirtualBox? It works well enough with my Arch guest practice server. You bascially don't need to set up bridging manually.

Just set it when chosing network setup inside the vbox gui. You need to load the vboxnetflt module before it will work.

I had tried it several times now, only when trying again I discovered a typo in my setextradata commands! omg I feel daft now ...
(Hostport -> HostPort, Guestport -> GuestPort)

It works flawlessly now, thank you for the help :)


When everything's coming your way, you're in the wrong lane I say.
FAQ / Beginners Guide / The Arch Way

Offline

Board footer

Powered by FluxBB