K
K
KPEBETKA2014-03-21 21:52:17
DHCP
KPEBETKA, 2014-03-21 21:52:17

How to set up Hostapd + Dhcpd for a couple of clients?

I configured this subject with configs:
hostapd.conf

interface=wlan0
driver=nl80211
ssid=KPEBETKA
channel=6
hw_mode=g
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase=vi776bnh
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
ctrl_interface_group=0
macaddr_acl=0
preamble=1
wmm_enabled=1
ieee80211n=1
ht_capab=[HT40-][HT40+][SHORT-GI-20][SHORT-GI-40][TX-STBC][RX-STBC1][DSSS_CCK-40][LDPC]

dhcpd.conf
ddns-update-style none;

subnet 192.168.1.0 netmask 255.255.255.0 {
        range 192.168.1.2 192.168.1.254;
        option routers 192.168.1.1;
        option domain-name-servers 192.168.0.1;}

interfaces
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

iface wlan0 inet static
address 192.168.1.1
netmask 255.255.255.0
auto wlan0

rc.local
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
iptables -A FORWARD -i wlan0 -j ACCEPT

And everything works until there is more than one client. Those. I connect to the network with one device, I successfully use the network, but as soon as I connect another device, the network immediately falls off. Three days of googling did not lead to anything good ...
The topology is as follows: Internet <- router <- wheelbarrow with the created access point <- clients.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
KPEBETKA, 2014-03-31
@KPEBETKA

The problem, as it turned out, is in the kernel. Rolling back to an earlier version helped.

J
Jan, 2014-03-22
@Buchachalo

And if so:

#!/bin/sh

# Включаем форвардинг пакетов
echo 1 > /proc/sys/net/ipv4/ip_forward

# Разрешаем трафик на loopback-интерфейсе
iptables -A INPUT -i lo -j ACCEPT

# Разрешаем доступ из внутренней сети наружу
iptables -A FORWARD -i eth1 -o eth0 -j ACCEPT

# Включаем NAT, 10.0.0.0 это внутренняя сеть.
iptables -t nat -A POSTROUTING -o eth0 -s 10.0.0.0/24 -j MASQUERADE 

# Разрешаем ответы из внешней сети
iptables -A FORWARD -i eth0 -m state --state ESTABLISHED,RELATED -j ACCEPT

# Запрещаем доступ снаружи во внутреннюю сеть
iptables -A FORWARD -i eth0 -o eth1 -j REJECT

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question