Connecting to WLAN
This step shows how to establish a WLAN connection with an access point under TwinCAT/BSD. In addition, you will learn how to search for WLAN networks and determine the SSID.
WLAN is encrypted with WPA2, and the IP address is automatically assigned by a DHCP server.
Requirements:
- Beckhoff WLAN sticks: CU8210-D001-0101 or CU8210-D001-0102
- SSID and password of an existing WLAN.
Proceed as follows:
- 1. Enter the
sysctl net.wlan.devicescommand in the console to obtain thedevice name. With a Beckhoff WLAN stick, for example,rtwn0is given as the device name. - 2. Open the
rc.conffile withdoas ee /etc/rc.confand add the following lines:
# wireless
wlans_rtwn0="wlan0" #wlan0 is now your network interface
create_args_wlan0="country DE"
ifconfig_wlan0="up scan WPA DHCP"- 3. The following lines must be added if dhcpcd is used (standard from version 13.2.0.6 / 89449).
# wireless
wlans_rtwn0="wlan0" #wlan0 is now your network interface
create_args_wlan0="country DE"
ifconfig_wlan0="up scan WPA"- 4. If DHCP is not active or desired, a fixed IP address is defined with the following entry.
# wireless
wlans_rtwn0="wlan0" #wlan0 is now your network interface
create_args_wlan0="country DE"
ifconfig_wlan0="WPA inet 192.168.0.100 netmask 255.255.255.0 up scan"- 5. Restart the network service with
doas service netif restartto apply the settings in the rc.conf file. - 6. Search for new WLAN networks using
doas ifconfig wlan0 up scan. Thedoas ifconfig wlan0 list scancommand displays networks that are already known. - 7. Save the access data for a WLAN network with the
doas ee /etc/wpa_supplicant.confcommand by adding the following lines to thewpa_supplicant.conffile.
network={
ssid="myssid" #for myssid specify the name of the network
psk="mypsk" #for mypsk enter password of network
}- 8. Enter
doas service netif restartto restart the network service.
- The WLAN connection is established. Use
ifconfigto display the network status of the WLAN interface.
For further information, see: https://www.freebsd.org/doc/handbook/network-wireless.html