How to configure a WLAN gateway

Revision as of 17:53, 24 October 2022 by Registered User


1. How to configure a wireless gateway[edit source]

A wireless gateway routes packets from a wireless LAN to wired network (Ethernet)


For this example of configuration, the setup is :

  • wlan0: wireless interface connected to SSID_NETWORK with DHCP
  • eth0: ethernet interface with static IP which also have a DHCPserver on it
  • forward of packet are activated between the two network interfaces.


1.1. Configure wireless interface[edit source]


 cat /lib/systemd/network/wlan0.network
 [Match]
 Name=wlan0
  
 [Network]
 DHCP=ipv4
 IPForward=ipv4
IPForward
permit to forward all network packet from wireless network to other network.


  • Configure wireless interface for SSID_NETWORK network:
 mkdir -p /etc/wpa_supplicant/
 echo "ctrl_interface=/var/run/wpa_supplicant" > /etc/wpa_supplicant/wpa_supplicant-wlan0.conf
 echo "eapol_version=1" >> /etc/wpa_supplicant/wpa_supplicant-wlan0.conf
 echo "ap_scan=1" >> /etc/wpa_supplicant/wpa_supplicant-wlan0.conf
 echo "fast_reauth=1" >> /etc/wpa_supplicant/wpa_supplicant-wlan0.conf
 echo "" >> /etc/wpa_supplicant/wpa_supplicant-wlan0.conf
 wpa_passphrase SSID_NETWORK PASSWORD_NETWORK >> /etc/wpa_supplicant/wpa_supplicant-wlan0.conf
 or
 wpa_passphrase SSID_NETWORK  >> /etc/wpa_supplicant/wpa_supplicant-wlan0.conf

Where SSID_NETWORK PASSWORD_NETWORK correspond to the SSID and password of wireless network.


  • Enable the wireless configuration (to be take into account after reboot):
 systemctl enable wpa_supplicant@wlan0.service
         systemctl restart systemd-networkd.service
         systemctl restart wpa_supplicant@wlan0.service