Raspberry Pi/Wifi Access Point: Difference between revisions
(Die Seite wurde neu angelegt: „* install <blockquote> <pre> apt-get install hostapd dnsmasq </pre> </blockquote> * /etc/hostapt/hostapd.conf <blockquote> <pre> interface=wlan0 driver=nl80…“) |
No edit summary |
||
(5 intermediate revisions by the same user not shown) | |||
Line 6: | Line 6: | ||
</blockquote> | </blockquote> | ||
* /etc/network/interfaces | |||
<blockquote> | |||
<pre> | |||
allow-hotplug wlan0 | |||
#iface wlan0 inet manual | |||
# wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf | |||
iface wlan0 inet static | |||
address 192.168.99.1 | |||
netmask 255.255.255.0 | |||
</pre> | |||
</blockquote> | |||
* /etc/network/if-pre-up.d/iptables (755) | |||
<blockquote> | |||
<pre> | |||
#!/bin/sh | |||
/sbin/iptables-restore /etc/iptables.ipv4.nat | |||
</pre> | |||
</blockquote> | |||
* /etc/ | * /etc/default/hostapd | ||
<blockquote> | |||
<pre> | |||
DAEMON_CONF="/etc/hostapd/hostapd.conf" | |||
</pre> | |||
</blockquote> | |||
* /etc/hostapd/hostapd.conf | |||
<blockquote> | <blockquote> | ||
<pre> | <pre> | ||
Line 38: | Line 64: | ||
bogus-priv | bogus-priv | ||
dhcp-range=192.168.99.50,192.168.99.100,255.255.255.0,12h | dhcp-range=192.168.99.50,192.168.99.100,255.255.255.0,12h | ||
</pre> | |||
</blockquote> | |||
* iptables | |||
<blockquote> | |||
<pre> | |||
sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE | |||
sudo iptables -A FORWARD -i eth0 -o wlan0 -m state --state RELATED,ESTABLISHED -j ACCEPT | |||
sudo iptables -A FORWARD -i wlan0 -o eth0 -j ACCEPT | |||
sudo iptables-save > /etc/iptables.ipv4.nat | |||
</pre> | </pre> | ||
</blockquote> | </blockquote> |
Latest revision as of 18:24, 14 April 2016
- install
apt-get install hostapd dnsmasq
- /etc/network/interfaces
allow-hotplug wlan0 #iface wlan0 inet manual # wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf iface wlan0 inet static address 192.168.99.1 netmask 255.255.255.0
- /etc/network/if-pre-up.d/iptables (755)
#!/bin/sh /sbin/iptables-restore /etc/iptables.ipv4.nat
- /etc/default/hostapd
DAEMON_CONF="/etc/hostapd/hostapd.conf"
- /etc/hostapd/hostapd.conf
interface=wlan0 driver=nl80211 ssid=SSID hw_mode=g channel=6 ieee80211n=1 wmm_enabled=1 macaddr_acl=0 auth_algs=1 ignore_broadcast_ssid=0 wpa=2 wpa_key_mgmt=WPA-PSK wpa_passphrase=PASSWORD rsn_pairwise=CCMP
- /etc/dnsmasq.d/dnsmasq.conf
interface=wlan0 bind-interfaces server=8.8.8.8 domain-needed bogus-priv dhcp-range=192.168.99.50,192.168.99.100,255.255.255.0,12h
- iptables
sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE sudo iptables -A FORWARD -i eth0 -o wlan0 -m state --state RELATED,ESTABLISHED -j ACCEPT sudo iptables -A FORWARD -i wlan0 -o eth0 -j ACCEPT sudo iptables-save > /etc/iptables.ipv4.nat