In this post I will present how to transform our Linux in Access- Point .
At the beginning we need to install the ssh client to be able to remotely configure our Access point available … as we use the Debian distribution .
We will issue a command to install ssh :
apt-get install ssh
The next step is to create a firewall which will make available to us the internet with eth0 for wlan0 :
touch /etc/init.d/firewall
Now when we have already created the file from our firewall change his right to make it executable :
chmod + x /etc/init.d/firewall
The next step is to edit this file and create a configuration of our firewall , so execute the following command and paste so the following configuration :
mcedit /etc/init.d/firewall
Our firewall configuration :
echo 1> / proc/sys/net/ipv4/ip_forwardiptables -F
iptables -X
iptables- t nat -X
iptables- t nat -F
iptables- t mangle -F
iptables-t mangle- Xiptables — P INPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -P OUTPUT ACCEPTiptables -A INPUT- j ACCEPT — m state — state ESTABLISHED , RELATED
iptables- A FORWARD — j ACCEPT — m state — state ESTABLISHED , RELATED
iptables-A OUTPUT — j ACCEPT — m state — state ESTABLISHED , RELATEDiptables — t nat -A POSTROUTING -s 192.168.10.0/24 — j MASQUERADE
iptables- A FORWARD -s 192.168.10.0/24 — j ACCEPT
Now that we have already created the configuration we need to make our firewall competed with the system . For this purpose, we use the following command :
update-rc.d firewall defaults 20
Now, our firewall will be loaded automatically at boot :-) . In the next step we need to edit the file : /etc/network/interfaces . In our configuration, we need to make our LAN interface to act as a WAN and allow us to access from the outside. In contrast, our WLAN interface will act as an access point and allow us to connect to our network. Therefore, edit the file and paste .
mcedit /etc/network/interfaces
auto lo
iface lo inet loopbackallow — hotplug eth0
iface eth0 inet dhcpauto wlan0
iface wlan0 inet static
address 192.168.10.1
netmask 255.255.255.0
So as you can see our eth0 gets an address from dhcp while the wlan0 interface has a static IP address that is also our gateway AP .
For proper operation of our Access Point we still need to install dhcp server . Then issue the following command:
apt- get install dhcp3 -server
In the next step we will setup our dhcp server . For this purpose, we will edit the file /etc /dhcp/dhcpd.conf. Delete the entire contents and paste the following :
subnet 192.168.10.0 netmask 255.255.255.0 {
range 192.168.10.100 192.168.10.199 ;
default- lease-time 4200 ;
option domain — name-servers 213.241.79.38 , 213.241.79.37 , 83.238.255.76 ;
option netbios — name-servers 192.168.10.1 ;
option routers 192.168.10.1 ;
option subnet -mask 255.255.255.0 ;
option broadcast -address 192.168.10.255 ; }
It is important to provide your own DNS addresses , those that I have given here are for NETI , keep in mind that each provider has a different internet ! ! .
When we make changes in the configuration file , we need to set the interface on which you want to run the dhcp server . For this we need to edit the file /etc/default/isc-dhcp-server .
mcedit /etc/default/isc-dhcp-server
At the bottom of the configuration add wlan0
Status of change
INTERFACES = “” state after changes
INTERFACES = “ wlan0 “
After making these changes , install hostpd
apt-get install wpasupplicant hostapd
After successful installation we need to create the configuration file /etc/hostapd/hostapd.conf , we’ll do it with the command:
touch /etc/hostapd/hostapd.conf
Now that we have already created a configuration file go to edit this file using the following command:
mcedit /etc/hostapd/hostapd.conf
Now our configuration paste the following configurations :
interface = wlan0
driver = nl80211
logger_syslog = -1
logger_syslog_level = 2
logger_stdout = -1
logger_stdout_level = 2
dump_file = /tmp/hostapd.dump
ctrl_interface = /var/run/hostapd
ctrl_interface_group = 0
hw_mode = g
channel = 5
wpa = 2
wpa_key_mgmt = WPA -PSK
rsn_pairwise = CCMP
ieee80211n = 1
wmm_enabled = 1
ht_capab = [ HT40 -] [ SHORT — GI -40 ] [ DSSS_CCK -40 ]
ssid = test
wpa_passphrase = accesspoint
As we see in our configuration :
network channel 5
g mode
name of the test network
password accesspoint
If you want a mode only “g” leave the above configurations , but if you want to have a mode of “n” we need to introduce yet these figures :
ieee80211n = 1
wmm_enabled = 1
ht_capab = [ HT40 -] [ SHORT — GI -40 ] [ DSSS_CCK -40 ]
Very important is the way to protect our network or WPA2 PSK , only in the working mode “ n” … If we want to leave without security you will need to use the MAC address filtration .
Then, in the file /etc/init.d/hostapd add the path to the configuration :
DAEMON_CONF = /etc/hostapd/hostapd.conf
After adding the correct path to the file we need to uinstall hostapd with the kernel ..
update-rc.d hostapd remove
It is also quite useful to install a package :-) :
apt-get install wireless-tools htop
Now we must guard against the eventuality of a power failure which unfortunately will restart our system. In short, the idea is that the snapshot power everything nicely we just launched :-)
For this we need to edit the file /etc/network/interfaces and add entries actuating hostapd and a
dhcp server ..
Yes interfaces file should look like :
auto lo
iface lo inet loopbackallow — hotplug eth0
iface eth0 inet dhcpauto wlan0
iface wlan0 inet static
address 192.168.10.1
netmask 255.255.255.0
up /etc/init.d/hostapd start
up /etc/init.d/isc-dhcp-server start
Now we restart our system and from that time we have established access point :-) :-) :-)