1

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 
kasperd
  • 30,455
  • 17
  • 76
  • 124
NeDark
  • 463
  • 1
  • 6
  • 10
  • It would be useful to include the output of `arp -n` and a packet capture showing the ARP requests. – kasperd Sep 18 '14 at 15:29
  • `I am trying to configure a host only interface (eth0) as the wan interface` - Why do you have a default route configured on the **host only** interface (eth0)? Have you confused your interface names in the question perhaps? Is eth0 the bridged interface and eth1 the host-only interface? Which subnet is supposed to be the **host-only** subnet? – Zoredache Sep 18 '14 at 17:25
  • @Zoradache No, the information is correct. Diagram: Bridged Ethernet (eth1 192.168.0.0/24) - Host only adapter (eth0 192.168.56.0/24) - Internet (Host machine). How would the VM reach internet without a default route? For more information, in the host machine packets from host only adaptor are forwarded to different usb wlan interfaces, which I cant attach because they freeze if they get accidentally disconnected (from cable or wireless network) and I have to restart VM to connect again. – NeDark Sep 19 '14 at 01:55

2 Answers2

0

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.

wurtel
  • 3,864
  • 12
  • 15
  • Updated. About two default routes - one is added by openwrt automatically but I added a permanent one because sometimes openwrt fails to add it. – NeDark Sep 18 '14 at 15:06
0

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.

NeDark
  • 463
  • 1
  • 6
  • 10