Spróbowałem jeszcze raz zaczynając od czystego Debiana. Korzystałem z tego artykułu: http://www.dobreprogramy.pl/parranoya/B … 39946.html
- Konfiguracja interface wlan0, który łączy się z internetem.
Plik /etc/network/interfaces:
auto lo
iface lo inet loopback
iface eth0 inet dhcp
allow-hotplug wlan0
iface wlan0 inet dhcp
wpa-essid MY
wpa_psk ***
iface default inet dhcp
ifconfig
eth0 Link encap:Ethernet HWaddr b8:27:eb:3b:13:20
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:8 errors:0 dropped:0 overruns:0 frame:0
TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1104 (1.0 KiB) TX bytes:1104 (1.0 KiB)
wlan0 Link encap:Ethernet HWaddr a0:f3:c1:0d:fc:e2
inet addr:192.168.0.105 Bcast:192.168.0.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:10831 errors:0 dropped:0 overruns:0 frame:0
TX packets:4954 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:14127141 (13.4 MiB) TX bytes:513115 (501.0 KiB)
iwconfig
wlan0 IEEE 802.11bgn ESSID:"MY"
Mode:Managed Frequency:2.412 GHz Access Point: 34:08:04:06:F4:E0
Bit Rate=54 Mb/s Tx-Power=20 dBm
Retry long limit:7 RTS thr:off Fragment thr:off
Power Management:off
Link Quality=41/70 Signal level=-69 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:6 Missed beacon:0
lo no wireless extensions.
eth0 no wireless extensions.
-
Przejście na ssh, połączenie przez wlan0 3. Wpięcie drugiej karty, interface wlan1 4. Instalacja hostapd. 5. Konfiguracja hostapd Plik /etc/hostapd/hostapd.conf
interface=wlan1
driver=nl80211
ssid=Nazwa-SSID
country_code=PL
ieee80211d=1
hw_mode=g
channel=11
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase=hasło-dostępu-do-sieci
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP CCMP
rsn_pairwise=TKIP CCMP
logger_syslog=4
logger_syslog_level=4
logger_stdout=4
logger_stdout_level=4
Plik /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=""
-
Uruchomienie hostapd. Sieć wifi istnieje. Można się podłączyć. 7.Konfiguracja interface wlan1 plik /etc/network/interfaces
auto lo
iface lo inet loopback
iface eth0 inet dhcp
allow-hotplug wlan0
iface wlan0 inet dhcp
wpa-essid MY
wpa_psk ***
auto wlan1
iface wlan1 inet static
address 192.168.20.1
netmask 255.255.255.0
network 192.168.20.0
broadcast 192.168.20.255
iface default inet dhcp
8.Instalacja isc-dhcp-server 9.Konfiguracja isc-dhcp-server plik /etc/dhcp/dhcpd.conf
option domain-name "example.com";
option domain-name-servers 208.67.222.222, 208.67.220.220;
option routers 192.168.20.1;
default-lease-time 3600;
subnet 192.168.20.0 netmask 255.255.255.0 {
range 192.168.20.2 192.168.20.20;
}
plik /etc/default/isc-dhcp-server
# Defaults for isc-dhcp-server initscript
# sourced by /etc/init.d/isc-dhcp-server
# installed at /etc/default/isc-dhcp-server by the maintainer scripts
#
# This is a POSIX shell fragment
#
# Path to dhcpd's config file (default: /etc/dhcp/dhcpd.conf).
#DHCPD_CONF=/etc/dhcp/dhcpd.conf
# Path to dhcpd's PID file (default: /var/run/dhcpd.pid).
#DHCPD_PID=/var/run/dhcpd.pid
# Additional options to start dhcpd with.
# Don't use options -cf or -pf here; use DHCPD_CONF/ DHCPD_PID instead
#OPTIONS=""
# On what interfaces should the DHCP server (dhcpd) serve DHCP requests?
# Separate multiple interfaces with spaces, e.g. "eth0 eth1".
INTERFACES="wlan1"
10.Uruchonienie isc-dhcp-server, które kończy się niepowodzeniem Komunikat błędu:
pi@raspberrypi ~ $ sudo service isc-dhcp-server start
[FAIL] Starting ISC DHCP server: dhcpd[....] check syslog for diagnostics. ... failed!
failed!
11.Po restarcie isc-dhcp-server startuje 12.Włączenie przekazywania w pliku /etc/sysctl.conf
net.ipv4.ip_forward=1
13.Włączenie funkcji NAT
iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
14.I wiecie co? Działa!