I'm trying to setup a centOS server with a public static IP address but if I try and ping the router ( I get "Network is unreachable", if I try and ping google.com I get "unknown host google.com"

This is the dump from ifconfig

eth0      Link encap:Ethernet  HWaddr D4:9A:20:F8:9D:F8  
          inet addr:  Bcast:  Mask:
          RX packets:1178 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1014 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:292875 (286.0 KiB)  TX bytes:40593 (39.6 KiB)

lo        Link encap:Local Loopback  
          inet addr:  Mask:
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:249 errors:0 dropped:0 overruns:0 frame:0
          TX packets:249 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:20076 (19.6 KiB)  TX bytes:20076 (19.6 KiB)

Dump from route:

Kernel IP routing table 
Destination     Gateway          Genmask           Flags Metric Ref Use Iface  *         U     0      0   0   eth0
link-local      *             U     1002   0   0   eth0           UG    0      0   0   eth0

Dump from /etc/hosts             localhost localhost.localdomain localhost4 localhost4.localdomain4
::1                   localhost localhost.localdomain localhost6 localhost6.localdomain6        server.mypersonaldomain.com server

Dump from /etc/resolve.conf


Dump from /etc/sysconfig/network


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


Any ideas where I'm going wrong here?

  • Update - I'm able to ping and receive a response, but not or any other domain/IP

  • Update - Still having troubles with this, does anyone else have any ideas?


You're missing a default gateway which is demonstrated by your route "dump" so your server has no way of sending traffic to a destination that is not a specific match within your routing table.

Dump from route:

Kernel IP routing table
Destination     Gateway    Genmask            Flags Metric Ref Use Iface
Your IP  *    U     0      0   0   eth0
link-local      *        U     1002   0   0   eth0

You can add a route to the outside world by setting a GATEWAY under your ifcfg-eth0 and bouncing the network service or eth0:

GATEWAY="Your Gateway IP"  <----
  • Thanks for the super-quick answer, I've updated the ifcfg-eth0 and added the gateway, restarted the eth0 and networking and still the same problem. Is there another route I need to add? – user2672330 Aug 28 '13 at 16:59
  • Can you please update your question with your updated route output and if you're able to ping your default gateway? – one.time Aug 28 '13 at 18:33
  • Done. It's placed a route into the list, but hasn't appeared to fix the issue. – user2672330 Aug 28 '13 at 19:25
  • 1
    If you can't ping your default gateway you will remain without connectivity until you solve this issue. Is your server sitting on the same layer-2 segment as your gateway? Can you see ARP entries for these devices on the server or the device the server is connected? Can you tell us about your topology? (Also, while your attention to detail is great, I suggest you edit out all of the public IP address information in your post.) – one.time Aug 28 '13 at 20:02
  • Alright thanks for the advice. I'm relatively new to networking so I'm not entirely sure about half of what you've asked for unfortunately, however It's given me a direction to look into which is a great help in itself. Basically I've got a router running DDWRT, then the server connected directly to that. I'm able to setup the server and get network connectivity through DHCP and the networks dynamic IP, but I want to assign it one of the 10 static public IP's provided by my ISP. I hope that helps explain better. Also the IP's in the post are fictional, thanks for the consideration though. – user2672330 Aug 29 '13 at 2:38

Your router ip is but your host ip is Both your host and router are in two different network there's no way it can reach


I followed this video to the tee and it worked: https://www.youtube.com/watch?v=kWSnpaZK_BI

You will need to know which one of your network interface is the active one, e.g. eth0, eth1 or ...

A note to VMware player users, even though the default gateway (setup by VMware player) is and the name server is, use as the GATEWAY AND nameserver in files shown in the above video, and everything will work.

  • It would be preferable if you condensed the relevant points of that video down in your answer, in case the video gets deleted or unavailable. – Doktoro Reichard Apr 24 '14 at 14:20

If you are using the GUI, you have to set up all the values not only in shell but also in the GUI manually. Try to turn off the firewall (also services iptables & ip6tables), as well as selinux.


Add a default gateway

# route add default gw eth0      

I had similar situation. It was resolved by adding correct search domain and nameserver entries in /etc/resolv.conf.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.