Laptop as a wifi access point

I know that it is possible to make an access point from a wi-fi card. Now I tried to set it up. Here is a description of my actions step by step.

I have old laptop Acer Aspire 5315.

OS— Kubuntu 11.10

Wi-Fi-card— Atheros. That's what lspci says about it

Ethernet controller: Atheros Communications Inc. AR242x / AR542x Wireless Network Adapter (PCI-Express) (rev 01)


Of course it have ethernet card too.

Let`s go...

First attempt — I tried to set up AP using network-manager.

Everything is configured simply ... But there is a drawback - the configured network is not visible. Generally in any way. This method does not suit us.


Second attemp — I tried to set up AP using wicd.

Everything is configured very simply, like the first attempt. And now the network is visible. But there was another problem - it was not possible to connect to it.


Third attemp — install hostapd and after a little configuring tried to join the network. The second laptop saw the network immediately and connect to it without problems.

My actions step by step.

Let's install hostapd

$sudo apt-get install hostapd


Create config file /etc/hostapd/hostapd.conf with the next lines:












Assign the IP-address to the wi-fi-card

$sudo ifconfig wlan0


Start hostapd

$sudo hostapd /etc/hostapd/hostapd.conf


On another laptop I specify use the address and gate
I specify the password for the connection my_passwd and now all are OK! There is a connection and ping also passes.


Now we need to build a NAT between wireless and wired networks.

It's very simple.

$sudo iptables -A FORWARD -i wlan0 -j ACCEPT

$sudo iptables -A POSTROUTING -t nat -o eth0 -j MASQUERADE

$sudo echo "1" > /proc/sys/net/ipv4/ip_forward


That, in fact, and the whole setup. There is an access point, and the Internet also works through it.