Gentoo Archives: gentoo-user

From: Cor Legemaat <cor@××××××.net>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Configuring hostapd
Date: Mon, 17 Aug 2015 04:58:02
Message-Id: 1439787484.11847.5.camel@cor.za.net
In Reply to: Re: [gentoo-user] Configuring hostapd by Fernando Rodriguez
1 On Mon, 2015-08-10 at 15:20 -0400, Fernando Rodriguez wrote:
2 > On Monday, August 10, 2015 8:59:27 AM Cor Legemaat wrote:
3 > > On Thu, 2015-08-06 at 23:41 -0400, Fernando Rodriguez wrote:
4 > > > On Thursday, August 06, 2015 7:04:27 AM Cor Legemaat wrote:
5 > > > > On Wed, 2015-08-05 at 01:00 -0400, Fernando Rodriguez wrote:
6 > > > > > On Tuesday, August 04, 2015 8:18:43 PM Cor Legemaat wrote:
7 > > > > > > On Sun, 2015-08-02 at 19:56 -0400, Fernando Rodriguez
8 > > > > > > wrote:
9 > > > > > > > On Sunday, August 02, 2015 11:12:07 PM Mick wrote:
10 > > > > > > > > On Sunday 02 Aug 2015 22:04:41 Fernando Rodriguez
11 > > > > > > > > wrote:
12 > > > > > > > > > On Sunday, August 02, 2015 1:29:50 PM Mick wrote:
13 > > > > > > > > > > On Sunday 02 Aug 2015 01:50:21 Fernando Rodriguez
14 > > > > > > > > > > wrote:
15 > > > > > > > > > > > Hello,
16 > > > > > > > > > > >
17 > > > > > > > > > > > After installing hostapd I can successfully
18 > > > > > > > > > > > connect
19 > > > > > > > > > > > to
20 > > > > > > > > > > > the
21 > > > > > > > > > > > AP, I can
22 > > > > > > > > > > > get DHCP from it, but I cannot access the network
23 > > > > > > > > > > > through it
24 > > > > > > > > > > > (neither
25 > > > > > > > > > > > lan or internet).
26 > > > > > > > > > >
27 > > > > > > > > > > This sounds like a (network) routing problem,
28 > > > > > > > > > > rather
29 > > > > > > > > > > than a
30 > > > > > > > > > > hostapd
31 > > > > > > > > > > issue.
32 > > > > > > > > >
33 > > > > > > > > > It looks like that, but if I stop iptables
34 > > > > > > > > > completely on
35 > > > > > > > > > the
36 > > > > > > > > > router all
37 > > > > > > > > > unicast traffic still works in the lan (both wired
38 > > > > > > > > > and
39 > > > > > > > > > through
40 > > > > > > > > > an external
41 > > > > > > > > > AP), so if I connect to the hostapd AP with iptables
42 > > > > > > > > > off,
43 > > > > > > > > > shouldn't I at
44 > > > > > > > > > the very least be able to ping the wireless
45 > > > > > > > > > interface on
46 > > > > > > > > > the
47 > > > > > > > > > router?
48 > > > > > > > > >
49 > > > > > > > > > I also tried with only the following rule which
50 > > > > > > > > > enables
51 > > > > > > > > > internet
52 > > > > > > > > > access to
53 > > > > > > > > > all wired workstations and through external AP:
54 > > > > > > > > >
55 > > > > > > > > > iptables -t nat -A POSTROUTING -o enp0s8 -j
56 > > > > > > > > > MASQUERADE
57 > > > > > > > >
58 > > > > > > > > You should probably specify the local subnet, so that
59 > > > > > > > > multicast packets are
60 > > > > > > > > not sent out to the Internet, e.g.:
61 > > > > > > > >
62 > > > > > > > > iptables -t nat -A POSTROUTING -o enp0s8 -s
63 > > > > > > > > 192.168.1.0/24
64 > > > > > > > > ! -d
65 > > > > > > > 192.168.1.0/24
66 > > > > > > > > -j MASQUERADE
67 > > > > > > > >
68 > > > > > > > > (Change 192.168.1.0/24 to suit your LAN subnet)
69 > > > > > > >
70 > > > > > > > I'm not actually using that rule except as a minimal
71 > > > > > > > setup
72 > > > > > > > for troubleshooting
73 > > > > > > > this issue. My actual rules do specify the subnet.
74 > > > > > > >
75 > > > > > > > > Also have you enabled ip forwarding in your kernel:
76 > > > > > > > >
77 > > > > > > > > sysctl -w net.ipv4.ip_forward=1
78 > > > > > > >
79 > > > > > > > Yes, it is an existing router that works perfectly except
80 > > > > > > > for the hostapd AP.
81 > > > > > > > My current setup is as follows:
82 > > > > > > >
83 > > > > > > > Internet -> Gentoo Router -> Switch -> AP
84 > > > > > > >
85 > > > > > > > Where AP is a wifi router with routing features disabled.
86 > > > > > > > Never had
87 > > > > > > > problems
88 > > > > > > > with it. Now I installed hostapd on "Gentoo Router" and
89 > > > > > > > everything
90 > > > > > > > else still
91 > > > > > > > works fine except when I connect to the hostapd AP. Even
92 > > > > > > > with only
93 > > > > > > > that minimal
94 > > > > > > > iptable rule or no rules at all.
95 > > > > > > >
96 > > > > > > > Thanks,
97 > > > > > > >
98 > > > > > > Probably /dev/random depleated, try enable your hardware
99 > > > > > > rng
100 > > > > > > or sys-
101 > > > > > > apps/haveged test with `cat
102 > > > > > > /proc/sys/kernel/random/entropy_avail`
103 > > > > > >
104 > > > > > > Regards:
105 > > > > > > Cor
106 > > > > >
107 > > > > > Thanks. II did get an error about depleted entropy at some
108 > > > > > point when starting
109 > > > > > hostapd but I went ahead and installed haveged and it still
110 > > > > > doesn't work. It
111 > > > > > doesn't even work when configured as an open AP. I checked
112 > > > > > the kernel config and
113 > > > > > I had VLAN support disabled. I've rebuilt it but can't
114 > > > > > reboot right now. Maybe
115 > > > > > it's required even though I'm not using VLANs?
116 > > > > >
117 > > > > Is there an IP configured on the interface or the bridge of
118 > > > > that interface?
119 > > >
120 > > > Yes
121 > > >
122 > > > > Can you ping your gateway?
123 > > >
124 > > > No...I can ping it locally or remotely when I connect through
125 > > > the external AP
126 > > > but not through hostapd.
127 > > >
128 > > > > If I'm correct dhcp uses
129 > > > > broadcast but you need a valid gateway IP switchable on mac
130 > > > > layer.
131 > > > >
132 > > > > Does it stay connected?
133 > > >
134 > > > Yes
135 > > >
136 > > > > I have a problem with a link between hostapd
137 > > > > and a mikrotik device on 802.11a where I needed to patch
138 > > > > hostapd to get it to stay connected. But that should show in
139 > > > > hostapd debug logs. Mine is still running on hostapd-2.3
140 > > > > because if I update and screw it my internet is broken, if
141 > > > > that's your problem I will search for my notes and mail it.
142 > > >
143 > > > Tried hostapd-2.3 too, same thing.
144 > > > I will try it on a laptop with a more recent adapter tomorrow to
145 > > > rule that
146 > > > out.
147 > > >
148 > > > > Regards: Cor
149 > > >
150 > > If you stay connected I would assume your hostapd setup and key is
151 > > correct, otherwise you wouldn't receive a dhcp answer. That must
152 > > be an IP config/iptables problem but very difficult to help if I
153 > > can't see your setup.
154 > >
155 > > Regards:
156 > > Cor
157 >
158 > I used only this rule for testing:
159 > iptables -t nat -A POSTROUTING -o enp0s8 -j MASQUERADE
160 >
161 > I tested on a laptop and the same setup works with one minor issue,
162 > bringing
163 > up the wireless interface creates a routing table entry that tries
164 > to route
165 > LAN traffic through the wireless interface so I can't access the
166 > wired LAN or
167 > internet (since it has to go through the gateway) until I delete it
168 > manually,
169 > but I can still access the laptop through the wireless interface.
170 >
171 > Other than that the differences are that the laptop uses ath9k
172 > whereas the
173 > router uses ath5k and the router uses the gentoo-sources-3.18.12 and
174 > laptop
175 > currently has 4.0.6 from git.
176 >
177 Wat is the output of:
178 * for table in filter nat mangle raw security; do echo Table\
179 $table: && iptables -t $table -L -v --line-numbers; done
180 * ifconfig -a
181 * ip route show
182 * brctl show
183
184 Regards:
185 Cor

Attachments

File name MIME type
signature.asc application/pgp-signature