NOTICE: The Processors Wiki will End-of-Life on January 15, 2021. It is recommended to download any files or other content you may need that are hosted on processors.wiki.ti.com. The site is now set to read only.
OMAP Wireless Connectivity WLAN AP No Security
Contents
Purpose[edit]
This section will demonstrate how to configure the EVM to be a non secured AP. in addition the connection path will be demonstrated using the sniffer log.
Hardware Setup[edit]
Configuring AP[edit]
In order to configure the EVM as an AP, some configuration must be taken care of. The configuration of the AP involves two files:
- hostapd.conf - for configuring the connection parameters (security type, SSID, etc...)
- udhcpd.conf - fot configuring the DHCP of the AP
Both of the files are located under /etc.
Step 1 - Configuring hostapd.conf[edit]
First, we will back up the existing hostapd.conf file by invoking:
mv /etc/hostapd.conf /etc/hostapd.conf.bak
Create a new hostapd.conf with the following content:
- Replace ssid field to the name you pick for the AP
Access Point configuration - Band support[edit]
- hw_mode=g - to support bg band
- hw_mode=b - to support b only band
- ieee80211n=1 - to support 802.11n band
interface=wlan0 driver=nl80211 channel=1 hw_mode=g preamble=1 dtim_period=2 beacon_int=100 logger_syslog=-1 logger_syslog_level=2 logger_stdout=-1 logger_stdout_level=2 dump_file=/tmp/hostapd.dump ctrl_interface=/var/run/hostapd ctrl_interface_group=0 supported_rates=60 90 120 180 240 360 480 540 basic_rates=60 90 120 180 240 ssid=MAC_AP max_num_sta=5 macaddr_acl=0 auth_algs=3 ieee80211d=0 uapsd_advertisement_enabled=1 wep_rekey_period=0 own_ip_addr=127.0.0.1 wpa_group_rekey=0 wpa_strict_rekey=0 wpa_gmk_rekey=0 wpa_ptk_rekey=0 #ap_table_max_size=255 #ap_table_expiration_time=60 eap_server=1 disassoc_low_ack=1 ap_max_inactivity=4294967295
The editing above can be done by vi editor as follows:
vi /etc/hostapd.conf
- The editor will be opened. Type the character 'i' to switch to editing mode.
- Copy and paste the above content into the editor.
- Hit 'esc' button to stop editing.
- Type the sequence ":wq" in order to save and quit.
Step 2 - Configuring udhcpd.conf[edit]
First, we will back up the existing udhcpd.conf file by invoking:
mv /etc/udhcpd.conf /etc/udhcpd.conf.bak
Create a new udhcpd.conf with the following content:
# Sample udhcpd configuration file (/etc/udhcpd.conf) # The start and end of the IP lease block start 192.168.0.20 #default: 192.168.0.20 end 192.168.0.254 #default: 192.168.0.254 # The interface that udhcpd will use interface wlan0 #default: eth0 #Examles opt dns 8.8.8.8 8.8.4.4 # public google dns servers option subnet 255.255.255.0 opt router 192.168.0.1 option lease 864000 # 10 days of
The editing above can be done by vi editor as follows:
vi /etc/udhcpd.conf
- The editor will be opened. Type the character 'i' to switch to editing mode.
- Copy and paste the above content into the editor.
- Hit 'esc' button to stop editing.
- Type the sequence ":wq" in order to save and quit.
Step 3 - Running hostapd and udhcpd[edit]
In order to run the Soft AP, We will run:
- hostapd (SoftAP functionality)
- udhcpd to operate the dhcp server
- iptables to enable the NAT (Network Address Translation)
The commands to do the above, are:
echo 1 > /proc/sys/net/ipv4/ip_forward ifconfig wlan0 192.168.0.1 hostapd -B /etc/hostapd.conf -P /var/run/hostapd.pid udhcpd /etc/udhcpd.conf iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
The IP address assigned for wlan0 interface (ifconfig wlan0 192.168.0.1) should match the "router" field IP in the udhcpd.conf file we edited above.
The expected result is:
root@am180x-evm:/# echo 1 > /proc/sys/net/ipv4/ip_forward root@am180x-evm:/# ifconfig wlan0 192.168.0.1 wl1271: firmware booted (Rev 6.1.5.50.69) ADDRCONF(NETDEV_UP): wlan0: link is not ready root@am180x-evm:/# hostapd -B /etc/hostapd.conf -P /var/run/hostapd.pid Configuration file: /etc/hostapd.conf wl1271: down wl1271: firmware booted (Rev 6.2.1.0.54) Using interface wlan0 with hwaddr de:ad:be:ef:00:00 and ssid 'MAC_AP' root@am180x-evm:/# udhcpd /etc/udhcpd.conf root@am180x-evm:/# iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
Step 4 - Connecting to the AP using PC[edit]
Now that the AP is up, the following sequence can be used to connect to the access point:
- Perform a scan on your station laptop and make sure that the AP SSID is visible. In our example it is called MAC_AP.
- Connect to the AP.
- Ping the AP to make sure it is working. In out example we set the Access Point IP address to 192.168.0.1, so we can invoke:
ping 192.168.0.1
The expected result would be something like:
PING 192.168.0.1 (192.168.0.1) 56(84) bytes of data. 64 bytes from 192.168.0.1: icmp_seq=1 ttl=64 time=1.93 ms 64 bytes from 192.168.0.1: icmp_seq=2 ttl=64 time=2.06 ms 64 bytes from 192.168.0.1: icmp_seq=3 ttl=64 time=2.13 ms
Step 5 - Exit From AP Mode[edit]
In order to exit from the AP mode, we need to kill both hostapd and udhcpd processes. We will invoke ps command in order to list the running processes:
root@am180x-evm:/# ps PID USER VSZ STAT COMMAND 1 root 1624 S init [5] 2 root 0 SW [kthreadd] 3 root 0 SW [ksoftirqd/0] 6 root 0 SW< [khelper] ... 2655 root 4848 S hostapd -B /etc/hostapd.conf -P /var/run/hostapd.pid 2657 root 2900 S udhcpd /etc/udhcpd.conf
Now we will use the command kill in order to kill the processes as follows:
kill <hostapd PID> kill <udhcpd PID>
In the example above, the PID's of hostapd and udhcpd are 2655 and 2657 respectively, so we would run:
kill 2655 kill 2657
The expected result is:
netconsole: network logging stopped, interface mon.wlan0 unregistered wl1271: down
Then return the original configuration files
rm /etc/hostapd.conf rm /etc/udhcpd.conf mv /etc/hostapd.conf.bak /etc/hostapd.conf mv /etc/udhcpd.conf.bak /etc/udhcpd.conf