I think I have a routing problem. I have set up a CentOS VM, it is connected to my network and I can ping other machines.
I cannot however ping anything outside of my network.
[root@localhost ~]# ping 8.8.8.8
connect: Network is unreachable
I also set up port forwarding on my router to forward SSH on port 22 to this machine and I cannot access it outside of my network (using putty).
Here is the output of ip route
:
[root@localhost ~]# ip route
10.0.0.0/24 dev enp0s3 proto kernel scope link src 10.0.0.10
169.254.0.0/16 dev enp0s3 scope link metric 1002
Here is the contents of /etc/sysconfig/network-scripts/ifcfg-enp0s3
:
TYPE="Ethernet"
BOOTPROTO="static"
IPADDR=10.0.0.10
NETMASK=255.255.255.0
NM_CONTROLLED=no
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="enp0s3"
UUID="17eeb7fe-f11c-4b8b-83be-a9dd2281dda2"
DEVICE="enp0s3"
ONBOOT="yes"
Answer
Based on the errors, you need to update the files to look like this:
/etc/sysconfig/network-scripts/ifcfg-enp0s3
:
TYPE="Ethernet"
BOOTPROTO="static"
IPADDR=10.0.0.10
NETMASK=255.255.255.0
NM_CONTROLLED=no
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="enp0s3"
UUID="17eeb7fe-f11c-4b8b-83be-a9dd2281dda2"
DEVICE="enp0s3"
ONBOOT="yes"
/etc/sysconfig/network
:
NETWORKING=yes
HOSTNAME=centos7
GATEWAY=10.0.0.1
/etc/resolv.conf
:
nameserver 8.8.8.8
nameserver 8.8.4.4
No comments:
Post a Comment