Reputation: 609
Newbie trying to install/set up Centos 7
. Can ping other machines in the domain, but can't ping gateway, google.com etc. Gets destination host unreachable
for gateway
and unknown host google.com
when pinging google.com
Please advice.
etc/sysconfig/network-scripts:
TYPE=Ethernet
BOOTPROTO=static
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=enp4s0
iUUID=c39e3407-a566-4586-8fb9-fd4e3bfc4617
DEVICE=enp4s0
ONBOOT=yes
IPADDR="192.168.192.150"
GATEWAY="208.67.254.41"
DNS1="8.8.8.8"
DNS2="8.8.4.4"
etc/resolv.conf
# Generated by NetworkManager
nameserver 8.8.8.8
nameserver 8.8.4.4
etc/sysconfig/network
# Created by anaconda
NETWORKING=yes
HOSTNAME=centos7
GATEWAY=208.67.254.41
Upvotes: 1
Views: 8647
Reputation: 64
Since it says unknown host google.com
, your machine is not able to route that request to the internet DNS server(8.8.8.8), which it needs in order to resolve the google.com
ip; and, when you ping the gateway it replies destination host unreachable
.
For your machine to connect to another machine, their machine should be within your LAN. If it's not on the same LAN, then there should be a machine which acts a gateway machine within the LAN. In your case, you have configured your gateway to 208.67.254.41. Obviously, it is not on your 192.168.x.x LAN, so this machine (208.67.254.41) needs to be accessible from some machine in your LAN. To do so, use the route
command,
which adds a routing entry in your machine's routing table.
route add -host <machine ip> gw <gateway ip> dev <interface>
In your case the command goes like:
route add -host 208.67.254.41 gw
<machine in lan which can access this gateway machine 208.67.254.41>
dev
<eth0 or eth1 or enp4s0 whichever is present in your case (find it by ifconfig)
>
eg : route add -host 192.168.12.45 gw 192.168.12.1 dev eth0
Comment out any entries for ipv6 if it is not used
Make sure to keep ip forwarding turned on in the gateway machine in its /etc/sysctl.conf
file.
Upvotes: 1
Reputation: 1
Have you disabled Network Manager?
Command line:
service NetworkManager status
Upvotes: 0