DART-6UL/VAR-SOM-MX7 Wireless LAN: Difference between revisions
Line 60: | Line 60: | ||
This is a network example. You need to set the IP address based on your network.<br> | This is a network example. You need to set the IP address based on your network.<br> | ||
<br> | <br> | ||
Wireless configuration can be setup in file /etc/hostapd.conf before launching hostapd for configuring access point name, requiring password | Wireless configuration can be setup in file /etc/hostapd.conf before launching hostapd for configuring access point name, requiring password, etc.<br> | ||
For example:<br> | |||
<pre>$ vi /etc/hostapd.conf | <pre> | ||
$ vi /etc/hostapd.conf | |||
You can set the following parameters: | |||
ssid=VARI_AP | ssid=VARI_AP | ||
wpa=1 | wpa=1 | ||
Line 71: | Line 72: | ||
Ensure that wpa_supplicant is not holding the device | Ensure that wpa_supplicant is not holding the device | ||
<pre>$ killall wpa_supplicant | <pre> | ||
$ killall wpa_supplicant | |||
$ killall hostapd | $ killall hostapd | ||
</pre> | </pre> | ||
IP Forwarding: | IP Forwarding: | ||
<pre>$ echo 1 > /proc/sys/net/ipv4/ip_forward | <pre> | ||
$ echo 1 > /proc/sys/net/ipv4/ip_forward | |||
$ ifconfig wlan0 192.168.5.1 | $ ifconfig wlan0 192.168.5.1 | ||
$ hostapd -B /etc/hostapd.conf -P /var/run/hostapd.pid | $ hostapd -B /etc/hostapd.conf -P /var/run/hostapd.pid |
Revision as of 09:02, 19 April 2017
Test
Scan for wireless networks:
$ ifconfig wlan0 up $ iw dev wlan0 scan | grep SSID
Connecting to a WPA encrypted network:
Find your network from the above scan command.
$ mv /etc/wpa_supplicant.conf /etc/wpa_supplicant.conf.org $ wpa_passphrase <YourAP> <YourPassword> >/etc/wpa_supplicant.conf $ wpa_supplicant -B -Dnl80211 -iwlan0 -c/etc/wpa_supplicant.conf
Check link:
$ iw dev wlan0 link
Disable eth0:
$ ifconfig eth0 down $ ifconfig eth1 down
Run DHCP:
$ udhcpc -iwlan0 $ ifconfig
Check link speed:
iperf server (on Target/Host):
$ ifconfig (to get the IP address) $ iperf -s
iperf client (on Host/Target):
$ iperf -c <IP_ADDRESS_OF_IPERF_SERVER>
Useful link for common iw commands: https://wiki.archlinux.org/index.php/Wireless_network_configuration#Manual_setup
Access Point
This example will demonstrate you how to use the board as an access point. It will forward packets from wlan0 to eth0. DHCPD:
$ vi /etc/udhcpd.conf # Sample udhcpd configuration file (/etc/udhcpd.conf) # The start and end of the IP lease block start 192.168.5.20 #default: 192.168.0.20 end 192.168.5.25 #default: 192.168.0.254 # The interface that udhcpd will use interface wlan0 #default: eth0 #Example opt dns 8.8.8.8 8.8.4.4 # public google dns servers option subnet 255.255.255.0 opt router 192.168.5.1 option lease 864000 # 10 days of seconds
This is a network example. You need to set the IP address based on your network.
Wireless configuration can be setup in file /etc/hostapd.conf before launching hostapd for configuring access point name, requiring password, etc.
For example:
$ vi /etc/hostapd.conf You can set the following parameters: ssid=VARI_AP wpa=1 wpa_passphrase=12345678 wpa_key_mgmt=WPA-PSK
Ensure that wpa_supplicant is not holding the device
$ killall wpa_supplicant $ killall hostapd
IP Forwarding:
$ echo 1 > /proc/sys/net/ipv4/ip_forward $ ifconfig wlan0 192.168.5.1 $ hostapd -B /etc/hostapd.conf -P /var/run/hostapd.pid $ udhcpd /etc/udhcpd.conf $ iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
As a next step one should take a look at iw utility which can be used for configuring some parameters https://wireless.wiki.kernel.org/en/users/documentation/iw