📜 ⬆️ ⬇️

Cubietruck. Road mini server. Part 2

Configure the access point


There are many ways to configure an access point for Debian on the Internet. But I could not find a complete and phased 100% configuration work under Cubietruck. Constantly got out some rakes. While I understood what and how, I drew a small manual for setting up.

It was based on the post “Cubietruck as a wi-fi access point” .

To configure, we need the following packages: Iw, Hostapd and dnsmasq .
')
Install the WI-FI utility:

sudo apt-get install iw 


Run iw:

 iw list 


We are looking for a reference to the mode of AP and AP / VLAN:

 Supported RX frame types: * IBSS: 0xd0 * managed: 0x40 0xd0 * AP: 0x00 0x20 0x40 0xa0 0xb0 0xc0 0xd0 * AP/VLAN: 0x00 0x20 0x40 0xa0 0xb0 0xc0 0xd0 * P2P-client: 0x40 0xd0 * P2P-GO: 0x00 0x20 0x40 0xa0 0xb0 0xc0 0xd0 


In / etc / modules add or change bcmdhd op_mode = 2 :

 sudo nano /etc/modules 


Install the packages to create the hostapd access point and dhcp dnsmasq server:

 sudo apt-get install hostapd dnsmasq 


Check the version of hostapd :

 hostapd 


 cubie@Cubian:~$ hostapd hostapd v1.0-devel User space daemon for IEEE 802.11 AP management, IEEE 802.1X/WPA/WPA2/EAP/RADIUS Authenticator Copyright (c) 2002-2014, Jouni Malinen <j@w1.fi> and contributors 


Configure the access point with this version of hostapd.

A new hostapd build was downloaded from the hostapd23.tgz link.

Unpack the archive in any convenient place.

We also need WinSCP to replace the files from the downloaded archive.

To replace the files, we need to perform some actions:

In the console, execute the following commands:

 sudo chmod 0777 /usr/sbin sudo chmod 0777 -R /usr/sbin/hostapd sudo chmod 0777 -R /usr/sbin/hostapd_cli 


In WinSCP, go to the / usr / sbin folder and change the hostapd and hostapd_cli files to hostapd_old and hostapd_cli_old , then copy the same files that were unpacked to disk.

We return everything to its place:

 sudo chmod 0755 -R /usr/sbin/hostapd sudo chmod 0755 -R /usr/sbin/hostapd_cli sudo chown root:root /usr/sbin/hostapd sudo chown root:root /usr/sbin/hostapd_cli sudo chmod 0755 /usr/sbin 


Check the version of hostapd, in the console enter:

 hostapd 


 hostapd v2.3-devel User space daemon for IEEE 802.11 AP management, IEEE 802.1X/WPA/WPA2/EAP/RADIUS Authenticator Copyright (c) 2002-2014, Jouni Malinen <j@w1.fi> and contributors 


Configure the wlan0 network interface:

 sudo nano /etc/network/interfaces 


Register settings for the addresses you need:

 auto wlan0 iface wlan0 inet static address 192.168.10.1 netmask 255.255.255.0 gateway 192.168.10.1 dns-nameserver 192.168.10.1 


Reboot:

 sudo reboot 


Check if the wlan0 interface has appeared :

 ifconfig 


It should be:

 wlan0 Link encap:Ethernet HWaddr 02:1a:11:f2:53:02 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) 


Next, configure dnsmasq :

 sudo nano /etc/dnsmasq.conf 


Minimum settings:

 bind-interfaces interface=wlan0 dhcp-range=192.168.10.10,192.168.10.100 


Configure the access point:

 sudo nano /etc/hostapd/hostapd.conf 


Again, the minimum setting:

 ssid=MyAP interface=wlan0 ctrl_interface=/var/run/hostapd logger_syslog=1 logger_syslog_level=2 logger_stdout=-1 logger_stdout_level=2 channel=9 wpa=2 wpa_passphrase=12345678 wpa_key_mgmt=WPA-PSK wpa_pairwise= CCMP rsn_pairwise=CCMP 


Rules for running hostapd:

 sudo nano /etc/default/hostapd 


Add:

 RUN_DAEMON="yes" DAEMON_CONF="/etc/hostapd/hostapd.conf" 


Reboot:

 sudo reboot 


We check on any laptop whether the MyAP network is visible, try to connect, enter the network key and if there were no errors anywhere, then we will get an ip from our dnsmasq:

Rule sysctl.conf
 sudo nano /etc/sysctl.conf 


Add:

 net.ipv4.ip_forward=1  ipv6 net.ipv6.conf.all.disable_ipv6 = 1 net.ipv6.conf.default.disable_ipv6 = 1 net.ipv6.conf.lo.disable_ipv6 = 1 


NAT setup:

 sudo nano /etc/rc.local 


Add:

 /sbin/iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE 


Reboot:

 sudo reboot 


If everything was done correctly, after rebooting, the Internet should appear on the device connected to the MyAP point.

If anyone has an idea how to improve the configuration, I will hear it again.

Cubietruck. Road mini server. Part 1
Cubietruck. Road mini server. Part 3

Source: https://habr.com/ru/post/235199/


All Articles