Star InactiveStar InactiveStar InactiveStar InactiveStar Inactive
 
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

*** Note ***

Comments are welcome. But in order to reject spam posts please consider following rules:
  1. Comments with string http are rejected with message You have no rights to use this tag
  2. All comments are reviewed by hand and thus it usually takes one day until a comment will be published.