10.3
1.安裝相關軟體
apt install hostapd dnsmasq -y
2.編輯 /etc/hostapd/hostapd.conf
interface=wlan0
ssid=pi-ap
hw_mode=g
channel=1
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase=0123456789
wpa_key_mgmt=WPA-PSK
rsn_pairwise=CCMP
3.編輯 /etc/dnsmasq.conf
interface=wlan0
dhcp-range=192.168.13.2,192.168.13.20,255.255.255.0,1h
4.編輯 /etc/dhcpcd.conf
interface wlan0
static ip_address=192.168.13.1/24
static routers=192.168.13.1
static domain_name_servers=8.8.8.8
5.執行
#sudo ip addr add 192.168.13.1/24 dev wlan0
sudo systemctl start dnsmasq
sudo systemctl unmask hostapd
sudo systemctl start hostapd
sudo sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward"
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
沒有留言:
張貼留言