8,367
edits
Changes
Created page with "{| class="wikitable" style="background-color:#ffffdc;width:800px;" |- |create_ap is a script that helps quickly create WIFI hotspots on Linux, and supports bridge and NAT mod..."
{| class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
|create_ap is a script that helps quickly create WIFI hotspots on Linux, and supports bridge and NAT modes. It can automatically combine hostapd, dnsmasq and iptables to complete the setting of WIFI hotspots, avoiding complex configuration for users. The github address is as follows:<br>
<span style="color:#0066CC;">https://github.com/oblique/create_ap</span>
|}
{| class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
|'''If you using the latest image, the create_ap script has been pre-installed, and you can create a WIFI hotspot through the create_ap command. The basic command format of create_ap is as follows:'''<br><br>
'''create_ap [options] <wifi-interface> [<interface-with-internet>]''' <br>
'''[<access-point-name> [<passphrase>]]'''
|}
'''1.create_ap method to create WIFI hotspot in NAT mode'''<br><br>
1) Enter the following command to create a WIFI hotspot named '''orangepi''' and password '''orangepi''' in NAT mode<br>
{| class="wikitable" style="width:800px;"
|-
|orangepi@orangepi5:~$ '''sudo create_ap -m nat wlan0 eth0 orangepi orangepi'''
|}
2) If the following information is output, it means that the WIFI hotspot is created successfully<br>
{| class="wikitable" style="width:800px;"
|-
|orangepi@orangepi5:~$ '''sudo create_ap -m nat wlan0 eth0 orangepi orangepi'''<br>
Config dir: /tmp/create_ap.wlan0.conf.fPItFUJ2 PID: 3831<br>
Network Manager found, set ap0 as unmanaged device... DONE <br>
Creating a virtual WiFi interface... ap0 created.<br>
Sharing Internet using method: nat<br>
hostapd command-line interface: hostapd_cli -p<br>
/tmp/create_ap.wlan0.conf.fPItFUJ2/hostapd_ctrl ap0: interface state UNINITIALIZED->ENABLED
|}
3) Take out the mobile phone at this time, in the searched WIFI list, you can find the WIFI hotspot named '''orangepi''' created by the development board, and then click '''orangepi''' to connect to the hotspot, the password is the '''orangepi''' set above<br><br>
[[Image:Pi-5-details-pic95.png]]<br><br>
4) After the connection is successful, the display is as shown in the figure below<br><br>
[[Image:Pi-5-details-pic96.png]]<br><br>
5) In NAT mode, the wireless device connected to the hotspot of the development board requests an IP address from the DHCP service of the development board, so there will be two different network segments, for example, the IP of the development board is 192.168.1.X<br>
{| class="wikitable" style="width:800px;"
|-
|orangepi@orangepi5:~$ '''ifconfig eth0'''<br>
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500<br>
inet '''<span style="color:#FF0000">192.168.1.150</span>''' netmask 255.255.255.0 broadcast 192.168.1.255 <br>
inet6 fe80::938f:8776:5783:afa2 prefixlen 64 scopeid 0x20<link> <br>
ether 4a:a0:c8:25:42:82 txqueuelen 1000 (Ethernet)<br>
RX packets 25370 bytes 2709590 (2.7 MB)<br>
RX errors 0 dropped 50 overruns 0 frame 0<br>
TX packets 3798 bytes 1519493 (1.5 MB)<br>
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0<br>
device interrupt 83
|}
By default, the DHCP service of the development board will assign an IP address of '''192.168.12.0/24''' to the device connected to the hotspot. At this time, click on the connected WIFI hotspot '''orangepi''', and then you can see that the IP address of the mobile phone is '''192.168.12.X'''<br><br>
[[Image:Pi-5-details-pic97.png]]<br><br>
[[Image:Pi-5-details-pic98.png]]<br><br>
6) If you want to specify a different network segment for the connected device, you can specify it through the -g parameter, such as specifying the network segment of the access point AP through the -g parameter as 192.168.2.1<br>
{| class="wikitable" style="width:800px;"
|-
|orangepi@orangepi5:~$ '''sudo create_ap -m nat wlan0 eth0 orangepi orangepi -g 192.168.2.1'''
|}
At this time, after connecting to the hotspot through the mobile phone, click the connected WIFI hotspot orangepi, and then you can see that the IP address of the mobile phone is '''192.168.2.X'''<br><br>
[[Image:Pi-5-details-pic99.png]]<br><br>
[[Image:Pi-5-details-pic100.png]]<br><br>
7) If the '''--freq-band''' parameter is not specified, the hotspot created by default is in the 2.4G frequency band. If you want to create a hotspot in the 5G frequency band, you can specify it through the '''--freq-band 5''' parameter. The specific command is as follows<br>
{| class="wikitable" style="width:800px;"
|-
|orangepi@orangepi:~$ '''sudo create_ap -m nat wlan0 eth0 orangepi orangepi --freq-band 5'''
|}
8) If you need to hide the SSID, you can specify the '''--hidden''' parameter, the specific command is as follows<br>
{| class="wikitable" style="width:800px;"
|-
|orangepi@orangepi:~$ '''sudo create_ap -m nat wlan0 eth0 orangepi orangepi --hidden'''
|}
At this time, the mobile phone cannot search for the WIFI hotspot. You need to manually specify the name of the WIFI hotspot and enter the password to connect to the WIFI hotspot<br><br>
[[Image:Pi-5-details-pic101.png]]<br><br>
'''2.create_ap method to create WIFI hotspot in bridge mode'''<br><br>
1) Enter the following command to create a WIFI hotspot named '''orangepi''' and password '''orangepi''' in bridge mode<br>
{| class="wikitable" style="width:800px;"
|-
|orangepi@orangepi:~$ '''sudo create_ap -m bridge wlan0 eth0 orangepi orangepi'''
|}
2) If the following information is output, it means that the WIFI hotspot is created successfully<br>
{| class="wikitable" style="width:800px;"
|-
|orangepi@orangepi:~$ '''sudo create_ap -m bridge wlan0 eth0 orangepi orangepi'''<br>
[sudo] password for orangepi:<br>
Config dir: /tmp/create_ap.wlan0.conf.fg9U5Xgt <br>
PID: 3141<br>
Network Manager found, set ap0 as unmanaged device... DONE <br>
Creating a virtual WiFi interface... ap0 created.<br>
Sharing Internet using method: bridge <br>
Create a bridge interface... br0 created.<br>
hostapd command-line interface: hostapd_cli -p<br>
/tmp/create_ap.wlan0.conf.fg9U5Xgt/hostapd_ctrl <br>
ap0: interface state UNINITIALIZED->ENABLED ap0: AP-ENABLED
|}
3) Take out the mobile phone at this time, and you can find the WIFI hotspot named orangepi created by the development board in the searched WIFI list, and then you can click orangepi to connect to the hotspot, and the password is the orangepi set above<br><br>
[[Image:Pi-5-details-pic102.png]]<br><br>
4) After the connection is successful, the display is as shown in the figure below<br><br>
[[Image:Pi-5-details-pic103.png]]<br><br>
5) In bridge mode, the wireless device connected to the hotspot of the development board also requests an IP address from the DHCP service of the main router (the router connected to the development board), for example, the IP of the development board is '''192.168.1.X'''<br>
{| class="wikitable" style="width:800px;"
|-
|orangepi@orangepi:~$ '''ifconfig eth0'''<br>
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500<br>
inet '''<span style="color:#FF0000">192.168.1.150</span>''' netmask 255.255.255.0 broadcast 192.168.1.255 <br>
inet6 fe80::938f:8776:5783:afa2 prefixlen 64 scopeid 0x20<link><br>
ether 4a:a0:c8:25:42:82 txqueuelen 1000 (Ethernet) <br>
RX packets 25370 bytes 2709590 (2.7 MB)<br>
RX errors 0 dropped 50 overruns 0 frame 0<br>
TX packets 3798 bytes 1519493 (1.5 MB)<br>
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0<br>
device interrupt 83
|}
The IP of the device connected to the WIFI hotspot is also assigned by the main router, so the mobile phone connected to the WIFI hotspot and the development board are in the same network segment. At this time, click on the connected WIFI hotspot orangepi, and then you can see the IP address of the mobile phone Also 192.168.1.X<br><br>
[[Image:Pi-5-details-pic104.png]]<br><br>
[[Image:Pi-5-details-pic105.png]]<br><br>
6) If the --freq-band parameter is not specified, the hotspot created by default is in the 2.4G frequency band. If you want to create a hotspot in the 5G frequency band, you can specify the --freq-band 5 parameter. The specific command is as follows<br>
{| class="wikitable" style="width:800px;"
|-
|orangepi@orangepi:~$ '''sudo create_ap -m bridge wlan0 eth0 orangepi orangepi --freq-band 5'''
|}
7) If you need to hide the SSID, you can specify the --hidden parameter, the specific command is as follows<br>
{| class="wikitable" style="width:800px;"
|-
|orangepi@orangepi:~$ '''sudo create_ap -m bridge wlan0 eth0 orangepi orangepi --hidden'''
|}
At this time, the mobile phone cannot search for the WIFI hotspot. You need to manually specify the name of the WIFI hotspot and enter the password to connect to the WIFI hotspot.<br><br>
[[Image:Pi-5-details-pic106.png]]<br><br>
|-
|create_ap is a script that helps quickly create WIFI hotspots on Linux, and supports bridge and NAT modes. It can automatically combine hostapd, dnsmasq and iptables to complete the setting of WIFI hotspots, avoiding complex configuration for users. The github address is as follows:<br>
<span style="color:#0066CC;">https://github.com/oblique/create_ap</span>
|}
{| class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
|'''If you using the latest image, the create_ap script has been pre-installed, and you can create a WIFI hotspot through the create_ap command. The basic command format of create_ap is as follows:'''<br><br>
'''create_ap [options] <wifi-interface> [<interface-with-internet>]''' <br>
'''[<access-point-name> [<passphrase>]]'''
|}
'''1.create_ap method to create WIFI hotspot in NAT mode'''<br><br>
1) Enter the following command to create a WIFI hotspot named '''orangepi''' and password '''orangepi''' in NAT mode<br>
{| class="wikitable" style="width:800px;"
|-
|orangepi@orangepi5:~$ '''sudo create_ap -m nat wlan0 eth0 orangepi orangepi'''
|}
2) If the following information is output, it means that the WIFI hotspot is created successfully<br>
{| class="wikitable" style="width:800px;"
|-
|orangepi@orangepi5:~$ '''sudo create_ap -m nat wlan0 eth0 orangepi orangepi'''<br>
Config dir: /tmp/create_ap.wlan0.conf.fPItFUJ2 PID: 3831<br>
Network Manager found, set ap0 as unmanaged device... DONE <br>
Creating a virtual WiFi interface... ap0 created.<br>
Sharing Internet using method: nat<br>
hostapd command-line interface: hostapd_cli -p<br>
/tmp/create_ap.wlan0.conf.fPItFUJ2/hostapd_ctrl ap0: interface state UNINITIALIZED->ENABLED
|}
3) Take out the mobile phone at this time, in the searched WIFI list, you can find the WIFI hotspot named '''orangepi''' created by the development board, and then click '''orangepi''' to connect to the hotspot, the password is the '''orangepi''' set above<br><br>
[[Image:Pi-5-details-pic95.png]]<br><br>
4) After the connection is successful, the display is as shown in the figure below<br><br>
[[Image:Pi-5-details-pic96.png]]<br><br>
5) In NAT mode, the wireless device connected to the hotspot of the development board requests an IP address from the DHCP service of the development board, so there will be two different network segments, for example, the IP of the development board is 192.168.1.X<br>
{| class="wikitable" style="width:800px;"
|-
|orangepi@orangepi5:~$ '''ifconfig eth0'''<br>
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500<br>
inet '''<span style="color:#FF0000">192.168.1.150</span>''' netmask 255.255.255.0 broadcast 192.168.1.255 <br>
inet6 fe80::938f:8776:5783:afa2 prefixlen 64 scopeid 0x20<link> <br>
ether 4a:a0:c8:25:42:82 txqueuelen 1000 (Ethernet)<br>
RX packets 25370 bytes 2709590 (2.7 MB)<br>
RX errors 0 dropped 50 overruns 0 frame 0<br>
TX packets 3798 bytes 1519493 (1.5 MB)<br>
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0<br>
device interrupt 83
|}
By default, the DHCP service of the development board will assign an IP address of '''192.168.12.0/24''' to the device connected to the hotspot. At this time, click on the connected WIFI hotspot '''orangepi''', and then you can see that the IP address of the mobile phone is '''192.168.12.X'''<br><br>
[[Image:Pi-5-details-pic97.png]]<br><br>
[[Image:Pi-5-details-pic98.png]]<br><br>
6) If you want to specify a different network segment for the connected device, you can specify it through the -g parameter, such as specifying the network segment of the access point AP through the -g parameter as 192.168.2.1<br>
{| class="wikitable" style="width:800px;"
|-
|orangepi@orangepi5:~$ '''sudo create_ap -m nat wlan0 eth0 orangepi orangepi -g 192.168.2.1'''
|}
At this time, after connecting to the hotspot through the mobile phone, click the connected WIFI hotspot orangepi, and then you can see that the IP address of the mobile phone is '''192.168.2.X'''<br><br>
[[Image:Pi-5-details-pic99.png]]<br><br>
[[Image:Pi-5-details-pic100.png]]<br><br>
7) If the '''--freq-band''' parameter is not specified, the hotspot created by default is in the 2.4G frequency band. If you want to create a hotspot in the 5G frequency band, you can specify it through the '''--freq-band 5''' parameter. The specific command is as follows<br>
{| class="wikitable" style="width:800px;"
|-
|orangepi@orangepi:~$ '''sudo create_ap -m nat wlan0 eth0 orangepi orangepi --freq-band 5'''
|}
8) If you need to hide the SSID, you can specify the '''--hidden''' parameter, the specific command is as follows<br>
{| class="wikitable" style="width:800px;"
|-
|orangepi@orangepi:~$ '''sudo create_ap -m nat wlan0 eth0 orangepi orangepi --hidden'''
|}
At this time, the mobile phone cannot search for the WIFI hotspot. You need to manually specify the name of the WIFI hotspot and enter the password to connect to the WIFI hotspot<br><br>
[[Image:Pi-5-details-pic101.png]]<br><br>
'''2.create_ap method to create WIFI hotspot in bridge mode'''<br><br>
1) Enter the following command to create a WIFI hotspot named '''orangepi''' and password '''orangepi''' in bridge mode<br>
{| class="wikitable" style="width:800px;"
|-
|orangepi@orangepi:~$ '''sudo create_ap -m bridge wlan0 eth0 orangepi orangepi'''
|}
2) If the following information is output, it means that the WIFI hotspot is created successfully<br>
{| class="wikitable" style="width:800px;"
|-
|orangepi@orangepi:~$ '''sudo create_ap -m bridge wlan0 eth0 orangepi orangepi'''<br>
[sudo] password for orangepi:<br>
Config dir: /tmp/create_ap.wlan0.conf.fg9U5Xgt <br>
PID: 3141<br>
Network Manager found, set ap0 as unmanaged device... DONE <br>
Creating a virtual WiFi interface... ap0 created.<br>
Sharing Internet using method: bridge <br>
Create a bridge interface... br0 created.<br>
hostapd command-line interface: hostapd_cli -p<br>
/tmp/create_ap.wlan0.conf.fg9U5Xgt/hostapd_ctrl <br>
ap0: interface state UNINITIALIZED->ENABLED ap0: AP-ENABLED
|}
3) Take out the mobile phone at this time, and you can find the WIFI hotspot named orangepi created by the development board in the searched WIFI list, and then you can click orangepi to connect to the hotspot, and the password is the orangepi set above<br><br>
[[Image:Pi-5-details-pic102.png]]<br><br>
4) After the connection is successful, the display is as shown in the figure below<br><br>
[[Image:Pi-5-details-pic103.png]]<br><br>
5) In bridge mode, the wireless device connected to the hotspot of the development board also requests an IP address from the DHCP service of the main router (the router connected to the development board), for example, the IP of the development board is '''192.168.1.X'''<br>
{| class="wikitable" style="width:800px;"
|-
|orangepi@orangepi:~$ '''ifconfig eth0'''<br>
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500<br>
inet '''<span style="color:#FF0000">192.168.1.150</span>''' netmask 255.255.255.0 broadcast 192.168.1.255 <br>
inet6 fe80::938f:8776:5783:afa2 prefixlen 64 scopeid 0x20<link><br>
ether 4a:a0:c8:25:42:82 txqueuelen 1000 (Ethernet) <br>
RX packets 25370 bytes 2709590 (2.7 MB)<br>
RX errors 0 dropped 50 overruns 0 frame 0<br>
TX packets 3798 bytes 1519493 (1.5 MB)<br>
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0<br>
device interrupt 83
|}
The IP of the device connected to the WIFI hotspot is also assigned by the main router, so the mobile phone connected to the WIFI hotspot and the development board are in the same network segment. At this time, click on the connected WIFI hotspot orangepi, and then you can see the IP address of the mobile phone Also 192.168.1.X<br><br>
[[Image:Pi-5-details-pic104.png]]<br><br>
[[Image:Pi-5-details-pic105.png]]<br><br>
6) If the --freq-band parameter is not specified, the hotspot created by default is in the 2.4G frequency band. If you want to create a hotspot in the 5G frequency band, you can specify the --freq-band 5 parameter. The specific command is as follows<br>
{| class="wikitable" style="width:800px;"
|-
|orangepi@orangepi:~$ '''sudo create_ap -m bridge wlan0 eth0 orangepi orangepi --freq-band 5'''
|}
7) If you need to hide the SSID, you can specify the --hidden parameter, the specific command is as follows<br>
{| class="wikitable" style="width:800px;"
|-
|orangepi@orangepi:~$ '''sudo create_ap -m bridge wlan0 eth0 orangepi orangepi --hidden'''
|}
At this time, the mobile phone cannot search for the WIFI hotspot. You need to manually specify the name of the WIFI hotspot and enter the password to connect to the WIFI hotspot.<br><br>
[[Image:Pi-5-details-pic106.png]]<br><br>