또는 hostapd 및 isc-dhcp-server 전에 부팅시 wlan0을 다시 시작하는 미니 서비스를 만들 수 있습니다.
새 스크립트 /etc/init.d/wlan0-restart를 작성하십시오.
sudo vi /etc/init.d/wlan0-restart
다음 내용으로 :
#!/bin/sh
#
#
### BEGIN INIT INFO
# Provides: wlan0-restart
# Required-Start: $network
# Required-Stop: $network
# Should-Start:
# Should-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Restarts wlan0 interface
# Description: Restarts wlan0 interface to fix problem with static address in WiFi AP
# X-Start-Before: hostapd isc-dhcp-server
### END INIT INFO
PATH=/sbin:/usr/sbin:$PATH
do_start() {
ifdown wlan0
ifup wlan0
}
case "$1" in
start)
do_start
;;
restart|reload|force-reload)
echo "Error: argument '$1' not supported" >&2
exit 3
;;
stop)
;;
status)
;;
*)
echo "Usage: $0 start|stop" >&2
exit 3
;;
esac
exit 0
그런 다음 다음 명령을 실행하십시오.
sudo chmod 755 /etc/init.d/wlan0-restart
sudo update-rc.d –f hostapd remove
sudo update-rc.d –f isc-dhcp-server remove
sudo update-rc.d wlan0-restart defaults
sudo update-rc.d hostapd defaults
sudo update-rc.d isc-dhcp-server defaults
재부팅하고 wlan0에 고정 IP 주소가 있고 isc-dhcpd-server가 실행 중인지 확인하십시오.
pi@raspberrypi:~$ ifconfig wlan0
wlan0 Link encap:Ethernet HWaddr e8:de:27:07:92:6a
inet addr:192.168.10.1 Bcast:192.168.10.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
pi@raspberrypi:~$ pgrep -l dhcpd
2315 dhcpd