VirtualBox DHCP Server issue

Issues related to configuring your network
Post Reply
User avatar
croboo
Posts: 19
Joined: 2016/02/16 08:10:42
Location: Croatia
Contact:

VirtualBox DHCP Server issue

Post by croboo » 2016/06/21 18:20:36

Hello Everyone!

I have a question about networking in virtualbox. I've made 2 boxes, one is Client which gets ip address from DHCP Server. Here are specifications of those two boxes:

BOX1-Client
NIC: enp0s8 (NAT Network)
BOOTPROTO: dhcp
IP (automatic)

BOX2-DHCP-Server
NIC: enp0s3 (NAT Network)
BOOTPROTO: static
IP 10.0.2.20

This two machines is using NAT-Network with automatic dhcp turned off
so that BOX2 can give IP address to BOX1 and this is working great!

PROBLEM:
I can ping google.com from BOX1,(client) but not from BOX2.(server) Is it possible to set up BOX2 to ping google.com from this existing NIC(enp0s3) or there must be added additional NIC to access internet? :roll:



Here is config file for BOX2 /etc/sysconfig/network-scripts/ifcfg-enp0s3

TYPE=Ethernet
BOOTPROTO=none
IPADDR=10.0.2.20
HWADDR=08:00:27:b3:9e:ad
NETMASK=255.255.255.0
NETWORK=10.0.2.0
DEVICE=enp0s3
ONBOOT=yes
DHCP_HOSTNAME=Crutex.Dhcp

...and here is config for DHCP Server /etc/dhcp/dhcpd.conf

------------------------------------------------------------
# Sample configuration file for ISC dhcpd
default-lease-time 600;
max-lease-time 7200;
ddns-update-style interim;
authoritative;
log-facility local7;
# This is a very basic subnet declaration.

subnet 10.0.2.0 netmask 255.255.255.0 {
range 10.0.2.16 10.0.2.20;
option routers 10.0.2.2;
option domain-name-servers 85.114.32.7, 85.114.32.8; # optima dns serv.
option broadcast-address 10.0.2.255;
}
-----------------------------------------------------------

WHAT AM I DOING WRONG HERE? I hope my question is not too silly :)
cRoBoo

User avatar
TrevorH
Site Admin
Posts: 33221
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: VirtualBox DHCP Server issue

Post by TrevorH » 2016/06/21 18:49:09

VirtualBox already runs its own DHCP server for NAT connections.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

User avatar
croboo
Posts: 19
Joined: 2016/02/16 08:10:42
Location: Croatia
Contact:

Re: VirtualBox DHCP Server issue

Post by croboo » 2016/06/21 20:35:49

TrevorH wrote:VirtualBox already runs its own DHCP server for NAT connections.
Thank you for the answer, yes i know NAT has DHCP but in my scenario i was turning my BOX2 into DHCP Server ( just for learning purpose )
In this scenario i was turning off DHCP in NAT NETWORK so my BOX2 acts like DHCP and assigns IP address to BOX1.

I can't ping anything on internet with BOX2. My question was how to set correct configuration on BOX2 to ping internet. (google, or 8.8.8.8)
and is it possible? i thing there is some problem with routing ... i guess i missed something?! ...hm
cRoBoo

gerald_clark
Posts: 10642
Joined: 2005/08/05 15:19:54
Location: Northern Illinois, USA

Re: VirtualBox DHCP Server issue

Post by gerald_clark » 2016/06/21 21:32:06

If you want your virtual machines to talk to each other, use bridging, not NAT.

User avatar
croboo
Posts: 19
Joined: 2016/02/16 08:10:42
Location: Croatia
Contact:

Re: VirtualBox DHCP Server issue

Post by croboo » 2016/06/22 18:35:00

gerald_clark wrote:If you want your virtual machines to talk to each other, use bridging, not NAT.
actually they can also talk through internal network, i need to ping "the internet" (google.com or 8.8.8.8) from BOX2 and that's not working.
cRoBoo

gerald_clark
Posts: 10642
Joined: 2005/08/05 15:19:54
Location: Northern Illinois, USA

Re: VirtualBox DHCP Server issue

Post by gerald_clark » 2016/06/23 20:13:22

Internal network is internal only. It cannot access 8.8.8.8. It can only reach other VMs on the same host.'
Please read your virtualbox documentation.

User avatar
croboo
Posts: 19
Joined: 2016/02/16 08:10:42
Location: Croatia
Contact:

Re: VirtualBox DHCP Server issue

Post by croboo » 2016/06/25 18:55:57

gerald_clark wrote:Internal network is internal only. It cannot access 8.8.8.8. It can only reach other VMs on the same host.'
Please read your virtualbox documentation.
that's right! internal only between two virtual machines. No pinging outside!
cRoBoo

Post Reply