Manual Network Connections

# Generate a configuration file and connecting to the AP
wpa_passphrase $ssid $passphrase > wifi-client.conf
sudo wpa_supplicant -i wlan0 -c wifi-client.conf            # -B for background
# Get & verify the IP address
sudo dhclient wlan2
ip addr show wlan2
chevron-rightwpa_supplicant configuration for a WPA or WPA2-PSK networkhashtag
WPA
network={
  ssid="home_network"
  scan_ssid=1
  psk="correct battery horse staple"
  key_mgmt=WPA-PSK
}
Open AP
network={
	ssid="$ESSID"
	key_mgmt=NONE
	scan_ssid=1
}
WEP
network={
  ssid="wifi-old"
  key_mgmt=NONE
  wep_key0=$PASSWORD
  wep_tx_keyidx=0
}
WPA3-SAE
network={
    ssid="wifi-management"
    psk="chocolate1"
    key_mgmt=SAE
    ieee80211w=2
}

Setting up an Access Point

1. Configure Internet access on the system.
2. Set up a static IP for the wireless interface.
3. DHCP server set up, to provide automatic IP configuration for Wi-Fi clients.
4. Add routing to provide Internet access to the Wi-Fi clients.
5. Configure the Wi-Fi interface in AP mode.

=> # 1. Internet Access : 
sudo iw list            # search for Supported interface modes: * AP
=> # 2. Static IP on Access Point Wireless Interface
sudo ip link set wlan0 up
sudo ip addr add 10.0.0.1/24 dev wlan0
=> # 3. DHCP Server
sudo dnsmasq --conf-file=dnsmasq.conf
sudo tail /var/log/syslog | grep dnsmasq            # Checking for dnsmasq in syslog
=> # 4. Routing
echo 1 | sudo tee /proc/sys/net/ipv4/ip_forward     # Enabling IP forwarding
sudo nft add table nat
sudo nft 'add chain nat postrouting { type nat hook postrouting priority 100 ; }'
sudo nft add rule ip nat postrouting oifname "eth0" ip daddr != 10.0.0.1/24 masquerade
=> # 5. Access Point Mode
sudo hostapd hostapd.conf
chevron-rightdnsmasq configuration filehashtag
chevron-righthostapd configuration file : hostapd.confhashtag

Last updated