Categories
Latest Posts
sudo apt-get install dhcp3-server hostapd bridge-utils wireless-tools
# Subnet for DHCP Clients
subnet 192.168.1.0 netmask 255.255.255.0 {
option domain-name-servers 59.187.192.80;
max-lease-time 7200;
default-lease-time 600;
range 192.168.1.100 192.168.1.150;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.1.255;
option routers 192.168.1.1;
}
interface=wlan0 #bridge=br0 driver=nl80211 channel=1 logger_syslog=-1 logger_syslog_level=2 logger_stdout=-1 logger_stdout_level=2 debug=4 dump_file=/tmp/hostapd.dump ctrl_interface=/var/run/hostapd ctrl_interface_group=0 ssid=Tpro #macaddr_acl=1 #accept_mac_file=/etc/hostapd/accept auth_algs=3 eapol_key_index_workaround=0 eap_server=0 wpa=3 wpa_psk_file=/etc/hostapd/wpa_psk wpa_key_mgmt=WPA-PSK wpa_pairwise=CCMP #stakey=0
00:00:00:00:00:00 anypassword_you_want_here
You have to an interface bound to 192.168.1.x in order for DHCP to startup. So, before starting the DHCP server make sure your wlan0 interface is configured (simply) using the line below.
The iptables command takes all NAT traffic and pushes it to the interface you provide. In my case, I was using a shared-key VPN setup that tunneled all traffic over my eth0 interface.
Note: Replace tun0 with eth0 if you do not use this type of VPN setup, and use only standard ethernet/wired Internet.
ifconfig wlan0 192.168.1.1 iptables -t nat -A POSTROUTING -o tun0 -j MASQUERADE
If the startup scripts aren't working, here are instruction for manual invocation: (so you can figure out why they don't work)
Note: You may have to change the hostapd or dhcpd init scripts to provide them with a path to your .conf files. I had to do this for hostapd.
ifconfig wlan0 192.168.1.1 dhcpd -cf /etc/dhcp/dhcpd.conf hostapd -t -dd /etc/hostapd/hostapd.conf iptables -t nat -A POSTROUTING -o tun0 -j MASQUERADE
Blog system is a place where we share our Design and programming technoligy instruction and experience,Project mangement and Team building experience. Pay attention to our blog, and you can get our team's advices and thoughts. Please don't hate to post us a reply if you have question or suggestiion for us.