dhcp - Ping retrieves an IP from DNS, but loses all packets
2014-04
I'm working with a minimal installation of RHEL 6.
When I first turned this machine on, it couldn't ping anybody.
It turned out that I needed to add the GATEWAY
under /etc/sysconfig/networking
and configure /etc/sysconfig/network-scripts/ifcfg-eth0
to point to the gateway and boot on start using DHCP.
As of now, I can access any other machine on the local network; I can even SSH into the machine I'm working with. What I still cannot do is access anything outside of the local network; I can't access the internet.
Consider:
[root@dbrepa ~]# ping dev-108a -c 4
PING dev-108a.some.domain.net (192.168.108.119) 56(84) bytes of data.
64 bytes from dev-108a.some.domain.net (192.168.108.119): icmp_seq=1 ttl=64 time=0.276 ms
64 bytes from dev-108a.some.domain.net (192.168.108.119): icmp_seq=2 ttl=64 time=0.249 ms
64 bytes from dev-108a.some.domain.net (192.168.108.119): icmp_seq=3 ttl=64 time=0.250 ms
64 bytes from dev-108a.some.domain.net (192.168.108.119): icmp_seq=4 ttl=64 time=0.259 ms
--- dev-108a.some.domain.net ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3000ms
rtt min/avg/max/mdev = 0.249/0.258/0.276/0.019 ms
[root@dbrepa ~]# ping example.com
PING example.com (93.184.216.119) 56(84) bytes of data.
^C
--- example.com ping statistics ---
7 packets transmitted, 0 received, 100% packet loss, time 6741ms
[root@dbrepa ~]# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.108.0 * 255.255.255.0 U 0 0 0 eth0
link-local * 255.255.0.0 U 1002 0 0 eth0
default dc-108a.cool.do 0.0.0.0 UG 0 0 0 eth0
dev-108a
is a server on our network, and as you can see I can speak to it with no issues.
However, for example.com
, I can retrieve the IP address from the DNS for example.com
, in my case 93.184.216.119
, but then ping
just hangs.
It's still working---it's still sending out packets, but none of them will get replies and this process will continue until kill.
As per the comments, I've brought the local firewall down (with service iptables stop
) to no effect.
What could be going wrong? How am I getting an IP address while not able to access it?
I know that I am missing several core UNIX tools; I am at least missing:
man
dig
traceroute
telnet
wget
'What could be going wrong? How am I getting an IP address while not able to access it?"
You are getting IP address because your computer can successfully reach the DNS server which your computer was instructed to use.
To make sure you can communicate to the outside of the network you need to make sure you have correct network settings including IP address, subnet mask and router.
If there is firewall operating at the gateway you have to make sure your computer was granted access from inside the network to the outside.
If can provide output of the following commands it will be possible to debug it faster:
ifconfig -a
route
It happens often after a while und ubuntu 8.04 on my notebook in my wired LAN. After I couldn't find a reason in the logs I started a terminal and a ping. Reading my emails I recognized that the network is gone away and a look in my terminal-windows shows the follwing:
64 bytes from 192.168.134.1: icmp_seq=6036 ttl=64 time=1.61 ms
64 bytes from 192.168.134.1: icmp_seq=6037 ttl=64 time=0.222 ms
64 bytes from 192.168.134.1: icmp_seq=6038 ttl=64 time=0.406 ms
64 bytes from 192.168.134.1: icmp_seq=6039 ttl=64 time=0.226 ms
64 bytes from 192.168.134.1: icmp_seq=6040 ttl=64 time=0.216 ms
From 169.254.7.74 icmp_seq=6042 Destination Host Unreachable
From 169.254.7.74 icmp_seq=6043 Destination Host Unreachable
From 169.254.7.74 icmp_seq=6044 Destination Host Unreachable
From 169.254.7.74 icmp_seq=6046 Destination Host Unreachable
From 169.254.7.74 icmp_seq=6047 Destination Host Unreachable
Is there anybody who can give me a hint where to look to fix it?
Ah: Other PCs in my Network don't have this issue, the DHCP-Server is working fine.
Peace
Ice
When ping states 'Destination Host unreachable', that is a likely indication that the router could not forward the ICMP packet across to the specific host across the internet.
Simple steps to check:
ifconfig eth0
- checks to see if the network device is up and runningping 127.0.0.1
- checks to see if the tcp/ip stack is functioningping {your_routers_ip_address
- checks to see if the nic can transmit data to your router's ip address (by default, 192.168.1.1) - if it doesn't at this stage, then your nic could be faulty. If it works, then the issue is with the router...
If the NIC appears to be faulty, check the log by issuing this on the command line
less /var/log/messages If this fails, you need to use this instead: sudo less /var/log/messages then enter your password when prompted to do so.
and look for the specific keyword eth0
followed by the message on the same line - double check it. Maybe an update of the driver might be required or an incorrect configuration that causes your pc to drop connections.
If the issue is the router - there could be a fault on the line itself. As John mentioned - don't be surprised - even the simplest thing as a bad cable can mislead you. Swap the cable for a new one and repeat the steps above. If it still fails, the problem is on your computer's NIC.
Can you please confirm all of this first and let us know what driver you are using, make/manufacturer of the NIC, what kind of router etc..this will help us all in troubleshooting further.
Start with some basic network connectivity checks. If it's a cabled network my first guess would be a bad cable. Try another. If it's wireless you may be losing the signal.