How do I route host's connection through guest?

Discussions related to using VirtualBox on Linux hosts.
Post Reply
artships
Posts: 3
Joined: 30. Aug 2008, 16:00

How do I route host's connection through guest?

Post by artships »

Ubuntua 8.04 host, WinXP guest, Virtualbox 1.5.6, installed bridge-utils and uml-utilities.

I have to use the Nortel Contivity client to connect to my company. I can't get any of the sources to compile so I installed the Apani VPN client on the WinXP guest. Works! But once the client is connected, I want to connect to my company's Sun box and run XWindows programs, redirecting the DISPLAY back to my Ubuntu host. I can already run mstsc.exe on the client and login to my company's WinXP box. I can also telnet from guest to my Sun box.

Thinking the solution will involve a bridge, I've given the host an IP of 192.168.1.50, and the guest, 192.168.1.60. After connecting, the client's IP becomes 172.21.7.47, and the client's domain servers become those of my company.

vbox->Settings->Network: Adaptor 0, Host Interface Settings:
Interface name is blank, Setup Application is a script that looks like:

Code: Select all

#!/bin/bash
brctl addbr br0
ifconfig eth0 0.0.0.0 promisc
ifconfig br0 192.168.1.50 netmask 255.255.255.0 up
route add -net 192.168.1.0 netmask 255.255.255.0 br0
route add default gw 192.168.1.1 br0
brctl addif br0 eth0
interface=`VBoxTunctl -b -u username`
ifconfig tap0 up
brctl addif br0 tap0
iptables -I INPUT -i br0 -j ACCEPT
echo "$interface"
exit
The two lines that talk about "interface" arranges for the tunnel id (always 0, so far) to be a parameter to a script which undoes all the networking stuff.

What further do I have to do on the host to interact with the world through the guest?
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Post by Sasquatch »

Well, simplisticly seen, I would say, set it all to bridge, let the Host set an IP in the range of the guest with the Guest as gateway and DNS server. As I'm thinking it out now, I would say create a second HIF and use that as the 'gateway'-interface. Release the IP on the br0 interface so the Host has no other connection to use. Schemetically like this:

Code: Select all

Host br0: no IP         Guest br0: company IP
Host vb0: IP to guest   Guest vb0: shared the vpn connection to
Hope I made some sense.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
Post Reply