Solved Can't ping across different subnet

Hi everyone,

I have installed freebsd FreeBSD 10.2-RELEASE, I can ping other machine and router in same subnet, but can't ping across different subnet, the routing is working fine, except this one with 10.2 version, does there have any configuration need to setup?

Any suggestion will be appreciated.
 
What's the output of netstat -rn? And are you able to ping your default gateway?
 
Here is the output
Code:
root@bk01:/home/stark # netstat -rn
Routing tables

Internet:
Destination        Gateway            Flags      Netif Expire
default            10.0.0.254         UGS         lo0
10.0.0.0/24        link#1             U           re0
10.0.0.87          link#2             UH          lo0
127.0.0.1          link#2             UH          lo0

I can ping my default gateway, but can not ping another interface 192.168.1.244/24 of default gateway.
And my default gateway can ping other 10.0.0.0/24 and 192.168.1.0/24, except this one.

Here is the ifconfig output:
Code:
root@bk01:/home/stark # ifconfig
re0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=8209b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,WOL_MAGIC,LINKSTATE>
        ether 14:dd:a9:51:98:13
        inet 10.0.0.87 netmask 0xffffff00 broadcast 10.0.0.255
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
        media: Ethernet autoselect (1000baseT <full-duplex>)
        status: active
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
        options=600003<RXCSUM,TXCSUM,RXCSUM_IPV6,TXCSUM_IPV6>
        inet6 ::1 prefixlen 128
        inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2
        inet 10.0.0.87 netmask 0xffffff00
        inet 127.0.0.1 netmask 0xff000000
        nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>

Here is the rc.conf:
Code:
hostname="bk01"
sshd_enable="YES"
# Set dumpdev to "AUTO" to enable crash dumps, "NO" to disable
dumpdev="NO"
ifconfig_re0="inet 10.0.0.87    netmask 255.255.255.0"
defaultrouter="10.0.0.254"
gateway_enable="YES"

If I ping 192.168.1.x , it always say TTL exceed, I can't figure out why.
Code:
root@bk01:/home/stark # ping 192.168.1.20
PING 192.168.1.20 (192.168.1.20): 56 data bytes
36 bytes from 10.0.0.87: Time to live exceeded
Vr HL TOS  Len   ID Flg  off TTL Pro  cks      Src      Dst
4  5  00 0054 66b4   0 0000  01  01 0000 10.0.0.87  192.168.1.20

36 bytes from 10.0.0.87: Time to live exceeded
Vr HL TOS  Len   ID Flg  off TTL Pro  cks      Src      Dst
4  5  00 0054 66b9   0 0000  01  01 0000 10.0.0.87  192.168.1.20

36 bytes from 10.0.0.87: Time to live exceeded
Vr HL TOS  Len   ID Flg  off TTL Pro  cks      Src      Dst
4  5  00 0054 66bd   0 0000  01  01 0000 10.0.0.87  192.168.1.20

36 bytes from 10.0.0.87: Time to live exceeded
Vr HL TOS  Len   ID Flg  off TTL Pro  cks      Src      Dst
4  5  00 0054 66c1   0 0000  01  01 0000 10.0.0.87  192.168.1.20

36 bytes from 10.0.0.87: Time to live exceeded
Vr HL TOS  Len   ID Flg  off TTL Pro  cks      Src      Dst
4  5  00 0054 66c5   0 0000  01  01 0000 10.0.0.87  192.168.1.20

The arp table also match
Code:
root@bk01:/home/stark # arp -a
? (10.0.0.254) at 00:0f:23:d5:55:40 on re0 expires in 1061 seconds [ethernet] ===>default gateway
? (10.0.0.55) at e0:3f:49:45:4f:bc on re0 expires in 1195 seconds [ethernet] ===>My windows pc
? (10.0.0.87) at 14:dd:a9:51:98:13 on re0 permanent [ethernet] ===> Freebsd 10.2 machine

Here is the output of default gateway:

Code:
LANGW#show interfaces fastEthernet 0/0
FastEthernet0/0 is up, line protocol is up
  Hardware is AmdFE, address is 000f.23d5.5540 (bia 000f.23d5.5540)
  Internet address is 10.0.0.254/24

LANGW#ping 10.0.0.87

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.0.0.87, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/4 ms

LANGW#ping 192.168.1.20

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.20, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/4 ms
 
...
I can ping my default gateway, but can not ping another interface 192.168.1.244/24 of default gateway.

If I ping 192.168.1.x , it always say TTL exceed, I can't figure out why.
Code:
root@bk01:/home/stark # ping 192.168.1.20
PING 192.168.1.20 (192.168.1.20): 56 data bytes
36 bytes from 10.0.0.87: Time to live exceeded
Vr HL TOS  Len   ID Flg  off TTL Pro  cks      Src      Dst
4  5  00 0054 66b4   0 0000  01  01 0000 10.0.0.87  192.168.1.20
What does traceroute 192.168.1.244 and traceroute 192.168.1.20to these two addresses say?
 
Code:
root@bk01:/home/stark # traceroute 192.168.1.244
traceroute: findsaddr: failed to connect to peer for src addr selection.
root@bk01:/home/stark # traceroute 192.168.1.20
traceroute: findsaddr: failed to connect to peer for src addr selection.
 
Remove the 10.0.0.87 address from lo0. The only (IPv4) address bound to lo0 should be 127.0.0.1.
 
No, it's either set in /etc/rc.conf or it was set by hand. Look in rc.conf and remove any ifconfig_lo0 and simply reboot.
 
Here is the output
Code:
root@bk01:/home/stark # netstat -rn
Routing tables

Internet:
Destination        Gateway            Flags      Netif Expire
default            10.0.0.254         UGS         lo0
10.0.0.0/24        link#1             U           re0
10.0.0.87          link#2             UH          lo0
127.0.0.1          link#2             UH          lo0

Remove the 10.0.0.87 address from lo0. The only (IPv4) address bound to lo0 should be 127.0.0.1.
The 10.0.0.87 host route looks normal to me. FreeBSD creates these automatically on boot and my router also has exactly 2 routes for each ethernet interface. One network route according to the configured netmask and an additional host route for the machines own IP address on that interface pointing to lo0. But something is still odd here. The 10.0.0.87 route has a different link# than the 10.0.0.0/24 route, which i have not seen before. Normally they have the same link# like here:
Code:
Internet:
Destination  Gateway  Flags  Netif Expire
10.6.2.0/24  link#8  U  wlan0
10.6.2.1  link#8  UHS  lo0
10.6.6.0/24  link#2  U  fxp0
10.6.6.1  link#2  UHS  lo0
127.0.0.1  link#5  UH  lo0
 
mickey His ifconfig output doesn't look right though. He shouldn't have a 10 address listed under lo0.
That's probably the reason then why it says link#2 where it should read link#1. But I did not see any ifconfig_lo0 in the rc.conf posted, unless it's in the part not posted ;)
 
How to remove IP address from lo0, is there have any config file about lo0?
No there's no other config file. Are you sure you didn't add this manually either accidentally for through having a jail try to use it? Do ifconfig lo0 inet 10.0.0.87 -alias and post the output from the traceroute(8) commands afterwards.
 
No there's no other config file. Are you sure you didn't add this manually either accidentally for through having a jail try to use it? Do ifconfig lo0 inet 10.0.0.87 -alias and post the output from the traceroute(8) commands afterwards.
After I using ifconfig <interface name> down delete and reboot, the lo0 interface is only with 127.0.0.1.
And I can ping other machine with 192.168.1.0/24, the network is working fine. thanks everybody's suggestion.:)
I think the previous fail is because of the routing metric, normally loopback interface having the lowest metric, and I don't notice my lo0 having 10.0.0.87/24.
So, the packet is sent from lo0, but there is no way out to exit lo0.
Hers is the output of traceroute, it is working fine:
Code:
root@bk01:/usr/home/stark # ifconfig
re0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=8209b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,WOL_MAGIC,LINKSTATE>
        ether 14:dd:a9:51:98:13
        inet 10.0.0.87 netmask 0xffffff00 broadcast 10.0.0.255
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
        media: Ethernet autoselect (1000baseT <full-duplex>)
        status: active
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
        options=600003<RXCSUM,TXCSUM,RXCSUM_IPV6,TXCSUM_IPV6>
        inet6 ::1 prefixlen 128
        inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2
        inet 127.0.0.1 netmask 0xff000000
        nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
root@bk01:/usr/home/stark # traceroute
traceroute  traceroute6
root@bk01:/usr/home/stark # traceroute 192.168.1.20
traceroute to 192.168.1.20 (192.168.1.20), 64 hops max, 40 byte packets
1  10.0.0.254 (10.0.0.254)  0.730 ms  0.674 ms  0.797 ms
2  192.168.1.20 (192.168.1.20)  0.341 ms  0.416 ms  0.565 ms
 
Back
Top