A
PPLICATION
N
OTE
R
EVISION0.4
D
ATE2019/01/08
D
EPLOYING
S
OFTWARE
A
CCESS
P
OINT ON THE
V
CPE
P
RODUCT WITH
WWAN/WAN-LAN
CONNECTION
USING
U
BUNTU
17.04
D
ESKTOP VERSION
Revision History
Date[mm/dd/yyyy] Revision Modifications 02/02/2018 0.1 First version
04/20/2018 0.2 Modify content; combine WAN-LAN Application Note in one.
10/17/2018 0.3 Change LTE connection method.
Modify AP process based on nmcli limitation 08/01/2019 0.4 Add way to change sierra module from MBIM mode
(Windows) to QMI (Linux).
Description
This application note describes how to set up a WLAN Access Point using vCPE product and using WWAN/WAN-LAN interface to access the Internet based on open source Linux
distribution Ubuntu 17.04 desktop.
WAN-LAN to WLAN AP
We appreciate your input
Please let us know if you consider any aspect of this application note needs improving or correcting. We appreciate your valuable input in helping make our products and documentation better.
Please send all such comments in writing to: [email protected]
1. WLAN
A
CCESS
P
OINT WITH
WWAN/WAN-LAN
CONNECTION
REQUIREMENT
In order to set up a WLAN Access Point with WWAN/WAN-LAN connection, you need several things.
1.1 Linux distribution
Ubuntu desktop version is a popular Linux distribution for PC or NB. So its WLAN function support is better than other distribution.
1. Ubuntu 17.04, 17.10 Desktop version 2. Ubuntu 16.04 Desktop version
1.2 Packages that you will need
1. sudo apt-get install net-tools 2. sudo apt-get install isc-dhcp-server 3. sudo apt-get install hostapd 4. sudo apt-get install haveged
5. sudo apt-get install network-manager 6.
1.3 WWAN module
There are several WWAN modules have been used on vCPE product, please check your platform and find out which module that you can use.
1. Sierra MC7430, MC7455, EM7455 2. Fibocom L850, L830
1.3.1 Sierra MC7430, MC7455, EM7455 driver
There are three drivers that you need for Sierra WWAN modules. The management interface is “/dev/ttyUSB2”. (Management interface might shift due to platform HW design.)
2. cdc_wdm
3. usbnet
1.3.2 Fibocom L850, L830 driver
The management interface is “/dev/ttyACM0”. (Management interface might shift due to platform HW design.)
1. cdc_mbim
3. cdc_ncm
4. cdc_acm
5. usbnet
1.4 WWAN dial tool:
2. mmcli and ModemManager service
1.5 WLAN module that has Access Point function
There are several WLAN modules have been used on vCPE product, please check your platform and find out which module that you can use
- Advantech EWM-W162 (Marvell 88W8897)
- Advantech EWM-W163 (Qualcomm Atheros QCA6174A) - Senao PCE4302AN (Qualcomm Atheros QCA9882) - Sparklan WPEQ-257ACN (Qualcomm Atheros QCA9882)
2. mwifiex:
3. cfg80211
1. ath10k_pci
3. ath:
4. mac80211:
1.6 DHCP server
To act as a WLAN Access Point, you need to answer DHCP requests from terminals, which means you need a DHCP server application/daemon to handle these requests.
1. In this Application Note, we use isc-dhcp-server (https://help.ubuntu.com/community/isc-dhcp-server) 2. Configuration file locates at "/etc/dhcp/dhcpd.conf"
Add these into the configuration file.
That means:
A. It will use 192.168.2.1 as router (IP for the WLAN interface) B. Client IP range is from 192.168.2.10 to 192.168.2.50
1.7 WLAN Access Point application/daemon
In this Application Note, we use hostapd for the access point application. 1. hostapd (https://w1.fi/hostapd/)
2. Proper configuration for Access Point application.
1.8 Linux IP forwarding is enabled
2. S
ETUP
2.1 Start the Linux
Start-up Linux and with proper WWAN/WLAN drivers loaded, and confirm that DHCP server daemon has setup and running, and enable “net.ipv4.ip_forward=1” (/etc/sysctl.conf).
2.2 Establish WWAN/WAN-LAN connection:
Choose either way to get your x86 platform accessing internet. 2.2.1. WAN-LAN
Plug a network cable which is internet accessible to one physical port on x86 platform, and use “dhclient” to ask an IP address from DHCP server.
2.2.2. WWAN
1. Use mmcli to unlock the SIM card PIN code if needed ($ping_code=”0000”) mmcli -i 0 --pin=$ping_code
2. Create lte connection by using nmcli ($cdc_device =cdc-wdm0, $conneciton_name=lte1, apn is “internet”)
nmcli c add type gsm ifname $cdc_device con-name $conneciton_name apn
internet
3. Use nmcli to start the connection: ($conneciton_name=lte1) nmcli c up $conneciton_name
4. wwan0 interface will get the IP from carrier automatically.
5. You can check start_lte_by_mmcli_nmcli.sh for reference
root@AAL1010-UB1704:~# cat start_lte_by_mmcli_nmcli.sh
conneciton_name=lte1 apn="internet"
echo Remove connection in nmcli nmcli c delete $conneciton_name
echo Please make sure ModemManager or network-manager is enabled echo cdc device name is $cdc_device
echo unlock SIM pin code. mmcli -i 0 --pin=$ping_code sleep 1
echo add nmcli connection
nmcli c add type gsm ifname $cdc_device con-name $conneciton_name apn $apn echo enable $conneciton_name
sleep 1
nmcli c up $conneciton_name
2.3 Setup the Access Point environment
This is how to start the AP. Example below uses 4G LTE interface to access internet. (wwan0 root@AAL1010-UB1704:~# cat start_4g_lte_router.sh
#start the LTE connection before start the AP. sh start_lte_by_mmcli_nmcli.sh
# WLAN and WWAN interface based on your OS/Environment. WAN=wwan0
WLAN=wlan0 AP=uap0
ifconfig $WLAN down
iw phy phy0 interface add $AP type __ap # Generate one Access Point interface called wwan0 ($WAN parameter)
nmcli dev set $AP managed no # Make sure network-manager won't control the wlan interface.
sleep 2
ifconfig $AP inet 0.0.0.0
ifconfig $AP inet 192.168.2.1 up
service isc-dhcp-server restart # Start DHCP server
# Set IP tables and forward packets between WAN and AP interface. iptables -t nat -X
iptables -t nat -F iptables -t nat -Z
iptables -t nat -A POSTROUTING -o $WAN -j MASQUERADE
iptables -A FORWARD -i $WAN -o $AP -m state --state RELATED,ESTABLISHED -j ACCEPT iptables -A FORWARD -i $AP -o $WAN -j ACCEPT
After these steps, you should see uap0 up and run with 192.168.2.1’s IP.
2.4 Start the Access Point application
To start the Access Point application, please use following command: #hostapd hostapd_configuration.
hostapd_configuration can determine - 802.11 protocol (a, b, g, n, ac)
n 2.4G: hw_mode=b n 5G: hw_mode=a n n: ieee80211n=1 n ac: ieee80211ac=1 - SSID name n ssid=”SSID name”
- Channel selection (channel=0 will let hostapd select the channel automatically) n channel=44 or channel=0
- Maximum station number
n Max_num_sta=10 (Maximum station number is 10 - Security protocol (wpa2 is perfered)
n wpa2 key
Following “ hostapd_5G_n.cfg” is an example of configuration file for establishing 5G band WLAN access point.
3. WARNING
AND
N
OTE
There are several notes and limitation that you need to know: WWAN:
- WWAN module’s FW and wvdial configuration are country/location/carrier dependent; please contact Advantech to get the correct FW and wvdial configuration for your country/location/carrier.
- Sierra module:
n In order to upgrade the module FW, please prepare the Quick Start Linux Image v02.04 and use the SDK to upgrade the FW.
fwdldhostx86_64 -s <slqssdk location> -d 9x30 -p <FW location (Unzip files)>
n Windows will change the Sierra module to MBIM mode, in order to use Linux, please use mbimtoqmi tool to switch it back to QMI mode. Please contact Advantech to get more information.
i. Please disable ModemManager before using mbimtoqmi. WLAN:
- For Qualcomm Atheros chipset (QCA9882, QCA6174A)
n Ubuntu 16.04 has DFS disabled problem in Taiwan for WLAN 5G Band. (Most of 5G channel will be disabled.) So suggest to use Ubuntu 17.04 for Qualcomm Atheros chipset if possible.
n In order to use the DFS related channel, you need to modify the kernel
parameters and enable the DFS feature manually. Please contact Advantech to get more information.
- If you want to use 40MHz bandwidth in 2.4G channels. You need to modify the hostapd source code. (
https://www.brunsware.de/blog/gentoo/hostapd-40mhz-disable-neighbor-check.html) - Multi-SSID support:
In order to support Multi-SSID, you need to make sure your WLAN module can support it. In current application, all SSIDs will use in the same channel
(http://wiki.stocksy.co.uk/wiki/Multiple_SSIDs_with_hostapd)
- If you need 2.4G and 5G band work at the same time, you will need two WLAN modules. Please contact Advantech and check if your platform can support this or not.
How to check if the ethdev is managed by network-manager
Although network-manager has hotspot function, it can only enable 2.4GHz frequency band. In order to use 802.11 AC, you need to make sure network-manager won’t manage WLAN interface. In our start_4g_lte_router.sh, we use “nmcli dev set $WLAN managed no” and “nmcli dev set $AP managed no” to make sure network-manager won’t manage these two interface. Then use hostapd to start specific AP function.