Não tenho certeza sobre como fazer isso sem prejudicar o NM, mas é possível executar automaticamente na inicialização e obter endereços IP para atribuir facilmente (pelo menos eu consegui isso com a mesma placa sem fio). Isso requer os pacotes hostapd
e dnsmasq
(não dnsmasq-base
)
/etc/hostapd/hostapd.conf:
interface=wlan0
driver=nl80211 # This works on my TL-WN722N
ssid=______
channel=6
hw_mode=g
auth_algs=1
wpa=3
wpa_passphrase=_____
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP CCMP
rsn_pairwise=CCMP
/ 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"
# 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=""
/etc/dnsmasq.conf (diff contra a versão do mantenedor):
--- /etc/dnsmasq.conf.dpkg-dist 2011-09-20 00:28:30.000000000 +0100
+++ /etc/dnsmasq.conf 2012-02-13 21:03:03.713554612 +0000
@@ -82,7 +82,7 @@
# specified interfaces (and the loopback) give the name of the
# interface (eg eth0) here.
# Repeat the line for more than one interface.
-#interface=
+interface=wlan0
# Or you can specify which interface _not_ to listen on
#except-interface=
# Or which to listen on by address (remember to include 127.0.0.1 if
@@ -133,7 +133,7 @@
# a lease time. If you have more than one network, you will need to
# repeat this for each network on which you want to supply DHCP
# service.
-#dhcp-range=192.168.0.50,192.168.0.150,12h
+dhcp-range=192.168.3.10,192.168.3.49,12h
# This is an example of a DHCP range where the netmask is given. This
# is needed for networks we reach the dnsmasq DHCP server via a relay
/ etc / network / interfaces:
auto lo
iface lo inet loopback
auto wlan0
iface wlan0 inet static
address 192.168.3.1/24
broadcast 192.168.3.255
Patch /etc/sysctl.conf (execute sudo sysctl -p /etc/sysctl.conf
após a alteração):
--- sysctl.conf 2012-05-14 18:06:57.514873009 +0100
+++ /etc/sysctl.conf 2012-05-14 18:09:27.122876525 +0100
@@ -25,7 +25,7 @@
#net.ipv4.tcp_syncookies=1
# Uncomment the next line to enable packet forwarding for IPv4
-#net.ipv4.ip_forward=1
+net.ipv4.ip_forward=1
# Uncomment the next line to enable packet forwarding for IPv6
# Enabling this option disables Stateless Address Autoconfiguration
Por fim, configure o NAT em iptables
:
sudo iptables -A FORWARD -o eth0 -i eth1 -s 192.168.0.0/24 -m conntrack --ctstate NEW -j ACCEPT
sudo iptables -A FORWARD -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
sudo iptables -A POSTROUTING -t nat -j MASQUERADE
sudo iptables-save | sudo tee /etc/iptables.sav
e adicione iptables-restore < /etc/iptables.sav
acima de exit 0
em /etc/rc.local
.
Essa configuração foi implementada principalmente lendo este