I've a computer, C, a router R, and a raspberry pi, P. They are connected:
Internet <--ethernet--> R <--wlan--> P <--ethernet--> C
Now I want C to be able to access the internet.
The P has wlan0 and eth0, my first thought was to bridge eth0 and wlan0 but that is not possible due to the nature of wifi I've learned.
Next approach is to add a dhcp server to P and let C lease an IP number. It works fine and ip route
on C gives:
10.254.239.0/27 dev eth0 src 10.254.239.13
default via 10.254.239.10 dev eth0
and ifconfig on P gives
eth0 Link encap:Ethernet HWaddr b8:27:eb:44:bb:71 inet addr:10.254.239.10 Bcast:10.254.239.31 Mask:255.255.255.224 inet6 addr: fe80::3206:e7e:fb7e:23d5/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:569 errors:0 dropped:0 overruns:0 frame:0 TX packets:235 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:142936 (139.5 KiB) TX bytes:50384 (49.2 KiB) 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:19 errors:0 dropped:0 overruns:0 frame:0 TX packets:19 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1 RX bytes:1444 (1.4 KiB) TX bytes:1444 (1.4 KiB) wlan0 Link encap:Ethernet HWaddr b8:27:eb:11:ee:24 inet addr:192.168.0.106 Bcast:192.168.0.255 Mask:255.255.255.0 inet6 addr: fe80::2501:6a8:8bcf:4a40/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:5415 errors:0 dropped:4989 overruns:0 frame:0 TX packets:454 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:815495 (796.3 KiB) TX bytes:49230 (48.0 KiB)
C can ping P but not R, leaving me to believe that P has some routing error.
How can I configure P to pass traffic between R and C?
ip route
on P gives:
default via 192.168.0.1 dev wlan0 metric 303 10.254.239.0/27 dev eth0 proto kernel scope link src 10.254.239.10 192.168.0.0/24 dev wlan0 proto kernel scope link src 192.168.0.106 metric 303
Also on P
$ cat /proc/sys/net/ipv4/ip_forward 1