My Android phone is trying to get DHCP address through WiFi connection, but fails.
Obviously, I might have messed up something in my settings because I couldn't find a complete guide which would let me do everything in one go, thus I had to combine multiple guides, but I still feel a bit new to network configuration on Linux.
What I want to achieve:
- create a WiFi access point and DHCP server where all devices receive IP adresses in the same network. Internet access not required, so no routing needed - just a local network where my server acts as a switch (bridge) providing IP adresses for all devices connected to it through WiFi or Ethernet.
Here's what I have:
a Linux machine (actually, Raspberry Pi with Raspbian) with Ralink RT5370 WiFi dongle (which claims to support Access Point) and two Ethernet ports - one is RPi's built-in port and the other is Trendnet TU2-ET100 (chip AX88772)
I have installed bridge-utils and dnsmasq and everything works fine with Ethernet connections - all devices connected to RPi Ethernet ports receive their IP addresses from RPi through dnsmasq
I have installed hostapd and configured it to be open AP, for starters. I tried to use WPA, but on my Android phone that also failed with "Authentication failure", so I disabled auth. And now my Android device gets stuck while acquiring IP address and then fails.
Here are my config files:
/etc/default/hostapd:
interface=wlan0
hw_mode=g
bridge=br0
channel=1
ssid=FakeTestServer_AP
auth_algs=1
wmm_enabled=0
/etc/default/hostapd:
DAEMON_CONF="/etc/hostapd/hostapd.conf"
/etc/network/interfaces:
auto lo
iface lo inet loopback
auto br0
iface eth0 inet manual
iface eth1 inet manual
iface br0 inet static
bridge_ports eth0 eth1 wlan0
bridge_stp off
bridge_fd 0
bridge_waitport 0
bridge_maxwait 0
address 10.0.0.1
netmask 255.255.255.0
/etc/dnsmasq.conf:
interface=br0
dhcp-range=10.0.0.2,10.0.0.254,255.255.255.0,12h
Here is what ifconfig
shows:
br0 Link encap:Ethernet HWaddr 00:14:d1:da:c7:dc
inet addr:10.0.0.1 Bcast:10.0.0.255 Mask:255.255.255.0
inet6 addr: fe80::214:d1ff:feda:c7dc/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1343 errors:0 dropped:0 overruns:0 frame:0
TX packets:212 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:83674 (81.7 KiB) TX bytes:16750 (16.3 KiB)
eth0 Link encap:Ethernet HWaddr b8:27:eb:74:1f:8c
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:5824 errors:0 dropped:0 overruns:0 frame:0
TX packets:2800 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1448587 (1.3 MiB) TX bytes:1057796 (1.0 MiB)
eth1 Link encap:Ethernet HWaddr 00:14:d1:da:c7:dc
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:5353 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:1145578 (1.0 MiB) TX bytes:414153 (404.4 KiB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:52 errors:0 dropped:0 overruns:0 frame:0
TX packets:52 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:3744 (3.6 KiB) TX bytes:3744 (3.6 KiB)
mon.wlan0 Link encap:UNSPEC HWaddr 00-C1-40-95-0D-43-00-00-00-00-00-00-00-00-00-00
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:7417 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:2107086 (2.0 MiB) TX bytes:0 (0.0 B)
wlan0 Link encap:Ethernet HWaddr 00:c1:40:95:0d:43
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:182 errors:0 dropped:0 overruns:0 frame:0
TX packets:122 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:31498 (30.7 KiB) TX bytes:21682 (21.1 KiB)
To make it clear, I repeat - the bridge and both Ethernet connections work fine, and there are no any errors when I run:
sudo service hostapd restart
sudo service dnsmasq restart
sudo service networking restart
At the very beginning bridge-utils failed with a message
can't add wlan0 to bridge br0: Operation not supported
but after I added bridge=br0
to hostapd settings, bridge-utils did not complain anymore, so I guess, wlan0 got added to the bridge but I'm not sure what's going on there.
How do I get my WiFi working in Access Point mode and be part of the same bridge as both eth0 and eth1 are?