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.devices
command in the console to obtain thertwn0
is given as the device name. - 2. Open the
rc.conf
file withdoas ee /etc/rc.conf
and 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 restart
to apply the settings in the rc.conf file. - 6. Search for new WLAN networks using
doas ifconfig wlan0 up scan
. Thedoas ifconfig wlan0 list scan
command displays networks that are already known. - 7. Save the access data for a WLAN network with the
doas ee /etc/wpa_supplicant.conf
command by adding the following lines to thewpa_supplicant.conf
file.
network={
ssid="myssid" #for myssid specify the name of the network
psk="mypsk" #for mypsk enter password of network
}
- 8. Enter
doas service netif restart
to restart the network service.
- The WLAN connection is established. Use
ifconfig
to display the network status of the WLAN interface.
For further information, see: https://www.freebsd.org/doc/handbook/network-wireless.html