Ubuntu guest inside PC-BDS host: VirtualBox networking

This is for discussing general topics about how to use VirtualBox.
Post Reply
hpbsd
Posts: 3
Joined: 29. Dec 2011, 21:48
Primary OS: FreeBSD
VBox Version: OSE other
Guest OSses: Ubuntu LTE 10.04

Ubuntu guest inside PC-BDS host: VirtualBox networking

Post by hpbsd »

Hi all,

Here is my setup:

Host: PC-BSD 9.0-RC1
Guest: Ubuntu 10.04

I need to connect to outside VPN which I cannot do from PC-BSD, thats why I installed Ubuntu on VirtualBox as a guest.

Currently, I can connect to the VPN I want from guest Ubuntu. What I need is, somehow, use that connection outside guest too. i.e. on my host. So that I can connect to that VPN from PC-BSD itself.

I tried looking at networking options of VirtualBox but cannot figure-out a way. Which mode should I use and how to setup the interfaces?

Apologies if this information is not sufficient. Let me know and I can provide whatever is needed.

Thanks in advance,
hpbsd.
Technologov
Volunteer
Posts: 3342
Joined: 10. May 2007, 16:59
Location: Israel

Re: Ubuntu guest inside PC-BDS host: VirtualBox networking

Post by Technologov »

Guest shoulds have 2 legs (2 vAdapters)
1. vNIC1 - (eth0) bridge or NAT (or whatever makes your VPN happy)
2. vNIC2 - (eth1) VBox host-only network.

Host should have 2 legs:
1. eth0 for physical network - disable TCP/IP stack on this one (use 0.0.0.0 as IP)
2. vbox0 - enable TCP/IP on this... it will force your host to route traffic via guest.
hpbsd
Posts: 3
Joined: 29. Dec 2011, 21:48
Primary OS: FreeBSD
VBox Version: OSE other
Guest OSses: Ubuntu LTE 10.04

Re: Ubuntu guest inside PC-BDS host: VirtualBox networking

Post by hpbsd »

Firstly, thanks for getting back.
Technologov wrote:Guest shoulds have 2 legs (2 vAdapters)
1. vNIC1 - (eth0) bridge or NAT (or whatever makes your VPN happy)
2. vNIC2 - (eth1) VBox host-only network.
I've set them up as you said in VirtualBox network config and ifconfig on guest shows this:

eth0 Link encap:Ethernet HWaddr 08:00:27:2f:45:53
inet addr:10.0.2.15 Bcast:10.0.2.255 Mask:255.255.255.0
inet6 addr: fe80::a00:27ff:fe2f:4553/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:175 errors:0 dropped:0 overruns:0 frame:0
TX packets:203 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:58038 (58.0 KB) TX bytes:22848 (22.8 KB)

eth1 Link encap:Ethernet HWaddr 08:00:27:2e:db:38
inet addr:192.168.56.101 Bcast:192.168.56.255 Mask:255.255.255.0
inet6 addr: fe80::a00:27ff:fe2e:db38/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2 errors:0 dropped:0 overruns:0 frame:0
TX packets:25 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1180 (1.1 KB) TX bytes:4496 (4.4 KB)
Technologov wrote: Host should have 2 legs:
1. eth0 for physical network - disable TCP/IP stack on this one (use 0.0.0.0 as IP)
2. vbox0 - enable TCP/IP on this... it will force your host to route traffic via guest.
[/quote]

I am connected on WiFi and here is how my ifconfig on host looks:

Code: Select all

vboxnet0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500
        ether 0a:00:27:00:00:00
        inet6 fe80::800:27ff:fe00:0%vboxnet0 prefixlen 64 scopeid 0xe
        inet 192.168.56.1 netmask 0xffffff00 broadcast 192.168.56.255
        nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
wlan0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 1500
        ether 00:26:c6:65:98:9a
        inet6 fe80::226:c6ff:fe65:989a%wlan0 prefixlen 64 scopeid 0xf
        inet 0.0.0.0 netmask 0xffffff00 broadcast 192.168.1.255
        nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
        media: IEEE 802.11 Wireless Ethernet autoselect (autoselect)
        status: no carrier
        ssid "" channel 6 (2437 MHz 11g)
        country US authmode WPA2/802.11i privacy OFF txpower 15 bmiss 10
        scanvalid 60 bgscan bgscanintvl 300 bgscanidle 250 roam:rssi 7
        roam:rate 5 protmode CTS wme
But in this case, I seem to not get any connectivity on the host.
Technologov
Volunteer
Posts: 3342
Joined: 10. May 2007, 16:59
Location: Israel

Re: Ubuntu guest inside PC-BDS host: VirtualBox networking

Post by Technologov »

Hmm.. sorry NAT will not work for this case. Only bridge.
NAT uses host's TCP/IP stack, which we disable for your case. Bridge bypasses it, and uses WiFi/Ethernet directly.
Try with Eithernet first (without WiFi) -- WiFi will give you much more trouble. try WiFi later.
Ask BSD dudes if Bridge-over-Wifi is supported on BSD. (On Linux it is)

Guest shoulds have 2 legs (2 vAdapters)
1. vNIC1 - (eth0) bridge only
2. vNIC2 - (eth1) VBox host-only network.
hpbsd
Posts: 3
Joined: 29. Dec 2011, 21:48
Primary OS: FreeBSD
VBox Version: OSE other
Guest OSses: Ubuntu LTE 10.04

Re: Ubuntu guest inside PC-BDS host: VirtualBox networking

Post by hpbsd »

I need to have wireless working.

Another thought in the same direction, since I have VPN working inside guest (ubuntu), can I use port-forwarding somehow to use VPNe'd access in host (bsd)?
Post Reply