Thread: Bridging wifi
View Single Post
Halftux's Avatar
Posts: 878 | Thanked: 2,535 times | Joined on Feb 2012 @ Germany
#6
I hope I did understand you right.

Here a small example that it looks like your rasperry pi is connected to the wlan:

Requirements:
N900 with iptables (powerkernel)

Assuming your networks are:

Wlan 192.168.1.x
USB 192.168.2.x

PC in wlan network 192.168.1.10
N900 in wlan 192.168.1.14 and usblan 192.168.2.15
raspberry pi (RPI) in usblan 192.168.2.14

PC
Code:
route add -net 192.168.2.0 netmask 255.255.255.0 gw 192.168.1.14 dev wlan0
N900
Code:
route delete default

iptables -t nat -A PREROUTING -s 192.168.1.0/16 -i wlan0 -j DNAT --to-destination 192.168.2.15

iptables -t nat -A PREROUTING -s 192.168.2.0/16 -i usb0 -j DNAT --to-destination 192.168.1.14
When you want to use only the local lan (no internet), you don't need the iptable rules. Instead you can activate forwarding:
echo 1 > /proc/sys/net/ipv4/ip_forwarding


RPI
Code:
route add default gw 192.168.2.15 dev usb0
When you need internet don't forget to add a DNS.

Last edited by Halftux; 2013-07-17 at 18:35. Reason: IP digit error
 

The Following 2 Users Say Thank You to Halftux For This Useful Post: