I have 2 CentOS 7 guests running in VirtualBox on a Ubuntu host.
I want to be able to:
- Connect using ssh from host to guest
- Download/install packages from the Internet on the guest.
I currently have following two virtual network interfaces
- Host Only, mapped as 'enp0s3' on guest
- NAT, mapped as 'enp0s8' on guest
My current configuration:
$ cat /etc/sysconfig/network-scripts/ifcfg-enp0s3 TYPE=Ethernet BOOTPROTO=none DEFROUTE=yes IPV4_FAILURE_FATAL=no IPV6INIT=no NAME=enp0s3 UUID=fcd0aa44-9ab7-42e6-a637-52c429727195 ONBOOT=yes HWADDR=08:00:27:BE:DB:11 IPADDR=192.168.56.102 PREFIX=32 GATEWAY=192.168.56.1
$ cat /etc/sysconfig/network-scripts/ifcfg-enp0s8 HWADDR=08:00:27:A2:03:29 TYPE=Ethernet BOOTPROTO=dhcp DEFROUTE=yes PEERDNS=yes PEERROUTES=yes IPV4_FAILURE_FATAL=no IPV6INIT=yes IPV6_AUTOCONF=yes IPV6_DEFROUTE=yes IPV6_PEERDNS=yes IPV6_PEERROUTES=yes IPV6_FAILURE_FATAL=no NAME=enp0s8 UUID=09acefe7-d513-48f6-b820-0988ac495e5e ONBOOT=yes
Current route info:
$ route Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface default 192.168.56.1 0.0.0.0 UG 1024 0 0 enp0s3 10.0.3.0 0.0.0.0 255.255.255.0 U 0 0 0 enp0s8 192.168.56.1 0.0.0.0 255.255.255.255 UH 1024 0 0 enp0s3
At this point I can ssh from my Ubuntu host to my CentOS guest but I cannot successfully connect to the Internet:
$ wget https://github.com/antirez/redis/archive/3.0.0-rc6.tar.gz Resolving github.com (github.com)... 126.96.36.199 Connecting to github.com (github.com)|188.8.131.52|:443...
Lot of other posts and samples suggested that I remove the default gateway from 'enp0s3'. If I remove the default gateway from 'enp0s3', I cannot ssh from the Ubuntu host to the CentOS guest.
How can I make this work?