Linux – DNSMASQ eth0 doesn’t get an ip address

dnsmasqiptableslinuxnetworking

The information below show's the current contents of my /etc/network/interfaces, /etc/dnsmasq.conf, iptables-save output and /proc/net/ipv4/ip_foward files. From the ifconfig -a information (shown last) you can see that the ETH0 adapter is getting a 169.254.62.167 address instead of an address on the 172.24.1.x network. When I attach to the AP (HOSTAPD) on WLAN0 from my laptop I get a 172.24.1.x address and can ssh into the machine (172.24.1.1) and I can ssh to machines on the 192.168.1.x network.

The ETH0 adapter is connected to a switch with 4 other machines on that network. I would like the ETH0 adapter on the 172.24.1.1 host to get and address from the DNSMASQ pool and I would like the other four machines to get an address from 172.24.1.1 host as well.

I'm willing to statically address everything if needed, however, I'd like to use DHCP if possible.

Any ideas on what I need to do to get the eth0 network to get DHCP addresses from the 172.24.1.1 host and if possible get the other machines that are on the same network (wired to a switch) to request DHCP addresses as well.

/etc/network/interfaces
source-directory /etc/network/interfaces.d

auto lo
iface lo inet loopback

allow-hotplug eth0
iface eth0 inet dhcp

allow-hotplug wlan0
iface wlan0 inet static
   address 172.24.1.1
   netmask 255.255.255.0
   network 172.24.1.0
   broadcast 172.24.1.255

allow-hotplug wlan1
iface wlan1 inet dhcp
  wireless-essid 2WIRE4038
  wireless-mode managed


/etc/dnsmasq.conf
interface=wlan0      
listen-address=172.24.1.1 
bind-interfaces      
server=8.8.8.8       
domain-needed        
bogus-priv           
dhcp-range=172.24.1.50,172.24.1.151,12h 
dhcp-range=interface:eth0,172.24.1.152,172.24.1.202,12h

#iptables-save

*filter
:INPUT ACCEPT [1060:194768]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [665:83883]
-A FORWARD -i wlan1 -o wlan0 -m state --state RELATED,ESTABLISHED -j ACCEPT
-A FORWARD -i wlan0 -o wlan1 -j ACCEPT
COMMIT
*nat
:PREROUTING ACCEPT [192:39054]
:INPUT ACCEPT [81:17177]
:OUTPUT ACCEPT [129:12221]
:POSTROUTING ACCEPT [59:6396]
-A POSTROUTING -o wlan1 -j MASQUERADE
COMMIT

#proc/sys/net/ipv4/ip_forward
1


**#ifconfig -a

eth0      Link encap:Ethernet  HWaddr b8:27:eb:fe:9a:19
          inet addr:169.254.62.167  Bcast:169.254.255.255  Mask:255.255.0.0
          inet6 addr: fe80::be96:d2a7:f81a:6edb/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:6 errors:0 dropped:0 overruns:0 frame:0
          TX packets:92 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:1968 (1.9 KiB)  TX bytes:20881 (20.3 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:416 errors:0 dropped:0 overruns:0 frame:0
          TX packets:416 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1
          RX bytes:32922 (32.1 KiB)  TX bytes:32922 (32.1 KiB)

wlan0     Link encap:Ethernet  HWaddr 74:da:38:6f:5b:c6
          inet addr:172.24.1.1  Bcast:172.24.1.255  Mask:255.255.255.0
          inet6 addr: fe80::f0cb:6dd6:a312:eba0/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:2226 errors:0 dropped:0 overruns:0 frame:0
          TX packets:911 errors:0 dropped:10 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:203720 (198.9 KiB)  TX bytes:208596 (203.7 KiB)

wlan1     Link encap:Ethernet  HWaddr b8:27:eb:ab:cf:4c
          inet addr:192.168.1.210  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::eee2:dff6:a22a:5852/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:518 errors:0 dropped:0 overruns:0 frame:0
          TX packets:213 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:133141 (130.0 KiB)  TX bytes:29096 (28.4 KiB)**

Best Answer

Better way to make this configuration, to make bridge br0 with eth0 and wlan0. Then configure 172.24.1.1 on interface br0, after this you'll have IP address 172.24.1.1 on both interfaces eth0 and wlan0.

There is good answer or article with examples.