Hello all,
I am new to raspberry pi. I have successfully made an access point to bridge wlan0 to eth0, following adafruit guide. I would however like to make a wireless bridge but I need a for dummies guide. I use the basic debian OS. I want to put a hub on eth0 and forward all packets to wlan0 to connect to my home router with WPA2 wireless b/g/n BT Hub.
win7+--------------+|H| | | )))))))))))) (((((((((((( | |
Ubuntu+----------+ |U|+----+[raspberrypi] [wireless bridge] [ROUTER]
printer1+---------+ |B|
Any help would be great,
Cheers
Raspberry pi Wireless Bridge
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- adafruit_support_mike
- Posts: 67454
- Joined: Thu Feb 11, 2010 2:51 pm
Re: Raspberry pi Wireless Bridge
The process would be pretty much the same as in our wireless router tutorial (http://learn.adafruit.com/setting-up-a- ... cess-point), but you'd reverse wlan0 and eth0 in the NAT tables. Instead of routing connections from wlan0 to eth0, you'd send connections from eth0 to wlan0.
-
- Posts: 14
- Joined: Tue May 22, 2012 8:19 am
Re: Raspberry pi Wireless Bridge
iv caught this post a little late. I got distracted by the arduino. Ill follow this tommoz and post the process I go through encase I get any issues.
-
- Posts: 14
- Joined: Tue May 22, 2012 8:19 am
Re: Raspberry pi Wireless Bridge
Ok so I downloaded the pdf and from what I understand these are the steps I will take:
I will set up Wlan0 to connect to my home router.
Step1: Get Software
sudo apt-get install hostapd isc-dhcp-server
sudo apt-get update
Step2:Set Up DHCP Sever
sudo nano /etc/dhcp/dhcpd.conf
Find the lines that say:
Find the lines that say:
Then scroll down to the bottom and add the following lines
Step3: Set the DHCP interface to receive ip address
Run:
sudo nano /etc/default/isc-dhcp-server
edit line to:
INTERFACES="eth0"
Step4: Set up eth0 for static IP
Run:
sudo ifdown eth0
Then we set the eth0 connection to be static for incoming, we run:
sudo nano
/etc/network/interfaces
The config file is edit to:
sudo ifconfig eth0 192.168.42.1
Step5: NAT
run:
sudo nano /etc/sysctl.conf
scroll to the bottom and add:
save and exit, then start ip forwarding on boot:
sudo sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward"
Create a NAT between wlan0 and eth0:
sudo iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
sudo iptables -A FORWARD -i wlan0 -o eth00 -m state --state RELATED,ESTABLISHED -j ACCEPT
sudo iptables -A FORWARD -i eth00 -o wlan0 -j ACCEPT
check to see whats in the tables wit:
sudo iptables -t nat -S
sudo iptables -S
sudo nano /etc/network/interfaces
then add at the bottom:
Step6: finishing up
sudo service isc-dhcp-server start
I will then plug eth0 into hub and Ubuntu pc into hub and try to connect to website?
Thanx can anyone tell me if this is the right process?
Cheers
I will set up Wlan0 to connect to my home router.
Step1: Get Software
sudo apt-get install hostapd isc-dhcp-server
sudo apt-get update
Step2:Set Up DHCP Sever
sudo nano /etc/dhcp/dhcpd.conf
Find the lines that say:
and change them to add a # in the beginning so they say:option domain-name "example.org";
option domain-name-servers ns1.example.org, ns2.example.org;
Code: Select all
#option domain-name "example.org";
#option domain-name-servers ns1.example.org, ns2.example.org;
and remove the # so it says# If this DHCP server is the official DHCP server for the local
# network, the authoritative directive should be uncommented.
#authoritative;
Code: Select all
# If this DHCP server is the official DHCP server for the local
# network, the authoritative directive should be uncommented.
authoritative;
Code: Select all
subnet 192.168.42.0 netmask 255.255.255.0 {
range 192.168.42.10 192.168.42.50;
option broadcast-address 192.168.42.255;
option routers 192.168.42.1;
default-lease-time 600;
max-lease-time 7200;
option domain-name "local";
option domain-name-servers 8.8.8.8, 8.8.4.4;
}
Run:
sudo nano /etc/default/isc-dhcp-server
edit line to:
INTERFACES="eth0"
Step4: Set up eth0 for static IP
Run:
sudo ifdown eth0
Then we set the eth0 connection to be static for incoming, we run:
sudo nano
/etc/network/interfaces
The config file is edit to:
Code: Select all
auto lo
iface lo inet loopback
iface wlan0 inet dhcp
allow hotplug eth0
iface eth0 inet static
address 192.168.42.1
netmask 255.255.255.0
i will then assign a static ip to eth0:Then crtl and ctrl y to save
sudo ifconfig eth0 192.168.42.1
Step5: NAT
run:
sudo nano /etc/sysctl.conf
scroll to the bottom and add:
Code: Select all
net.ipv4.ip_forward=1
sudo sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward"
Create a NAT between wlan0 and eth0:
sudo iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
sudo iptables -A FORWARD -i wlan0 -o eth00 -m state --state RELATED,ESTABLISHED -j ACCEPT
sudo iptables -A FORWARD -i eth00 -o wlan0 -j ACCEPT
check to see whats in the tables wit:
sudo iptables -t nat -S
sudo iptables -S
sudo sh -c "iptables-save > /etc/iptables.ipv4.nat"To make this happen on reboot (so you don't have to type it every time) run
sudo nano /etc/network/interfaces
then add at the bottom:
Code: Select all
up iptables-restore < /etc/iptables.ipv4.nat
sudo service isc-dhcp-server start
I will then plug eth0 into hub and Ubuntu pc into hub and try to connect to website?
Thanx can anyone tell me if this is the right process?
Cheers
- adafruit_support_mike
- Posts: 67454
- Joined: Thu Feb 11, 2010 2:51 pm
Re: Raspberry pi Wireless Bridge
That looks right.
Check it each step of the way to make the pieces respond as they should before moving on to the next service.. get your IP addresses set correctly, then set up the DHCP server and make sure it hands out addresses to the machines connected through the Ethernet interface, get your WAP connection working, then bring in the address translation.
Your overall research looks very good though.
Check it each step of the way to make the pieces respond as they should before moving on to the next service.. get your IP addresses set correctly, then set up the DHCP server and make sure it hands out addresses to the machines connected through the Ethernet interface, get your WAP connection working, then bring in the address translation.
Your overall research looks very good though.
-
- Posts: 14
- Joined: Tue May 22, 2012 8:19 am
Re: Raspberry pi Wireless Bridge
yes it works I can ping 192.168.42.1 and my home bt router 192.168.1.254 however google is a no go. I can connect to google using the raspberry pi. However the WAP gets the ip address of 192.168.1.75 but my bt home hub packets come back so im thinking maybe my raspberry pi has to be forwarded to let my Ubuntu pc access the internet using a browser. Any ideas?
- adafruit_support_mike
- Posts: 67454
- Joined: Thu Feb 11, 2010 2:51 pm
Re: Raspberry pi Wireless Bridge
Actually, I think I see a typo in your IP forwarding rules: you have '-i eth00' up above, and the interface name is 'eth0'.
Try changing that.
Try changing that.
-
- Posts: 14
- Joined: Tue May 22, 2012 8:19 am
Re: Raspberry pi Wireless Bridge
yup I changed the typo's as I went along. I can connect to my router so it forwards, but beyond that it does not connect to the internet.
- adafruit_support_mike
- Posts: 67454
- Joined: Thu Feb 11, 2010 2:51 pm
Re: Raspberry pi Wireless Bridge
When you say "connect to the router", do you mean the RasPi can reach it, or machines with an Ethernet connection to the RasPi can reach it?
-
- Posts: 14
- Joined: Tue May 22, 2012 8:19 am
Re: Raspberry pi Wireless Bridge
I started of with a wifi connection using the gui to the router.
- adafruit_support_mike
- Posts: 67454
- Joined: Thu Feb 11, 2010 2:51 pm
Re: Raspberry pi Wireless Bridge
Can you ping the router from a machine connected to the RasPi?
-
- Posts: 14
- Joined: Tue May 22, 2012 8:19 am
Re: Raspberry pi Wireless Bridge
yes I can
-
- Posts: 14
- Joined: Tue May 22, 2012 8:19 am
Re: Raspberry pi Wireless Bridge
now I have rebooted the pi and Ubuntu pc they have no connx to eachother or router. The wpa_gui will not let me connect wirelessly to my router. Why is this so complicated. Setting it up as a bridge to wlan0 to eth0 worked straight away. This seems to BANNED-up.
- adafruit_support_mike
- Posts: 67454
- Joined: Thu Feb 11, 2010 2:51 pm
Re: Raspberry pi Wireless Bridge
It isn't so bad once you get used to it, but a distributed communications medium that spans the globe has lots of moving pieces.
Start by checking your interfaces (`ifconfig -a`), IP forwarding (`sysctl net.ipv4.ip_forward`) and DHCP server (`ps ax | grep dhcp`)
Start by checking your interfaces (`ifconfig -a`), IP forwarding (`sysctl net.ipv4.ip_forward`) and DHCP server (`ps ax | grep dhcp`)
-
- Posts: 14
- Joined: Tue May 22, 2012 8:19 am
Re: Raspberry pi Wireless Bridge
ugh I can only get this going as an AP. Really miffed. Might try using it for something else.
Please be positive and constructive with your questions and comments.