AP를 설정하려고합니다. 나는 사용하고 Odroid U3를 하고 WiFi 어댑터는 것입니다 모듈 3 Hardkernel에서. 나는 또한 데비안 Jessie를 사용하고 있습니다.
Odroid는 인터넷에 액세스 할 수 있으며 다른 장치 (휴대 전화 및 태블릿)가 네트워크를 볼 수 있지만 네트워크에 연결하려고하면 다음 메시지가 표시됩니다. “myNetwork”네트워크에 가입하십시오.
내 호스트 파일은 다음과 같습니다.
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
auto lo br0
iface lo inet loopback
allow-hotplug eth0
iface eth0 inet manual
allow-hotplug wlan0
iface wlan0 inet manual
# Bridge setup
# for dhcp address
#iface br0 inet dhcp
# bridge_ports eth0 wlan0
# for static ip
iface br0 inet static
bridge_ports eth0 wlan0
# adapt with your network settings
address 192.168.1.250
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1
# dns-* options are implemented by the resolvconf package, if installed
dns-nameservers 192.168.1.1
fns-search localdomain
내 hostapd.conf 파일은 다음과 같습니다
interface=wlan0
driver=nl80211
ctrl_interface=/var/run/hostapd
ctrl_interface_group=0
ssid=RaspAP
hw_mode=g
wpa=2
channel=8
wpa_passphrase=raspiwlan
wpa_key_mgmt=WPA-PSK
wpa_pairwise=CCMP
rsn_pairwise=CCMP
beacon_int=100
auth_algs=3
wmm_enabled=1
ifconfig의 결과는 다음과 같습니다.
br0 Link encap:Ethernet HWaddr 1e:fb:50:05:6b:da
inet addr:192.168.1.250 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::1cfb:50ff:fe05:6bda/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:803 errors:0 dropped:0 overruns:0 frame:0
TX packets:466 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:90238 (88.1 KiB) TX bytes:48926 (47.7 KiB)
eth0 Link encap:Ethernet HWaddr 1e:fb:50:05:6b:da
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1838 errors:0 dropped:0 overruns:0 frame:0
TX packets:466 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:557975 (544.8 KiB) TX bytes:54146 (52.8 KiB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:390 errors:0 dropped:0 overruns:0 frame:0
TX packets:390 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:25662 (25.0 KiB) TX bytes:25662 (25.0 KiB)
mon.wlan0 Link encap:UNSPEC HWaddr 00-A8-2B-00-05-4D-00-00-00-00-00-00-00-00-00-00
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:21913 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:6729206 (6.4 MiB) TX bytes:0 (0.0 B)
wlan0 Link encap:Ethernet HWaddr 00:a8:2b:00:05:4d
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:17 errors:0 dropped:0 overruns:0 frame:0
TX packets:9 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:2828 (2.7 KiB) TX bytes:2490 (2.4 KiB)
일부 연구 결과, 문제가 Odroid에 연결하는 장치의 동적 IP 주소와 관련이있을 수 있음을 나타내는 SO (불행히도 링크를 잃어버린)에 대한 답변을 찾았지만 확실하지 않습니다. 어떤 제안?
많은 감사
답변
WiFi AP를 만들기위한 스크립트는 다음과 같습니다.
SetupWiFi.sh
-WiFi 네트워크를 설정하고 wlan0과 eth0을 공유합니다. WiFi SSID (AP 이름) 및 비밀번호 설정을 위해 “ssid”및 “wpa_passphrase”를 변경하십시오.StartWifi.sh
-WiFi를 시작합니다. (SetupWiFi.sh
이미 시작하여 처음으로 건너 뛸 수 있습니다.)StopWiFi.sh
-그만 해요
SetupWiFi.sh :
#!/bin/bash
apt-get install -y hostapd dnsmasq wireless-tools iw wvdial
sed -i 's#^DAEMON_CONF=.*#DAEMON_CONF=/etc/hostapd/hostapd.conf#' /etc/init.d/hostapd
cat <<EOF > /etc/dnsmasq.conf
log-facility=/var/log/dnsmasq.log
#address=/#/10.0.0.1
#address=/google.com/10.0.0.1
interface=wlan0
dhcp-range=10.0.0.10,10.0.0.250,12h
dhcp-option=3,10.0.0.1
dhcp-option=6,10.0.0.1
#no-resolv
log-queries
EOF
service dnsmasq start
ifconfig wlan0 up
ifconfig wlan0 10.0.0.1/24
iptables -t nat -F
iptables -F
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
iptables -A FORWARD -i wlan0 -o eth0 -j ACCEPT
echo '1' > /proc/sys/net/ipv4/ip_forward
cat <<EOF > /etc/hostapd/hostapd.conf
interface=wlan0
driver=nl80211
channel=1
ssid=WiFiAP
wpa=2
wpa_passphrase=YOUR_PASSWORD
wpa_key_mgmt=WPA-PSK
wpa_pairwise=CCMP
# Change the broadcasted/multicasted keys after this many seconds.
wpa_group_rekey=600
# Change the master key after this many seconds. Master key is used as a basis
wpa_gmk_rekey=86400
EOF
service hostapd start
StartWiFi.sh :
#!/bin/bash
service hostapd start
service dnsmasq start
StopWiFi.sh :
#!/bin/bash
service hostapd stop
service dnsmasq stop
노트:
- 데비안 7에서 테스트되었지만 최신 버전에서 작동합니다.
- 수퍼 유저를 실행하고 있는지 확인하십시오. (초보자)를 사용하여 이러한 파일을 실행 가능하게 만듭니다.
chmod +x 'SetupWiFi.sh'
도움이 되길 바랍니다.