Sijin T V
Sijin T V A passionate Software Engineer who contributes to the wonders happenning on the internet

Setup Wifi Access Point and Share Internet on Ubuntu/Debian

Sharing a simple and reliable way to setup a wifi access point with shared internet connectivity using hostpad.

Install necessary packages
1
sudo apt-get install hostapd bridge-utils
Configure hostapd

The config is usually located at /etc/hostapd/hostapd.conf. If not, create it.

Here is a bare minimum config. Feel free to experiment.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
interface=wlan0
bridge=br0
ssid=YOUR_SSID
hw_mode=g
channel=6
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase=YOUR_PASSWORD
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
macaddr_acl=0

Enable this configuration by adding it as the DAEMON_CONF in hostapd default config located at /etc/default/hostapd

1
DAEMON_CONF="/etc/hostapd/hostapd.conf"
Bridge the networks

Locate and open /etc/network/interfaces. Assuming that eth0 is the internet source of your system and wlan0 is the Wifi Interface, change this config to something like below.

Note: Make sure to remove the default iface wlan0 entry.

1
2
3
4
5
6
7
8
9
10
11
#loopback adapter
auto lo
iface lo inet loopback

#wired adapter
iface eth0 inet dhcp

#bridge
auto br0
iface br0 inet dhcp
bridge_ports eth0 wlan0
Add hostapd startup entry

Run this on terminal.

1
sudo update-rc.d hostapd enable

You can also manually start and stop hostapd using

1
sudo service hostapd start

or

1
sudo service hostapd stop

Note: Bridging two network interfaces require both of the interfaces (eth0, wlan0) present while startup. If one or both of the interfaces fails during startup, the boot will take a little bit more time before the bridging gets timed out.

comments powered by Disqus