Raspberry Pi as a Hotspot: Difference between revisions
No edit summary |
|||
(2 intermediate revisions by the same user not shown) | |||
Line 99: | Line 99: | ||
= NAT = | = NAT = | ||
In my config I have not configured port forwarding and NAT. For my application here I am using the Raspberry Pi with SMB shares so the kids can access TV shows and movies from their | In my config I have not configured port forwarding and NAT. For my application here I am using the Raspberry Pi with SMB shares so the kids can access TV shows and movies from their Android devices in the car so NAT is not required. | ||
== forwarding == | == forwarding == | ||
Line 123: | Line 123: | ||
iptables -A FORWARD -i wlan0 -o eth0 -j ACCEPT | iptables -A FORWARD -i wlan0 -o eth0 -j ACCEPT | ||
</pre> | </pre> | ||
Refer to [[Iptables#Automatic_Load_on_Restart | iptables]] for automatic load on boot. | |||
= reboot = | |||
Lastly reboot and all hopefully will be good. | |||
[[Category : Raspberry Pi]] [[Category : Linux]] | [[Category : Raspberry Pi]] [[Category : Linux]] |
Latest revision as of 11:28, 6 January 2015
configure wlan
Assign an IP address to NIC
vi /etc/network/interfaces
add
auto wlan0
Remark the following lines so the wlan never acts as a client
#allow-hotplug wlan0 #wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf #iface default inet manual
Assin an IP address to wlan0
iface wlan0 inet static address 10.11.12.1 netmask 255.255.255.0 wireless-mode Master
dhcp
Setup DHCP Scope. More information can be found at DHCP_for_Linux
apt-get install isc-dhcp-server
vi /etc/dhcp/dhcpd.conf
The following is based on your requirements.
# option definitions common to all supported networks... #option domain-name "example.org"; #option domain-name-servers ns1.example.org, ns2.example.org;
subnet 10.11.12.0 netmask 255.255.255.0 { range 10.11.12.101 10.11.12.120; option broadcast-address 10.11.12.255; option routers 10.11.12.13; option domain-name-servers 8.8.8.8, 8.8.4.4; }
vi /etc/dhcp/dhcpd.conf
Bind DHCP to wlan interface
vi /etc/default/isc-dhcp-server
Change
INTERFACES=""
to
INTERFACES="wlan0"
hostapd
As I have the RTL8188CUS wireless chipset I needed to download a specific version of the hostapd application. Other wireless network cards you could try using the distro package
apt-get install hostapd
otherwise
cd /usr/src wget https://github.com/jenssegers/RTL8188-hostapd/archive/master.zip unzip master.zip cd RTL8188-hostapd-master/hostapd/ make make install
vi /etc/hostapd/hostapd.conf
Configure the following paramaters as required
ssid= channel= wpa_passphrase=
NAT
In my config I have not configured port forwarding and NAT. For my application here I am using the Raspberry Pi with SMB shares so the kids can access TV shows and movies from their Android devices in the car so NAT is not required.
forwarding
vi /etc/sysctl.conf
change
#net.ipv4.ip_forward=1
to be
net.ipv4.ip_forward=1
iptables
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE iptables -A FORWARD -i eth0 -o wlan0 -m state --state RELATED,ESTABLISHED -j ACCEPT iptables -A FORWARD -i wlan0 -o eth0 -j ACCEPT
Refer to iptables for automatic load on boot.
reboot
Lastly reboot and all hopefully will be good.