# ping failed but tcpdump captured echo request/reply packets



## aldebran (Jan 16, 2009)

hi, 
  I'm configuring a network card on freebsd 7.0 which is
  intalled on a laptop(Tinkpad T61) and encounter a problem.

  My card is em0, media is 100baseTX(full-duplex). I
  use the following command to assign an ipv4 adrress
          # ifconfig em0 192.168.10.221/24

  After ifconfig, I ping the gateway 192.168.10.1, but ping
  replied with no answers. I use tcpdump to capture the 
  packets, and do see the gateway 192.168.10.1 replies.
  The route table is also right.
           Destination        Gateway            interface
           192.168.10.0/24    link#1              em0

  Why the ping failed? Has anyone encoutered this problem
  before and could you share your solution with me?


----------



## DutchDaemon (Jan 16, 2009)

Try 


```
route add default gw 192.168.10.1
```

to make sure.

The output of [font="Lucida Console"]netstat -rn[/font] should really show [font="Lucida Console"]default 192.168.10.1[/font] on the first line.


----------



## aldebran (Jan 16, 2009)

Thanks.  This problem is due to the gateway. 

When the gateway send ICMP echo-replies,
it use an old MAC address. The tcpdump can capture the ICMP echo request/reply packets because the NIC has been put into promiscuous mode. However, the NIC now has a new MAC address, and it will not deliver
the packets with the old MAC address to the IP layer. The consequence is
that: ping failed but tcpdump captured echo request/reply packets.

I'm ashamed that when capturing packets I usually don't turn on the -e
option. After pondering for a long while, I guessed out the above cause.
I'm so sorry for wasting your valuable time.


----------



## honk (Jan 16, 2009)

I guess the ping should work as long as tcpdump is running.


----------

