I am using a virtual machine with OpenWRT for routing, on a Linux machine (Slackware). I am trying to configure a host only interface (eth0) as the wan interface. eth1 is Ethernet attached as a bridge interface.
I tried to test the configuration pinging to an external ip address (from OpenWRT).
# ping -I eth0 8.8.8.8
PING 8.8.8.8 (8.8.8.8): 56 data bytes
^C
--- 8.8.8.8 ping statistics ---
6 packets transmitted, 0 packets received, 100% packet loss
I used wireshark and i saw the system (OpenWRT side) is sending ARP request asking for the mac address of 8.8.8.8. What is going on? It looks that the gateway is being ignored.
My route:
# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default 192.168.56.1 0.0.0.0 UG 1 0 0 eth0
default 192.168.56.1 0.0.0.0 UG 5 0 0 eth0
192.168.0.0 * 255.255.255.0 U 0 0 0 eth1
192.168.56.0 * 255.255.255.0 U 5 0 0 eth0
Iptables is configure to accept all packets for input, output and forward.
More tests:
# ping -I eth0 192.168.56.1
PING 192.168.56.1 (192.168.56.1): 56 data bytes
64 bytes from 192.168.56.1: seq=0 ttl=64 time=10.000 ms
64 bytes from 192.168.56.1: seq=1 ttl=64 time=0.000 ms
64 bytes from 192.168.56.1: seq=2 ttl=64 time=0.000 ms
64 bytes from 192.168.56.1: seq=3 ttl=64 time=0.000 ms
^C
--- 192.168.56.1 ping statistics ---
4 packets transmitted, 4 packets received, 0% packet loss
round-trip min/avg/max = 0.000/2.500/10.000 ms
.
# ip route show
default via 192.168.56.1 dev eth0 proto static metric 1
default via 192.168.56.1 dev eth0 proto static metric 5
192.168.0.0/24 dev eth1 proto kernel scope link src 192.168.0.1
192.168.56.0/24 dev eth0 proto static scope link metric 5
You probably have your default route set to the device and not to your gateway IP. Check
ip route show
for a default line without a "via IP" part.EDIT: sorry, I now see your route output. However,
ip route show
is more helpful as there are routing details that can't be shown by the route command. Also it's strange that there are apparently 2 default routes that are the same, hopefully ip will show the difference.Tried to reinstall OpenWRT on the virtual machine but didnt solve the problem.
After some configurations on the host machine (routes and iptables) the problem disappeared. I'm sad I couldnt identify the exact cause for this problem. It looks there was a loop (packet send by router was received again by the router) because a misconfiguration on the host machine and that was causing the problem somehow.
I'll edit this answer if it happens again and I get more details.