Page 1 of 1
Emulate 2 LAN networks?
Posted: 30. Apr 2013, 13:25
by davelowndes
Hi, Is it possible in VirtualBox to simulate two independent LAN networks, both behind a router with a "public" IP address (accessible to my physical network)? E.g.
LAN 1, public IP 192.168.1.21
- machine A, 172.168.1.100
- machine B, 172.168.1.101
LAN 2, public IP 192.168.1.22
- machine A, 172.168.1.100
- machine B, 172.168.1.101
And be able to port forward, e.g. 192.168.1.22:80 -> 172.168.1.100:80 (LAN 2) so any machine in my home network, or in LAN 1 or in LAN 2 would be able to see the service at 192.168.1.22:80?
Thanks!
Re: Emulate 2 LAN networks?
Posted: 30. Apr 2013, 14:14
by noteirak
Sure thing, pretty easy to do with Virtualbox
Depending on how knowledgable you are with networking stuff, I could recommend 2 approachs :
Easy mode : 2 extra VMs under text-mode debian which would be the easiest, config wize
Hard mode : 1 extra VM under pfSense or anything of the like, which requires (a lot) more config, but saves you the extra VM.
You would then have for LAN 1 :
Machine A with 1 internal network interface, under name VLAN001
Machine B with 1 internal network interface, under name VLAN001
Machine Debian 1 with 1 Internal NIC on VLAN001 and 1 Bridged NIC on your host NIC to your normal LAN
You would have for LAN 2 :
Machine A with 1 internal network interface, under name VLAN002
Machine B with 1 internal network interface, under name VLAN002
Machine Debian 1 with 1 Internal NIC on VLAN002 and 1 Bridged NIC on your host NIC to your normal LAN
In case you use a single pfSense VM, use VLANs setup to separate the networks.
In all VMs :
- Configure your VMs with the appropriate IPs following regular OS configuration
In both Debian VMs :
- Configure IP routing
- Enable iptables masquerading on the bridged interface
- Configure iptables firewalling if you wish to
For the specifics, you'll find lots of tutorials & howtos on Internet, especially if you keep to debian or pfSense.
Re: Emulate 2 LAN networks?
Posted: 30. Apr 2013, 15:41
by davelowndes
Great thanks! I was hoping I could skip extra VMs to act as routers but I guess it's okay, gives me the most power and I'm already familiar with *nix.
Re: Emulate 2 LAN networks?
Posted: 30. Apr 2013, 16:34
by noteirak
You could, but then you need to turn your host into router mode and use Host-Only interfaces. But that would be a nightmare on a Windows Host, so I wouldn't recommend it _at all_
Or you could switch to a linux host

I've got that kind of setup (with the host doing the routing) on a debian dedicated server and I can say it's working flawlessly.