Page 1 of 1
Install router and DHCP on VM
Posted: 23. Feb 2014, 02:25
by satimis
Hi all,
Host - Ubuntu 12.04
VM - Ubuntu 12.04
Virtualizer - Oracle VirtualBox
I'm prepared installing router and DHCP server. Can I install them on a VM instead on the Host? I expect keeping the Host clean only for running Oracle VirtualBox.
Tutorial:-
Router
https://help.ubuntu.com/community/Router
DHCP server:
Dynamic Host Configuration Protocol (DHCP)
https://help.ubuntu.com/12.04/serverguide/dhcp.html
Setting up a DHCP server on Ubuntu 12.04 (Precise Pangolin) server
http://lani78.com/2012/07/23/setting-up ... in-server/
Please advise. Thanks
Rgds
satimis
Re: Install router and DHCP on VM
Posted: 24. Feb 2014, 01:18
by BillG
Yes you can, as long as you make sure that the NICs in the vm are connected to the correct networks.
What network will the DHCP server operate in and what networks are you routing between?
Re: Install router and DHCP on VM
Posted: 24. Feb 2014, 07:10
by satimis
BillG wrote:Yes you can, as long as you make sure that the NICs in the vm are connected to the correct networks.
Hi,
Thanks for your advice.
Performed following test :
(Documentation referred
Router Guide
Setting up an Ubuntu Wired/Wireless Router
https://help.ubuntu.com/community/Router
)
VM - Ubuntu 12.04
$ cat /etc/network/interfaces
Code: Select all
auto lo
iface lo inet loopback
auto eth1
iface eth1 inet static
address 2xx.2xx.2xx.1xx
netmask 255.255.255.0
gateway 2xx.2xx.2xx.1xx
auto eth2
iface eth2 inet static
address 192.168.0.1
network 192.168.0.0
netmask 255.255.255.0
broadcast 192.168.0.255
auto br0
iface br0 inet static
address 192.168.0.1
network 192.168.0.0
netmask 255.255.255.0
broadcast 192.168.0.255
Two NIC detected as eth1 and eth2
Host - Debian 7.3
$ cat /etc/network/interfaces
Settings -> Network
Adapter 1
Attached to: NAT
Adapter 2
Attached to: Internal Network
Pulled out the cable connecting Cable Modem to Router and connected it to "network card 1". Unable to connect ISP server.
Also tried "network card 2", with same result.
What network will the DHCP server operate in and what networks are you routing between?
The VMs are mirror of the websites hosted on Godaddy. They are not up round the clock. I have only one static IP. The domain on Godaddy will point to the Static IP when the VM is up running. I have to foward all ports to the VM so that users can browse it.
satimis
Re: Install router and DHCP on VM
Posted: 24. Feb 2014, 08:58
by BillG
There is no point in setting a public IP on a NIC in a vm if it is set to NAT. You need to find some way to get the vm to bridge directly to the public network. I have never done that when the NIC needs to connect directly to the Internet through a modem, so I don't know if it is possible or not.
If it is possible, you would need to bridge the NIC in the vm to the physical NIC, then connect the vm directly to the Internet through the modem. The vm would get a public IP directly from the ISP (instead of the host making the Internet connection).
Re: Install router and DHCP on VM
Posted: 24. Feb 2014, 09:53
by satimis
BillG wrote:There is no point in setting a public IP on a NIC in a vm if it is set to NAT. You need to find some way to get the vm to bridge directly to the public network. I have never done that when the NIC needs to connect directly to the Internet through a modem, so I don't know if it is possible or not.
I have tried selecting;
Adapter 1
Attached to: Bridged Adapter
Name: eth0
(Here I'm confused. The 1st NIC is named eth0 and 2nd NIC eth1
On VM they are named eth1 and eth2 respectively)
Pulled the WAN to NIC socket connection to Internet was lost on both Host and VM.
If it is possible, you would need to bridge the NIC in the vm to the physical NIC, then connect the vm directly to the Internet through the modem. The vm would get a public IP directly from the ISP (instead of the host making the Internet connection).
I have no clue how to do it. Any advice? Thanks
satimis
Re: Install router and DHCP on VM
Posted: 25. Feb 2014, 02:48
by BillG
I think that you are out of your depth with the routing without the added problems of virtual networks. I would use the host directly unless you can find someone local to "hold your hand".
Re: Install router and DHCP on VM
Posted: 25. Feb 2014, 03:28
by satimis
BillG wrote: - snip -
I would use the host directly unless you can find someone local to "hold your hand".
It works on PC. However I expect keeping the Host clean only for running VirtualBox. Otherwise I would purchase a router as a folk on Ubuntu forum suggested before, saving my headache.
satimis
Re: Install router and DHCP on VM
Posted: 25. Feb 2014, 08:11
by BillG
That would certainly be a good move. Working on a local LAN is far easier than using a direct connection via modem from the host.
Re: Install router and DHCP on VM
Posted: 25. Feb 2014, 18:31
by satimis
Hi,
I found following documents which are quite interesting to me:
1)
Notes/Virtual Linux Router with VirtualBox
http://wiki.smalleycreative.com/Notes/V ... VirtualBox
2)
Tutorials:Using Linux Virtual Machine instead of router for VPN
http://wiki.hidemyass.com/Tutorials:Usi ... er_for_VPN
3)
Creating a Virtual Network of Linux Guests using VirtualBox
http://sandilands.info/sgordon/creating ... virtualbox
I haven't gone through all of them deeply. On 3) it seems needing 3 NICs?
satimis
Re: Install router and DHCP on VM
Posted: 26. Feb 2014, 00:35
by BillG
If you really want to run a vm as a router under VirtualBox,have a look at the pfSense appliance. pfsense.com