0

GUEST CentOS VM (VirtualBox):

[root@localhost network-scripts]# route
    Kernel IP routing table
    Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
    default         10.0.2.2        0.0.0.0         UG    0      0        0 eth0
    10.0.2.0        *               255.255.255.0   U     0      0        0 eth0
    10.0.4.0        *               255.255.255.0   U     0      0        0 eth2
    link-local      *               255.255.0.0     U     1002   0        0 eth0
    link-local      *               255.255.0.0     U     1003   0        0 eth1
    link-local      *               255.255.0.0     U     1004   0        0 eth2
    192.168.56.0    *               255.255.255.0   U     0      0        0 eth1

The interface on the 10.0.2.0/24 network and on the 10.0.4.0/24 network have been configured with NAT, while the interface on the 192.168.56.0/24 network has been configured as host-only. When I connect to the internet I think I am connecting through the 10.0.2.0 network - is there a way to verify this? Also I am not sure where the 10.0.2.2 gateway came from..I cannot ping 10.0.2.1 as I thought that should be the gateway.

Secondly after adding the 10.0.4.0 network, is there a way to connect to the internet through this? What would the gateway be? 4.1 doesn't work.

I apologise if the questions are unclear, I am confused which commands to use/direction to go to figure out information.

user
  • 123
  • 8

1 Answers1

0

First, yes your VM connects internet via 10.0.2.2 because it has "UG" flag. Second, you can change this via setting default gateway whatever you want, you have to find your gateway ip address then change it with this command.

# route add default gw 10.0.4.2

i assume that your gateway 10.0.4.2, but you can check your gateway in host machine's settings.

risyasin
  • 1,574
  • 9
  • 16
  • Yes the above command worked! How did you know it was 4.2 and not 4.1? The interface has dhcp configured and so there is no information in `/etc/sysconfig/network-scripts`, in `/etc/../network` there is also no default gateway. – user Oct 06 '14 at 12:32
  • Also when I added the default gateway I had two UG entries appear, and the internet stopped working. I am not clear as to why. – user Oct 09 '14 at 23:37