You are not logged in.

#1 2012-12-21 14:17:15

RFreeman
Member
Registered: 2012-12-19
Posts: 4

Route Arch host traffic through VirtualBox guest

I was successful doing this under Windows 7. I would much rather have this running under linux so that I could learn more. I am a linux noob so I am still taking this all in (migrating from Xubuntu).

So far I have installed a bridge. I have found a helpful wiki entry https://wiki.archlinux.org/index.php/Ad … Networking
but it makes references to rc.config which seems to be gone do to the implementation of systemd. That is where I hit a wall. I am not familiar with systemd.

Thanks for any help you can give me (i've done my googling)
Richard Freeman


ArchBanger
Live Free or Die

Offline

#2 2012-12-22 05:53:00

anonymous_user
Member
Registered: 2009-08-28
Posts: 3,059

Re: Route Arch host traffic through VirtualBox guest

Offline

#3 2012-12-27 15:45:50

RFreeman
Member
Registered: 2012-12-19
Posts: 4

Re: Route Arch host traffic through VirtualBox guest

Basically I am trying to do this

AP --> Arch host --> pfsense guest --> internet

this is the article that help me accomplish this using windows. struggling here. I don't fully understand networking and it is blatently obvious. I suppose I am in over my head.

http://timita.org/wordpress/2011/07/29/ … -preamble/

I've already loaded modules:
sudo modprobe vboxdrv #to load vbox module
sudo modprobe vboxnetflt #to load vbox network module
sudo modprobe vboxnetadp #to load host-only and internal network settings

bridge mode does not connect to internet.

Last edited by RFreeman (2012-12-27 18:10:09)


ArchBanger
Live Free or Die

Offline

#4 2012-12-28 04:41:30

hunterthomson
Member
Registered: 2008-06-22
Posts: 794
Website

Re: Route Arch host traffic through VirtualBox guest

Okay, so you want a pfsense VirtualBox guest to be your gateway/firewall for the Arch linux Host.

What I would do is this...

NOTE: Arch dev's and forums people now think that the tools in the inetutils package (ifconfig, route and stuff) are out of date. So, someone will for sure come in and tell you how to do this with the iproute2 commands....

pacman -S bridge-utils uml_utilities inetutils 
tunctl -g users
brctl addbr br0
ifconfig br0 192.168.30.2 up
ifconfig eth0 up
brctl addif br0 tap0
route add default gw 192.168.30.1 dev br0
#
# Owe, and set the DNS server to be sure
echo 'nameserver 8.8.8.8' > /etc/resolv.conf

Then in the VirtualBox GUI, give the VM 2 network interfaces. One being the physical ethernet interface eth0, and another being the virtual tap0 interface.

Now in the pfsense Guest. Make the Ethernet interface be the WAN and the tap0 interface be the LAN. Configure the tap0 interface with a Static IP address of 192.168.30.1 netmask 255.255.255.0 i.e. /24

Last edited by hunterthomson (2012-12-29 01:08:14)


OpenBSD-current Thinkpad X230, i7-3520M, 16GB CL9 Kingston, Samsung 830 256GB
Contributor: linux-grsec

Offline

#5 2012-12-28 23:10:48

RFreeman
Member
Registered: 2012-12-19
Posts: 4

Re: Route Arch host traffic through VirtualBox guest

the "brctl addif tap0" line gives me an error

[portal@archbang ~]$ brctl addif tap0
Incorrect number of arguments for command
Usage: brctl addif <bridge> <device>	add interface to bridge

Tried "sudo brctl addif br0 tap0" instead. I'm guessing though lol.

I managed to connect to the pfsense guest's web interface (192.168.30.1), but arch host is still connecting to the internet without routing through pfsense. Pfsense's wan interface is still not able to connect to the internet either. At least there is some progress here. Thank you very much for that.

Last edited by RFreeman (2012-12-28 23:35:10)


ArchBanger
Live Free or Die

Offline

#6 2012-12-29 01:07:16

hunterthomson
Member
Registered: 2008-06-22
Posts: 794
Website

Re: Route Arch host traffic through VirtualBox guest

Owe shoot, ya brctl addif br0 tap0

Well, it sounds like you have a network manager setting up the interface automatically. You need to disable any network managers on the Host.

Is VirtualBox allowing you to attach the eth0 interface to the Guest i.e. no permission errors?

Last edited by hunterthomson (2012-12-29 01:07:55)


OpenBSD-current Thinkpad X230, i7-3520M, 16GB CL9 Kingston, Samsung 830 256GB
Contributor: linux-grsec

Offline

#7 2012-12-29 04:02:50

RFreeman
Member
Registered: 2012-12-19
Posts: 4

Re: Route Arch host traffic through VirtualBox guest

There are no errors with when changing the guests network settings.

I disabled the NetworkManager using

systemctl disable NetworkManager
systemctl stop NetworkManager

the hosts internet could not reach the internet at that point, but neither could the guest.


ArchBanger
Live Free or Die

Offline

#8 2012-12-29 04:12:04

hunterthomson
Member
Registered: 2008-06-22
Posts: 794
Website

Re: Route Arch host traffic through VirtualBox guest

Double check that you are configure the network in the Guest correctly.

Then there could still be a prmissions problem i.e. VirutalBox runing as a normal user can not have direct access to the ethernet device.

One way round that could be to try creating another tap device and bridge device. Then add the eth0 and tap1 to the new bridge br1. Then add tap1 to the VirtualBox guest instead of directly adding eth0. This could work becuase Root is the user createing the br device and the "-g users" is the creation of the tap device is giving all access to the tap device to anyone in the users group.

brctl addbr br1
tunctl -g users
ifconfig br1 up
ifconfig tap1 up
ifconfig eth0 up
brctl addif br1 eth0
brctl addif br1 tap1

The other way to go would be to find eth0 in /proc or /sys and change the Group of the device to users and permissions to allow full access 7 to the group.... something like 770. I can't seem to find where eth0 is located right now.

Last edited by hunterthomson (2012-12-29 04:28:26)


OpenBSD-current Thinkpad X230, i7-3520M, 16GB CL9 Kingston, Samsung 830 256GB
Contributor: linux-grsec

Offline

Board footer

Powered by FluxBB