檢視 Application - Wifi AP 的原始碼
←
Application - Wifi AP
前往:
導覽
、
搜尋
由於下列原因,您沒有權限進行 編輯此頁面 的動作:
您請求的操作只有這個群組的使用者能使用:
使用者
您可以檢視並複製此頁面的原始碼。
[[File:DSC 2515.JPG|thumb|350px|Wifi AP with GPS]] == USB wifi dongle == ID 148f:3572 Ralink Technology, Corp. RT3572 Wireless Adapter == Software == sudo apt-get install hostapd udhcpd === dhcp server === *Edit the file /etc/udhcpd.conf and configure it like this: <pre> start 192.168.42.2 # This is the range of IPs that the hostspot will give to client devices. end 192.168.42.20 interface wlan0 # The device uDHCP listens on. remaining yes opt dns 8.8.8.8 4.2.2.2 # The DNS servers client devices will use. opt subnet 255.255.255.0 opt router 192.168.42.1 # The Pi's IP address on wlan0 which we will set up shortly. opt lease 864000 # 10 day DHCP lease time in seconds </pre> *Edit the file /etc/default/udhcpd and change the line: <pre> DHCPD_ENABLED="no" to #DHCPD_ENABLED="no" </pre> === Hostapd === *edit the file /etc/hostapd/hostapd.conf <pre> interface=wlan0 driver=nl80211 ssid=My_AP hw_mode=g channel=6 macaddr_acl=0 auth_algs=1 ignore_broadcast_ssid=0 wpa=2 wpa_passphrase=My_Passphrase wpa_key_mgmt=WPA-PSK wpa_pairwise=TKIP rsn_pairwise=CCMP </pre> *Edit the file /etc/default/hostapd <pre> #DAEMON_CONF="" to: DAEMON_CONF="/etc/hostapd/hostapd.conf" </pre> === Configure NAT (Network Address Translation) === * fordwarding sudo sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward" * iptables <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 sh -c "iptables-save > /etc/iptables.ipv4.nat" up iptables-restore < /etc/iptables.ipv4.nat </pre> === Service enable === * makae sure your runlevel <pre> $runlevel N 5 </pre> * make symbolic link to rcS <pre> cd /etc/init.d/rc5.d # put udhcpd to the last ln -s ../init.d/udhcpd S05udhcpd ln -s ../init.d/hostapd S01hostapd </pre> * service <pre> sudo systemctl enable hostapd.service sudo systemctl enable udhcpd.service </pre> == Reference == [http://elinux.org/RPI-Wireless-Hotspot, RPI-Wireless-Hotspot]
返回「
Application - Wifi AP
」頁面
導覽選單
個人工具
登入
命名空間
頁面
討論
變體
檢視
閱讀
檢視原始碼
檢視歷史
更多
搜尋
導覽
首頁
近期變更
隨機頁面
說明
工具
連結至此的頁面
相關變更
特殊頁面
頁面資訊