If you have Linux desktop connected to the Internet (wire, LTE modem)
and it has a wifi card which is managed by wpa_supplicant
, you can
easily setup this computer as WiFi access point. You even don't need
hostapd - just wpa_supplicant
and dhcp server
software.
Follow these steps:
-
wpa_supplicant
should be compiled withap
USE flag:echo 'net-wireless/wpa_supplicant ap' | sudo tee -a /etc/portage/package.use
-
Configure
wpa_supplicant.conf
as follows (mode=2
is Access Point mode, for more see documentation):network={ ssid="AP-NAME" mode=2 key_mgmt=WPA-PSK psk="password" frequency=2437 }
You can choose right frequncy according to the table on wikipedia.
-
Install and setup DHCP server. I'm using
net-misc/dhcp
withserver
USE flag:echo 'net-misc/dhcp server' | sudo tee -a /etc/portage/package.use
-
Configure
/etc/dhcp/dhcpd.conf
subnet 192.168.6.0 netmask 255.255.255.0 { range 192.168.6.20 192.168.6.30; option domain-name-servers 8.8.8.8; option routers 192.168.6.1; option broadcast-address 192.168.6.255; default-lease-time 600; max-lease-time 7200; }
-
Start wifi interface, controlled by
wpa_supplicant
and DHCP server:sudo /etc/init.d/net.wifi start sudo ifconfig wifi 192.168.6.1/24 sudo mkdir /var/run/dhcp sudo touch /var/lib/dhcp/dhcpcd.leases sudo /usr/sbin/dhcpd -f -user dhcp -group dhcp wifi
-
Setup forwarding. Suppose 192.168.4.2 wired to the Internet
sudo sysctl -w net.ipv4.ip_forward=1 sudo iptables -t nat -A POSTROUTING --source 192.168.6.0/24 -j SNAT --to 192.168.4.2
That's all! Now you can connect to your Access Point. All these
Comments
comments powered by Disqus