Page 1 of 1
Gateway VM
Posted: 10. Jan 2009, 13:25
by mashcaster
Is it possible to setup a gateway VM in VirtualBox which will serve as a gateway server for all other VMs?
Posted: 10. Jan 2009, 15:57
by isama
yes, it is possible, you just hook up all vm's to a internal network and one (the vm that will be the router) should be connected to your internal network and to your host (nat/host interface)
I am trying to figure out how to do this on my laptop

Posted: 11. Jan 2009, 00:16
by mashcaster
Please post back if you figure this out.
Posted: 11. Jan 2009, 16:35
by Sasquatch
mashcaster wrote:Please post back if you figure this out.
Why not start yourself? If you know how to setup a gateway on a physical machine, it's not that hard to do it on a virtual one.
If you want it for your physical machines, you need HIF. Else internal networking is what you need. There are plenty of tutorials on the web which describe exactly what to do.
Posted: 11. Jan 2009, 18:16
by mashcaster
Sasquatch wrote:mashcaster wrote:Please post back if you figure this out.
Why not start yourself? If you know how to setup a gateway on a physical machine, it's not that hard to do it on a virtual one.
If you want it for your physical machines, you need HIF. Else internal networking is what you need. There are plenty of tutorials on the web which describe exactly what to do.
I have tried, but I can't get it to work.
Posted: 12. Jan 2009, 22:20
by Sasquatch
Then you can at least post what you have tried.
Posted: 13. Jan 2009, 11:08
by mashcaster
No prob
I installed debian etch in a VM with 2 NICs and changed the /etc/network/interfaces file to the following:
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp
auto eth1
iface eth1 inet static
address 192.168.1.1
netmask 255.255.255.0
eth0 for external connections
eth1 for internal connections
ifconfig returns this
eth0
Link encap:Ethernet Hwaddr 08:00:27:6A:B4:9A
inet addr:10.0.2.15 Bcast 10.0.2.255 Mask 255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets 2 errors:0 dropped:0 overruns:0 frame:0
TX packets:2 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txquenelen:1000
RX bytes:1180 (1.1 KiB) TX bytes:684 (684.0 b)
Interrupt:11 Base address:0xc020
eth1
Link encap:Ethernet Hwaddr 08:00:27:34:99:41
inet addr:192.168.1.1 Bcast 192.168.1.255 Mask 255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets 0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txquenelen:1000
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
Interrupt:11 Base address:0xc060
lo
Link encap:Local Loopback
inet addr127.0.0.1 Mask 255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets 0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txquenelen:0
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
cat /etc/resolv.conf returns:
nameserver 10.0.2.3
echo 1 > /proc/sys/net/ipv4/ip_forward
returns nothing
I can connect to the internet and I can ping to this server from another VM, but I cannot get the other VM to connect to the internet via this gateway VM.
What I am doing wrong?
Posted: 14. Jan 2009, 17:06
by mashcaster
Am I allowed to *BUMP* threads?
Posted: 15. Jan 2009, 01:08
by Sasquatch
What are the network settings on the other VM? How are the two VMs connected with each other?
Posted: 16. Jan 2009, 22:54
by mashcaster
I have the gateway with 2 virtual nics
nic1 = eth0 = net
nic2 = eth1 = internal network
network name = intnet
the standard network pc vm has 1 nic
nic1 = eth0 = internal network
network name = intnet
Posted: 23. Jan 2009, 16:05
by mashcaster
Hesitant *bump*
Posted: 24. Jan 2009, 00:28
by chronoboy
On the Gateway VM there is more to do than just enabling the ip forwarding in the kernel. You will need to change some iptables. Read this very simple HowTo on TLDP.org for configuring your iptables on the Gateway VM:
http://www.tldp.org/HOWTO/Masquerading- ... index.html
Next, on your client VMs, the VMs which connect through the gateway, be sure to assign them each a static IP address and set their gateway IP to your Gateway VM's IP.
Some simple troubleshooting steps would be:
- Can you ping the Gateway VM from the client?
When you do a ping to an outside IP address rather than domain name, does it respond?
What DNS servers are set on the client VMs?
Have you attempted a traceroute to the Host?
Give these ideas a try. I know I was able to set-up a Gateway VM before. I used Debian as the Gateway, and had Windows clients connect through it.
Good luck.
Posted: 24. Jan 2009, 12:20
by mashcaster
Is there no "full" guide I can follow which tells me exactly how to set this up from start to finish. I have been trying to join many guides together to get this to work, and it seems I am missing bits out.
Please help.