Ubuntu Virtualbox - virtual lab problem

Discussions about using Linux guests in VirtualBox.
Post Reply
NoTender
Posts: 3
Joined: 7. Oct 2017, 14:37

Ubuntu Virtualbox - virtual lab problem

Post by NoTender »

Hey guys,

I am trying to set up my virtual lab for penetration testing using VirtualBox. I have made three virtual machines with Ubuntu system installed. On the first machine I set DHCP server so the other two virtual machines can get IPv4 adress and default gateway (machine with DHCP server is set as a default gateway and has static IP adress configured). Then I set only one virtual network interface to each machine (Internal network), so they can be in same LAN network. Everything works fine, but now I would like to set the machine with DHCP server to have an internet connection and provide it to the other two virtual machines (so the machine with DHCP would act as a router to them). The reason why I am doing this is because I need to capture the traffic from the other two machines right on the default gateway. I have read several of tutorials but still with no desired results. Can anyone please give me a hint how to achieve that? I am a student and this is part of my diploma thesis.

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

Re: Ubuntu Virtualbox - virtual lab problem

Post by Perryg »

The virtual machine that you are using for your dhcp server/gateway will need Internet access to be able to pass it to the other virtual guests. Linux can achieve this with iptables and forward routes to the internal network from the public adapter you set to receive the outside world. Meaning the one guest will need two adapters. Other than that you would need to setup a router software like pFsense to do the routing for you. Please note that other than explain what you need to do from the VirtualBox side the setup of iptables or other configurations related to the guest OS is outside the scope here and you should consult the forum for the guest OS for procedures.
NoTender
Posts: 3
Joined: 7. Oct 2017, 14:37

Re: Ubuntu Virtualbox - virtual lab problem

Post by NoTender »

Thank you for the answer Perryg. I am sorry that I used this forum for this purpose, I was not exactly sure how to achieve that and I thought the majority of things that are nescessary to achieve that is from VirtualBox side. Could you just help me with one thing from virtualbox side? I am not exactly sure what network adapter to use as second adapter. Whether NAT or Bridged network. Thank you again for your help. :)
Last edited by socratis on 7. Oct 2017, 18:09, edited 1 time in total.
Reason: Removed unnecessary verbatim quote of the whole previous message.
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Ubuntu Virtualbox - virtual lab problem

Post by Perryg »

The public side adapter really does not matter as far as your lab is concerned. VBox NAT should work and so would Bridged. When I setup a lab I use pFsence with two adapters myself because I have it preconfigured and all I need to do to switch to a different experiment is change the intnet that is used for the private side. One set to NAT and the other set to intnet that is also used for all other lab guests.
NoTender
Posts: 3
Joined: 7. Oct 2017, 14:37

Re: Ubuntu Virtualbox - virtual lab problem

Post by NoTender »

Thank you very much for your help!
Post Reply