“模板:WIFI AP”的版本间的差异
来自ARM Wiki
Tangdapeng(讨论 | 贡献) |
Tangdapeng(讨论 | 贡献) |
||
(未显示同一用户的8个中间版本) | |||
第1行: | 第1行: | ||
− | :* | + | :*配置无线热点,需要配置hostapd、dnsmasq以及iptables |
− | ::1、配置/etc/ | + | ::1、配置/etc/dnsmasq.conf(使用vi添加以下内容): |
::<syntaxhighlight lang="bash"> | ::<syntaxhighlight lang="bash"> | ||
− | + | interface=wlan0 | |
− | + | bind-interfaces //监听wlan0 | |
− | + | except-interface=lo | |
− | + | dhcp-range=192.168.0.100,192.168.0.254,12h //设置dhcp地址范围和租约时间 | |
− | option | + | dhcp-option=3,192.168.0.1 //设置网关为192.168.0.1 |
− | + | dhcp-option=6,8.8.8.8 //设置DNS为8.8.8.8 | |
− | |||
− | |||
− | |||
− | |||
</syntaxhighlight> | </syntaxhighlight> | ||
::2、配置/etc/hostapd/hostapd.conf(使用vi添加以下内容): | ::2、配置/etc/hostapd/hostapd.conf(使用vi添加以下内容): | ||
::<syntaxhighlight lang="bash"> | ::<syntaxhighlight lang="bash"> | ||
+ | ssid=norco | ||
interface=wlan0 | interface=wlan0 | ||
− | + | driver=nl80211 | |
− | |||
− | |||
channel=7 | channel=7 | ||
− | |||
− | |||
ignore_broadcast_ssid=0 | ignore_broadcast_ssid=0 | ||
+ | hw_mode=g | ||
+ | ieee80211n=1 | ||
wpa=2 | wpa=2 | ||
− | wpa_passphrase=12345678 | + | wpa_passphrase=12345678 |
wpa_key_mgmt=WPA-PSK | wpa_key_mgmt=WPA-PSK | ||
− | wpa_pairwise=TKIP | + | wpa_pairwise=TKIP CCMP |
rsn_pairwise=CCMP | rsn_pairwise=CCMP | ||
− | |||
</syntaxhighlight> | </syntaxhighlight> | ||
− | :: | + | ::3、开启无线热点(此时会开启一个热点名为"norco",密码为"12345678"的WiFi热点): |
::<syntaxhighlight lang="bash" line> | ::<syntaxhighlight lang="bash" line> | ||
ifconfig wlan0 up | ifconfig wlan0 up | ||
ifconfig wlan0 192.168.0.1 netmask 255.255.255.0 | ifconfig wlan0 192.168.0.1 netmask 255.255.255.0 | ||
− | hostapd /etc/hostapd.conf -B | + | hostapd /etc/hostapd/hostapd.conf -B |
− | + | dnsmasq | |
echo 1 > /proc/sys/net/ipv4/ip_forward | echo 1 > /proc/sys/net/ipv4/ip_forward | ||
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE | iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE | ||
</syntaxhighlight> | </syntaxhighlight> |
2020年6月1日 (一) 16:38的最新版本
- 配置无线热点,需要配置hostapd、dnsmasq以及iptables
- 1、配置/etc/dnsmasq.conf(使用vi添加以下内容):
interface=wlan0 bind-interfaces //监听wlan0 except-interface=lo dhcp-range=192.168.0.100,192.168.0.254,12h //设置dhcp地址范围和租约时间 dhcp-option=3,192.168.0.1 //设置网关为192.168.0.1 dhcp-option=6,8.8.8.8 //设置DNS为8.8.8.8
- 2、配置/etc/hostapd/hostapd.conf(使用vi添加以下内容):
ssid=norco interface=wlan0 driver=nl80211 channel=7 ignore_broadcast_ssid=0 hw_mode=g ieee80211n=1 wpa=2 wpa_passphrase=12345678 wpa_key_mgmt=WPA-PSK wpa_pairwise=TKIP CCMP rsn_pairwise=CCMP
- 3、开启无线热点(此时会开启一个热点名为"norco",密码为"12345678"的WiFi热点):
1 ifconfig wlan0 up 2 ifconfig wlan0 192.168.0.1 netmask 255.255.255.0 3 hostapd /etc/hostapd/hostapd.conf -B 4 dnsmasq 5 echo 1 > /proc/sys/net/ipv4/ip_forward 6 iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE