1

My raspberry pi is connected via Ethernet to my Ubuntu 14.04 machine (192.168.1.0/24 on eth0).
This machine is connected to the Internet through a Fritz Box WLAN Router (192.168.0.0/24 on wlan0).

The network topology diagram:

enter image description here

To have internet access on my raspberry, I've successfully enabled IP forwarding (net.ipv4.ip_forward) on the Ubuntu machine and configured it's eth0 IP 192.168.1.1 as default gateway on the raspberry. On the Fritz Box I registered the subnet by adding a static IP route to 192.168.1.0/24 through the gateway 192.168.0.2 (see http://en.avm.de/nc/service/fritzbox/fritzbox-7390/knowledge-base/publication/show/581_Configuring-a-static-IP-route-in-the-FRITZ-Box/). The Fritz Box runs a DHCP server, but it's configured to give always the same IP to my Ubuntu server.

From the Ubuntu machine and the raspberry I'm able to ping and access everything (Internet, Laptop, Fritz Box). But from the laptop and other devices in the WLAN I'm not able to access the raspberry.

The routing table on the raspberry:

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.1.1     0.0.0.0         UG    0      0        0 eth0
192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0

The routing table on the Ubuntu machine:

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.0.1     0.0.0.0         UG    0      0        0 wlan0
192.168.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

The routing table on the laptop (and other WLAN clients):

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.0.1     0.0.0.0         UG    1024   0        0 wlp2s0
192.168.0.0     0.0.0.0         255.255.255.0   U     0      0        0 wlp2s0
192.168.0.0     0.0.0.0         255.255.255.0   U     303    0        0 wlp2s0

A tracepath 192.168.1.2 (the raspberry) from the laptop returns:

 1?: [LOCALHOST]                                         pmtu 1500
 1:  192.168.0.2                                           5.174ms 
 1:  192.168.0.2                                           4.743ms 
 2:  no reply
 3:  no reply
 4:  no reply
^C

while a ping 192.168.1.1 (the Ubuntu server on eth0) works just fine:

PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data.
64 bytes from 192.168.1.1: icmp_seq=1 ttl=64 time=2.72 ms
64 bytes from 192.168.1.1: icmp_seq=2 ttl=64 time=3.72 ms
64 bytes from 192.168.1.1: icmp_seq=3 ttl=64 time=3.54 ms

--- 192.168.1.1 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2004ms
rtt min/avg/max/mdev = 2.724/3.329/3.720/0.439 ms

So it actually goes the right way, but it stucks on the Ubuntu machine.

I've already tried configuring NAT rules, but in my opinion they shouldn't be necessary since the iptables are configured to allow everything (a blocking firewall runs already on the Fritz box) and IP forwarding is enabled. I even tried enabling proxy_arp on both interfaces without success.

Furthermore I found the tool parprouted for bridging wlan0 and eth0, but running it gave me invalid ARP responses (two MAC addresses for the raspberry IP address) - traced with Wireshark.

Why can't I access my raspberry from the WLAN network?

  • According to this answer, i disabled network-manager entirely and manually added the interface configurations to /etc/network/interfaces. But still the same... – Florian Mahlknecht Dec 21 '14 at 7:43
1

Have you already solved your problem??

Try this route on your ubuntu machine:

192.168.1.0     192.168.1.1     255.255.255.0   U     1      0        0 eth0

instead of

192.168.1.0     0.0.0.0         255.255.255.0   U     1      0        0 eth0

I think you may have a route loop on that machine... ;)

Best,

JB

  • if it doesen't fix your problem try also this rule (append it to the previous): route add -net 192.168.1.1 netmask 255.255.255.255 eth0 – Joao Brito Mar 16 '15 at 23:59
  • This worked, thank you! First, as a work arround, I forwarded the ports I needed from the ubuntu machine to raspberry, but now it works great! – Florian Mahlknecht Mar 29 '15 at 19:42
0

This should set up port-forwarding on your box, though you may just have to use iptables.

echo 1 > /proc/sys/net/ipv4/ip_forward

  • I've already enabled ip forwarding, from the raspberry i can access the internet and WLAN network, so this definitely works. The forwarding chain in the iptables configuration is set to the policy ACCEPT, so it should work without rules, if I am not mistaken – Florian Mahlknecht Dec 20 '14 at 21:39
  • Yes, but are you sure you've enabled it both ways? – argarevarg Dec 20 '14 at 21:40
  • Where else can I enable it? I thought /proc/sys/net/ipv4/ip_forward works regardless of the interface? – Florian Mahlknecht Dec 20 '14 at 21:43
  • That's a good point. I thought you said you enabled it elsewhere. This is the extent of my knowledge from network sniffing. – argarevarg Dec 20 '14 at 21:46
  • 1
    As far as I know ip_forward is a kernel parameter that can be enabled/disabled in more ways, e.g. through the virtual /proc folder. link. But enabled once, it should just route between different network interfaces... But thank you anyway! – Florian Mahlknecht Dec 20 '14 at 21:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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