Virtualbox version 3
Host: Ubuntu 9.04
Guest: Backtrack 4 pre-final (Ubuntu based)
Goal: Make the ip of the Guest reachable to other machines on the LAN
I don't know much about network routing, maybe someone here knows more about it than me.
I'm using Host-only networking which creates the virtual interface vboxnet0 for me.
Host eth0 IP: 192.168.0.1
Host vboxnet0 IP: 192.168.1.1
Guest eth0 IP: 192.168.1.2
The IP 192.168.1.2 is pingable from the host and 192.168.0.1 is pingable from inside the guest. But I wasn't able to ping my router (192.168.0.23). I've played around with the commands "ip route" and "route", but it didn't help. I've RTFM but it seems I'm too stupid or I'm missing something.
Is it even possible? To make the host route packets from the virtual network 192.168.1.0/24 to machines in the network 192.168.0.0/24 and vice versa?
I know there are other possibilities than changing the routing, but using vboxnet0 would be most useful for sniffing etc. If it doesn't work I'll probably use port forwarding from the host to the virtual network.
Host-only networking on Linux (Ubuntu): routing how-to?
-
baf
- Volunteer
- Posts: 829
- Joined: 27. Sep 2008, 06:18
- Primary OS: Mac OS X Leopard
- VBox Version: VirtualBox+Oracle ExtPack
- Guest OSses: linux,xp,win7
- Location: Luleå or Skellefteå, Sweden
Re: Host-only networking on Linux (Ubuntu): routing how-to?
Host-only means just that only host! It's impossible to reach the rest of the net.
What you want is bridged.
What you want is bridged.
Some say: "You learn as long as you live".
My way: "You live as long as you learn".
My way: "You live as long as you learn".
-
anblasko
- Posts: 6
- Joined: 2. Jul 2009, 10:20
- Primary OS: Ubuntu other
- VBox Version: VirtualBox+Oracle ExtPack
- Guest OSses: XP
Re: Host-only networking on Linux (Ubuntu): routing how-to?
When dedicated server resellers forbid bridged networks they offer host only networking with multiple IP.
example:
first host IP: 77.178.54.43
second host IP: 77.178.54.89
guest IP: 192.168.0.50
routing traffic between second host ip and guest
Your host becomes available now from outside using 77.178.54.89
If you can use bridged network use bridge, if not use this approach.
example:
first host IP: 77.178.54.43
second host IP: 77.178.54.89
guest IP: 192.168.0.50
routing traffic between second host ip and guest
Code: Select all
sudo iptables -t nat -I PREROUTING -d 77.178.54.89 -j DNAT --to 192.168.0.50
sudo iptables -t nat -I POSTROUTING -s 192.168.0.50 -j SNAT --to 77.178.54.89
If you can use bridged network use bridge, if not use this approach.
-
schizzo
- Posts: 2
- Joined: 5. Jul 2009, 11:32
- Primary OS: Ubuntu other
- VBox Version: OSE Debian
- Guest OSses: ubuntu
Re: Host-only networking on Linux (Ubuntu): routing how-to?
Thank you. I didn't get iptables working as supposed to. So I'm using bridged now.
-
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
Re: Host-only networking on Linux (Ubuntu): routing how-to?
IP tables isn't all that hard. This is all that's needed, where eth0 is the outgoing interface, aka internet.schizzo wrote:Thank you. I didn't get iptables working as supposed to. So I'm using bridged now.
Code: Select all
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
echo 1 > /proc/sys/net/ipv4/ip_forwardRead 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.
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.