Raspberry Pi runs with Raspian, a Debian compiled for ARM architecture. Pi has an ethernet adapter and usually also an USB WLAN adapter is attached in order to be able to access Pi wireless. Given this hardware you can use the Raspberry Pi as an ethernet to WLAN bridge and/or as an access point with a cable connection. The following article explains how to create an ethernet to WLAN bridge on Debian and Raspberry Pi running Raspbian but will work also on other Linux distributions.
  
Make sure your WLAN connection and ethernet connaction works when you start to configure the WLAN router. Then install the following package:
 
apt-get install dnsmasq
 
and disable autostart of dnsmasq
 
sudo update-rc.d dnsmasq disable
sudo service dnsmasq stop
 
Now adapt your file /etc/network/interfaces accordingly:
 

1) The WLAN net has following gateway 192.168.0.1 in net 192.168.0.0/24

2) Raspberry hast IP address192.168.0.10

3) The cable net uses net 192.168.3.0/24

4)  dhcp IP addresses are 192.168.3.10 to 192.168.3.20, which means there are only 11 clients which can connect over this connection.

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
address 192.168.3.1
netmask 255.255.255.0
gateway 192.168.0.1

allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf

iface default inet dhcp
post-up /sbin/iptables -A FORWARD -o wlan0 -i eth0 -s 192.168.3.0/24 -m conntrack --ctstate NEW -j ACCEPT
post-up /sbin/iptables -A FORWARD -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
post-up /sbin/iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
post-up /sbin/sysctl -w net.ipv4.ip_forward=1

post-up /usr/sbin/dnsmasq -i eth0 -I wlan0 -F 192.168.3.10,192.168.3.20,infinite 
 

If the device connected to the ethernet adapter changes from time to time ifplugd deactivates the WLAN interface. Therefore ifplugd has to be uninstalled with

apt-get remove ifplugd

 

 

Add comment

Spam Kommentare sind sinnlos !
Vor der Publizierung wird jeder Beitrag auf Spam geprüft. Leider dauert es deswegen bis ein Kommentar sichtbar wird. Dafür erhält aber kein Subscriber Spam eMails.
Die eMail ist optional und nicht öffentlich sichtbar. Sie ist notwendig um eMail Benachrichtigungen zu Antworten auf Kommentare zu erhalten. Sie wird auch u.U. auch vom Seitenbetreiber genutzt um offline Kontakt aufzunehmen.

Spam comments are useless !
Any comment will be reviewed first and checked for spam. Unfortunately this delays the publishing of comments but will protect subscribers from spam.
eMail is optional and hidden and is required to get update notifications for any comments. In addition your eMail may be used by the website owner to get in contact with you offline.


Comments   

0 #7 framp 2014-06-22 14:19
When you change the two lines which deal with the forwarding to

post-up /sbin/iptables -A FORWARD -i eth0 -j ACCEPT
post-up /sbin/iptables -A FORWARD -o eth0 -j ACCEPT

it should work.
Quote
0 #6 Wessix 2014-06-22 12:17
ok maybe my joy was to earky, seems the static route in the router makes it possible to reach the bridge pi in the 192.168.3.1 but not other pcs or rpi behind it in the second cable net for example 192.168.3.11. Do i have to add something to the bridging pis network conf? :-*
Quote
0 #5 Wessix 2014-06-22 10:27
thx framp it works that way, static route is easy to setup with my router. cool!
Quote
0 #4 framp 2014-06-21 21:50
I got your issue now. Yes, you are right. You need to define a static route. I suggest to define this route in your internet router is your default gateway for all your local clients. You have to look up the router doc how to define this static route.
As an alternative you have to define the static route on all clients you want to access the 3.0 subnet. The way how to configure this depends on the distro you use. There are a lot of pages out there in the net which explain how to configure this for the various distros.
Pls reply your distro you use if you don't get it configured correctly and I try to help you.
Quote
0 #3 Wessix 2014-06-21 15:35
my setup has other ip ranges but it is in principle the same. I have my normal wired network with the Range 192.168.5.0 then at the end of this there is an AP wich provides a wireless lan in the same ip range. Then i connected the raspberry pi with the method you described to that wireless and at the cable side of the raspberry there is the new subnet with the ip range 192.168.3.0, It works in the direction that clients in the 192.168.3.0 subnet have internet and stuff and in can ping clients in the 192.168.5.0 subnet. Thats nice thx for that, but if i want to connect for example via ssh or ftp from for example 192.168.5.90 wich is my pc in the primary cable subnet to another pc or raspberry or somewhat in the 192.168.3.0. cable subnet it does not work at the moment, it think i have to declare a static route or something for that too?
Quote
0 #2 framp 2014-06-15 21:19
Not sure I get your question. Please provide some more details.
Quote
0 #1 Wessix 2014-06-15 15:59
If i want to see pcs from the 192.168.0.1 subnet the ones from the 192.168.3.1 subnet what would i have to add?
Quote