[Resolved] Android unable to obtain IP from DHCP - Centos

Issues related to configuring your network
spec
Posts: 6
Joined: 2017/11/30 08:25:16

[Resolved] Android unable to obtain IP from DHCP - Centos

Post by spec » 2017/11/30 09:49:57

Hi Folks,
I've been playing around with Centos for a while now writing custom rules etc to use it as an internet gateway for some network devices (cameras) which I don't completely trust to give full internet access.
The firewall side of things are ok, but getting an issue with the DHCP which doesn't seem to play well with Android devices.

Network Setup is as follows:
Main Router <192.168.0.x, DHCP Enabled>
- This is main internet gateway and all house devices are connected to this
Local Router <DHCP off, Static 192.168.1.100>
- This is a router only, Just using the Wifi on this router to so all untrusted devices connect to the CentOS server via DHCP
CentOS <192.168.1.1, DHCP enabled 192.168.1.15 to 192.168.1.28, and some static assignments between 192.168.1.2 to 192.168.1.5>
- This is the DHCP and Internet Gateway for devices connected to the private network. The machine has 2 interfaces, eth and wlan.
eth is connected to local only network to the local router. wlan is connected to the internet router and CentOS has internet access.
I've got firewall rules to route traffic to the internet from devices in the 15-28 range only, blocked for all others (these work - no issues)

The issue I have is that Windows and Linux laptops are able to connect to the Local Router wifi and they get the DHCP IP address from CentOS, but Android devices don't work.
I've got couple of Samsung phones - 1 is Android 4.x, another is 6.x another is latest 7.x neither of these connect to the DHCP.
No messages in the /var/log/messages to indicate any errors from DHCP.
Any other device connecting to this network, I can see DHCP lines and lease being issued and they work properly.

iptables firewall is enabled on CentOS, but disabling this doesn't make any difference either.

Any assistance appreciated.

-----------------------------------
File - /etc/dhcp/dhcpd.conf
----------------------------------
###
option domain-name "kaboomtemp.com";
option domain-name-servers 8.8.8.8, 8.8.4.4; #Using Google DNS
default-lease-time 86400;
max-lease-time 86400;
ddns-update-style none;
authoritative;

subnet 192.168.1.0 netmask 255.255.255.0 {
range dynamic-bootp 192.168.1.15 192.168.1.28;
option broadcast-address 192.168.1.255;
option routers 192.168.1.1;
}

# IP Address Reservations
host cam1 {
hardware ethernet hh:hh:hh:hh:hh:hh;
fixed-address 192.168.1.2;
}
host cam2 {
hardware ethernet hh:hh:hh:hh:hh:hh;
fixed-address 192.168.1.3;
}
-----------------------------------------

Machine: Lenovo X230
CentOS release 6.9 (Final)

Name : dhcp
Arch : x86_64
Epoch : 12
Version : 4.1.1
Release : 53.P1.el6.centos.1

Name : iptables
Arch : x86_64
Version : 1.4.7
Release : 16.el6
Last edited by spec on 2017/12/02 02:11:55, edited 1 time in total.

User avatar
jlehtone
Posts: 4530
Joined: 2007/12/11 08:17:33
Location: Finland

Re: Android unable to obtain IP from DHCP - Centos

Post by jlehtone » 2017/11/30 12:10:55

spec wrote:Network Setup is as follows:
* Main Router <192.168.0.x, DHCP Enabled> -- "MR"
* Local Router <DHCP off, Static 192.168.1.100> -- "LR"
* CentOS <192.168.1.1, DHCP enabled> -- "CS"
Not quite sure what you have.

Is it this?

Code: Select all

ISP =A= MR -B- CS =C= LR -C- wifi client
= wired
- wireless
* The ISP hands the MR an address from subnet A
* The MR hands connected devices addresses from subnet B (192.168.0.x/y)
* The CS hands addresses for devices from subnet C (192.168.1/24, eth)
* The LR is a mere access point for wireless clients in subnet C

Note: LR is not "only router". It is not a router at all. It is a mere bridge between wired and wireless parts of subnet C. An access point (AP, WAP).

Can the phones show any diagnostics?
Do they see the LR's SSID?
Do they negotiate WiFi link (without getting IP)?
Does the LR see the phones?
If you do listen eth on CS with 'tcpdump', are there any traffic when a phone attempts to connect to LR?

spec
Posts: 6
Joined: 2017/11/30 08:25:16

Re: Android unable to obtain IP from DHCP - Centos

Post by spec » 2017/11/30 12:25:48

Correct that is the setup I have.
And yes, LR is actually an access point only, since it doesn't to DHCP/NAT anything. Purely a wireless AP.
jlehtone wrote:Can the phones show any diagnostics?
Do they see the LR's SSID?
Do they negotiate WiFi link (without getting IP)?
Does the LR see the phones?
If you do listen eth on CS with 'tcpdump', are there any traffic when a phone attempts to connect to LR?
Phones don't have any diagnostics - since they're not rooted or anything - just plain samsung
Yes, they can see the LR SSID and can connect.
Yes, the can negotiate WiFi, if I deliberately provide incorrect wifi access password, they wont connect.

I haven't tried tcpdump yet, haven't run this on linux before - will try this next.
But before that I'm hoping someone has previously tried to connect Android phones to Centos based DHCP successfully before.

User avatar
jlehtone
Posts: 4530
Joined: 2007/12/11 08:17:33
Location: Finland

Re: Android unable to obtain IP from DHCP - Centos

Post by jlehtone » 2017/11/30 13:30:27

There is also package 'dnsmasq' that acts as DHCP server, DNS server, and TFTP server (if desired).
It is, IMHO, simpler to set up than the ISC DHCP.

Many consumer routers (like your MR and LR?) do have dnsmasq. Hence "known to work".

User avatar
TrevorH
Site Admin
Posts: 33215
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Android unable to obtain IP from DHCP - Centos

Post by TrevorH » 2017/11/30 16:38:13

I run dhcpd on 2 CentOS machines in failover mode and I have a house full of android kit that doesn't have a problem. I use a Ubiqiti AP-AC-LR access point but it and its clients obtain ip addresses from dhcpd on CentOS 7.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

spec
Posts: 6
Joined: 2017/11/30 08:25:16

Re: Android unable to obtain IP from DHCP - Centos

Post by spec » 2017/11/30 21:08:13

TrevorH wrote:I run dhcpd on 2 CentOS machines in failover mode and I have a house full of android kit that doesn't have a problem. I use a Ubiqiti AP-AC-LR access point but it and its clients obtain ip addresses from dhcpd on CentOS 7.
Are both your CentOS machines v7 ?
Is there is a v6 machine, can you check the dhcpd version - see if it matches mine.
Also, if you could, please check my dhcpd.conf in my original post - maybe there's some option in there which is missing from my config.

I may try dnsmasq if all else fails.

spec
Posts: 6
Joined: 2017/11/30 08:25:16

Re: Android unable to obtain IP from DHCP - Centos

Post by spec » 2017/11/30 23:12:49

ok, I tried tcpdump and the results are unexpected.
Command used -> tcpdump -nn -t -i eth0
(eth0 is connected to the router)

When I connect a windows laptop via wifi; I get
IP 0.0.0.0.68 > 255.255.255.255.67: BOOTP/DHCP, Request from <windows mac>, length 309
IP 192.168.1.15.63038 > 224.0.0.252.5355: UDP, length 27
IP 192.168.1.1.67 > 255.255.255.255.68: BOOTP/DHCP, Reply, length 300
ARP, Request who-has 192.168.1.1 tell 192.168.1.15, length 46
ARP, Reply 192.168.1.1 is-at <centos mac>, length 28

But when I connect Android to the same wifi; I get no lines in tcpdump - i.e nothing is captured.

Whoever
Posts: 1361
Joined: 2013/09/06 03:12:10

Re: Android unable to obtain IP from DHCP - Centos

Post by Whoever » 2017/12/01 04:15:33

TrevorH wrote:I run dhcpd on 2 CentOS machines in failover mode and I have a house full of android kit that doesn't have a problem. I use a Ubiqiti AP-AC-LR access point but it and its clients obtain ip addresses from dhcpd on CentOS 7.
I have only ever found that dhcpd in failover mode reduces network reliability. Because you now have two servers, you chance of one of the dhcpd processed dying is doubled, and the failover only works for a limited time. dhcpd seems to run continuously for years anyway.

User avatar
jlehtone
Posts: 4530
Joined: 2007/12/11 08:17:33
Location: Finland

Re: Android unable to obtain IP from DHCP - Centos

Post by jlehtone » 2017/12/01 09:32:39

spec wrote:ok, I tried tcpdump and the results are unexpected.

... when I connect Android to the same wifi; I get no lines in tcpdump - i.e nothing is captured.
In other words the issue is somewhere else than the CentOS.

There are three other scenarios that could be tested:
1. Connecting Android to "Main Router".
2. Enabling DHCP on "Local Router" and then connecting Android to it.
3. Turning the CentOS wlan into access point and then connecting Android to it.

You probably have already had 1 or 2 in use. The 3 (if successful) requires a wire between Main Router and CenOS, but removes the need for the "Local Router" AP altogether.

spec
Posts: 6
Joined: 2017/11/30 08:25:16

Re: Android unable to obtain IP from DHCP - Centos

Post by spec » 2017/12/01 20:11:55

jlehtone wrote: There are three other scenarios that could be tested:
1. Connecting Android to "Main Router".
2. Enabling DHCP on "Local Router" and then connecting Android to it.
3. Turning the CentOS wlan into access point and then connecting Android to it.

You probably have already had 1 or 2 in use. The 3 (if successful) requires a wire between Main Router and CenOS, but removes the need for the "Local Router" AP altogether.
I use #1 to connect the phone to the internet - it works, this is how it's usually connected.
#2 does work, but is not what I need, since that will then allow the other devices on that network to direct connect to the internet i.e no control. CentOS gateway was setup to do this.

#3 I might have to research this option, but I suspect this would not meet future needs. I have 2 cameras at the moment and might add 2 more, the amount of traffic would probably choke the CentOS wifi. That's what the local router was for and CentOS is connected to the local router via Lan cable.

Post Reply