Reach Internet with host only networking

Discussions about using Linux guests in VirtualBox.
Post Reply
riprop
Posts: 3
Joined: 27. Oct 2010, 14:59
Primary OS: Ubuntu other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: OEL, Windows XP

Reach Internet with host only networking

Post by riprop »

Hello,
this is configuration on my laptop at work:

HOST: Ubuntu 10.10, IP = 10.?.?.? from dhcp
GUEST: Oracle En. Linux 5.5 , host only networking, IP = 192.168.56.101

I can reach guest from host on IP=192.168.56.101, and host from guest on IP =192.168.56.1.

I want to use host to reach Internet from guest (so the host is something like gateway), but I'm not so good in Linux networking, routing and so. Can this be done ? How ?

Please do not suggest other solution (like using NAT, bridged or Internal networking in vbox instead of host only networking , or using another adapter in guest,...) !

Thanks in advance ?
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Reach Internet with host only networking

Post by Perryg »

With your restrictions the only thing I see is for you to learn how to use IP tables.
riprop
Posts: 3
Joined: 27. Oct 2010, 14:59
Primary OS: Ubuntu other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: OEL, Windows XP

Re: Reach Internet with host only networking

Post by riprop »

Thanks for trail.
Is Iptables enough, what about routing table ?

I didn't mention (in order to keep question clear/simple/short), but I have two more guests (with IPs 192.168.56.102 and 192.168.56.103), and all they can be reached mutually now, I just want to add Internet to them trough HOST.
stefan.becker
Volunteer
Posts: 7639
Joined: 7. Jun 2007, 21:53

Re: Reach Internet with host only networking

Post by stefan.becker »

One approach is to use a proxy server on the host.
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Reach Internet with host only networking

Post by Perryg »

Google using iptables to route packets It explains it better then I can here. It can do what you want.

Edit: Or as Stefan says use squid, but this approach is limited and sometime restrictive depending on how you set it up.
Post Reply