Cubietruck. Travel mini server. Part 2
Access Point Setup
There are many ways on the Internet to configure an access point for Debian. But I could not find a complete and phased 100% configuration work under Cubietruck. Any rake constantly got out. While I figured out what and how, a small tuning manual was drawn.
The post “Cubietruck as a Wi-Fi Access Point” was taken as the basis .
To configure, we need the following packages: Iw, Hostapd and dnsmasq .
Install the WIFI utility:
sudo apt-get install iw
Launch iw:
iw list
We are looking for a mention of the AP mode and AP / VLAN mention :
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 hostapd version :
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 and contributors
The access point could not be configured with this version of hostapd.
A new hostapd build was downloaded at hostapd23.tgz .
Unpack the archive to any convenient place.
We also need WinSCP to replace files from the downloaded archive.
To replace files, we need to perform some actions:
In the console, execute the 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 files that were unpacked to disk here.
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
We check the hostapd version, in the console we 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 and contributors
Configure the wlan0 network interface :
sudo nano /etc/network/interfaces
We write the settings to the addresses that 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 appears :
ifconfig
Must 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 is:
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
We correct the launch of 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 ip from our dnsmasq:
Edit 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 thoughts on how to improve the configuration, I will just hear it.
Cubietruck. Travel mini server. Part 1
Cubietruck. Travel mini server. Part 3