0

I have a centos virtual box machine which is hosted on ubuntu, on ubuntu I'm connected to open-connect VPN and I want to use this VPN through centos 6.7 virtual machine.

I have set up Virtual Box host-only network like this:

vboxnet0
adapter:
ipv4 address: 192.168.56.1
ipv4 network mask: 255.255.255.0

DHCP server : 
enable server 
 server address: 192.168.56.100
 server mask: 255.255.255.0
 lower address bound: 192.168.56.101
 upper address bound: 192.168.56.254

And Then I configured centos Vbox network like below:

adapter1:

 attached to : Host-only adapter  
 name : vboxnet0 

adapter 2 :

  attached to : NAT

Then I configured centos network settings like below:

/etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE=eth0
TYPE=Ethernet
UUID=ff99b59d-162f-4838-baa7-c73384ab23f2
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=dhcp
HWADDR=08:00:27:1D:BD:69
DEFROUTE=yes
NAME="System eth0"

And also:

 /etc/sysconfig/network-scripts/ifcfg-eth1

DEVICE=eth1
TYPE=Ethernet
UUID=ff99b59d-162f-4838-baa7-c73384ab23f2
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=dhcp
NAMEE="System eth1"

And then I rebooted Vbox when reloading Vbox and type ifconfig I get :

eth0      Link encap:Ethernet  HWaddr 08:00:27:1D:BD:69  
          inet addr:192.168.56.102  Bcast:192.168.56.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fe1d:bd69/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:192 errors:0 dropped:0 overruns:0 frame:0
          TX packets:124 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:26123 (25.5 KiB)  TX bytes:19725 (19.2 KiB)

eth1      Link encap:Ethernet  HWaddr 08:00:27:ED:C4:BD  
          inet addr:10.0.3.15  Bcast:10.0.3.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:feed:c4bd/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:3 errors:0 dropped:0 overruns:0 frame:0
          TX packets:11 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:735 (735.0 b)  TX bytes:1075 (1.0 KiB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:315 errors:0 dropped:0 overruns:0 frame:0

When I ping 4.2.2.4 or 8.8.8.8 I get:

connect: Network is unreachable 

Any help will be much appreciated!

Thanks!

1 Answers1

0

I have managed to solve this issue by Setting virtual machine (centos) adapter1 to NAT and adapter 2 to host-only network

Then I configured virtual box network (host-only network tab) to :

vboxnet0  
ipv4 address : 192.168.56.1
ipv4 network mask : 255.255.255.0

and enabled DHCP server and configure it like :

server address : 192.168.56.100
server mask : 255.255.255.0
lower address bound : 192.168.56.101
upper address bound : 192.168.56.254

than I booted my virtual machine and configured it like :

/etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE=eth0
TYPE=Ethernet
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=dhcp
HWADDR=08:00:27:1D:BD:69
DEFROUTE=yes
NAME="System eth0"
DNS1=8.8.8.8
DNS2=4.2.2.4

And also :

 /etc/sysconfig/network-scripts/ifcfg-eth1

DEVICE=eth1
TYPE=Ethernet
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=dhcp
NAMEE="System eth1"

And rebooted the machine and it worked. it could use my host network which was