1

I'm currently connected with wifi (wlan0) and with my Ethernet cable plugged (eth0). The following command

ping -I eth0 www.google.com

has no packets loss, but pinging with eth0

ping -I wlan0 www.google.com

returns Host Unreachable.

If I run route add default gw 10.0.0.1 wlan0, pinging on wlan0 is working but pinging on eth0 fails with no message displayed.

Here's some of my configurations:

:~$ lsb_release -a
Distributor ID: Ubuntu
Description:    Ubuntu 14.04.2 LTS
Release:    14.04
Codename:   trusty

:~$ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.1.254   0.0.0.0         UG    0      0        0 eth0
10.0.0.0        0.0.0.0         255.255.255.0   U     9      0        0 wlan0
192.168.1.0     0.0.0.0         255.255.255.0   U     1      0        0 eth0

 :~$ ifconfig
 eth0      Link encap:Ethernet  HWaddr 74:d0:2b:07:3a:dd  
           inet addr:192.168.1.129  Bcast:192.168.1.255  Mask:255.255.255.0
           inet6 addr: fe80::76d0:2bff:fe07:3add/64 Scope:Link
           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
           RX packets:33194 errors:0 dropped:0 overruns:0 frame:0
           TX packets:23759 errors:0 dropped:0 overruns:0 carrier:0
           collisions:0 txqueuelen:1000
           RX bytes:31065847 (31.0 MB)  TX bytes:3057118 (3.0 MB)

 lo        Link encap:Local Loopback  
           inet addr:127.0.0.1  Mask:255.0.0.0
           inet6 addr: ::1/128 Scope:Host
           UP LOOPBACK RUNNING  MTU:65536  Metric:1
           RX packets:21018 errors:0 dropped:0 overruns:0 frame:0
           TX packets:21018 errors:0 dropped:0 overruns:0 carrier:0
           collisions:0 txqueuelen:0
           RX bytes:10519343 (10.5 MB)  TX bytes:10519343 (10.5 MB)

 wlan0     Link encap:Ethernet  HWaddr 6c:71:d9:5f:6b:7f  
           inet addr:10.0.0.6  Bcast:10.0.0.255  Mask:255.255.255.0
           inet6 addr: fe80::6e71:d9ff:fe5f:6b7f/64 Scope:Link
           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
           RX packets:34286 errors:0 dropped:0 overruns:0 frame:0
           TX packets:26667 errors:0 dropped:0 overruns:0 carrier:0
           collisions:0 txqueuelen:1000
           RX bytes:25986919 (25.9 MB)  TX bytes:3409031 (3.4 MB)

1 Answer 1

0

Yeah, this is right. When you ping from an interface, it still follows the routing, it just uses the interface IP address as the source.

So when your default route is via 192.168.1.254 and you ping from 10.0.0.6, you are sending a packet to 192.168.1.254 with source address 10.0.0.6.

Exactly what happens next depends on the router, but clearly it is not going to be happy.

Your best bet would be to flatten your network. You have two subnets running, and unless this was intentional, I would disable DHCP on the wireless AP, then connect the AP to the main router by LAN port to LAN port. That way, both interfaces get a 10.0.0.x address, and everything will just work.

4
  • I followed your advice, now I have 10.0.0.x on both the interfaces, but anything changed: ping always fails.
    – elmazzun
    Nov 7, 2015 at 12:59
  • This is because the ping command from the first interface is waiting for the request, and the other interface receives it. The other interface ignores it as it didn't send it, and the first one says it never got a reply, so the destination must be down.
    – LPChip
    Nov 7, 2015 at 13:25
  • And how can I solve this?
    – elmazzun
    Nov 7, 2015 at 13:36
  • It should work, as the ping comes from the network stack. The reply should come back to the originating interface provided your LAN and wifi are bridged. Is there a firewall involved?
    – Paul
    Nov 7, 2015 at 21:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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