Artmetic Atheros TP-Link TL-WN322G as Wi-Fi Access Point on Ubuntu/Linux using Hostpd

Atheros TP-Link TL-WN322G as Wi-Fi Access Point on Ubuntu/Linux using Hostpd

If you have Wi-Fi usb Atheros TL-WN322G v3 or something similar, after running the following command, you can create your own network:

 lsusb

Bus 001 Device 003: ID 0cf3:1006 Atheros Communications, Inc. TP-Link TL-WN322G v3 / TL-WN422G v2 802.11g [Atheros AR9271]
Bus 001 Device 002: ID 04e8:61b3 Samsung Electronics Co., Ltd
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 005 Device 005: ID 1c4f:0002 SiGma Micro Keyboard TRACER Gamma Ivory
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

You can create your own wi-fi network by dowloading package hostapd:

 sudo apt-get install hostapd

Creating your config file, and attributing its location in file /etc/default/hostapd:

 sudo nano /etc/default/hostapd

# Defaults for hostapd initscript
#
# See /usr/share/doc/hostapd/README.Debian for information about alternative
# methods of managing hostapd.
#
# Uncomment and set DAEMON_CONF to the absolute path of a hostapd configuration
# file and hostapd will be started during system boot. An example configuration
# file can be found at /usr/share/doc/hostapd/examples/hostapd.conf.gz
#
DAEMON_CONF="/etc/hostapd/hostapd.conf"</p>
<p style="text-align: justify;"># Additional daemon options to be appended to hostapd command:-
# -d show more debug messages (-dd for even more)
# -K include key data in debug messages
# -t include timestamps in some debug messages
#
# Note that -B (daemon mode) and -P (pidfile) options are automatically
# configured by the init.d script and must not be added to DAEMON_OPTS.
#
#DAEMON_OPTS=""</p>

After that you can config your file /etc/hostapd/hostapd.conf

 sudo nano /etc/hostapd/hostapd.conf
interface=LAN # Your interface for example wlan0 or wlan1
driver=nl80211
hw_mode=g
channel=6
logger_syslog=-1
logger_syslog_level=2
logger_stdout=-1
logger_stdout_level=2
debug=0
dump_file=/tmp/hostapd.dump
ctrl_interface=/var/run/hostapd
ctrl_interface_group=0
ssid=MyLocalWiFi #  *** name of your network ***
#macaddr_acl=1
#accept_mac_file=/etc/hostapd/accept
auth_algs=3
eapol_key_index_workaround=0
eap_server=0
auth_algs=3
max_num_sta=10
wpa=2
#wpa_psk_file=/etc/hostapd/wpa_psk
wpa_passphrase=MYSecretPassword # *** Your password to wi-fi ***
wpa_key_mgmt=WPA-PSK
#wpa_pairwise=TKIP CCMP
rsn_pairwise=CCMP
#stakey=0

Remember to change your password, name of network and interface name. Remember to configure your /etc/network/interfaces file:

 sudo nano /etc/network/interfaces
auto LAN
iface LAN inet static
address 10.1.1.1
netmask 255.255.255.0

and create subnet in your /etc/dhcp/dhcpd.conf file:

 sudo nano /etc/dhcp/dhcpd.conf
subnet 10.1.1.0 netmask 255.255.255.0 {
interface "LAN"; #   *** you must change tou your wlan0 or wlan1 ***
option subnet-mask 255.255.255.0;
range 10.1.1.5 10.1.1.60;
# option 10.1.1.1;
option domain-name "example.pl";
option domain-name-servers 8.8.8.8, 8.8.4.4;
option routers 10.1.1.1;
option broadcast-address 10.1.1.255;
default-lease-time 600;
max-lease-time 7200;
# deny unknown-clients; #  *** If you wan't denied not defined hosts ***
}
<p style="text-align: justify;">host laptop {
hardware ethernet XX:B9:XX:1D:XX:97;  # *** your client computer mac address if you want the same ip address all the time (you must change) ***
fixed-address 10.1.1.5;
}

After that restart your deamons:

 sudo /etc/init.d/isc-dhcp-server restart
 sudo /etc/init.d/hostapd restart

Remember to forward packets and use for example IPTABLES MASQUARADE to connect via another interface to the internet.

1 thought on “Atheros TP-Link TL-WN322G as Wi-Fi Access Point on Ubuntu/Linux using Hostpd”

  1. Woah! I’m really digging the template/theme of this website.
    It’s simple, yet effective. A lot of times it’s very difficult to get that
    „perfect balance” between superb usability and visual appearance.
    I must say you’ve done a awesome job with this. Additionally, the blog
    loads super quick for me on Internet explorer.
    Outstanding Blog! http://www.yahoo.net

Leave a Reply

Twój adres email nie zostanie opublikowany. Pola, których wypełnienie jest wymagane, są oznaczone symbolem *

Witryna wykorzystuje Akismet, aby ograniczyć spam. Dowiedz się więcej jak przetwarzane są dane komentarzy.