# dnsmasq: not providing dhcp to multiple subnets

## CoderMan

Hello. I am a networking newbie, but I did set up a Gentoo home router with three interfaces (one WAN and two LAN) with DNS, DHCP, and NAT services.

The DHCP/DNS service seems to work fine for one subnet, but when I tried to adjust it to two subnets, clients on the new subnet are not able to pick up DHCP services.

The original /etc/dnsmasq contained this:

```
dhcp-range=172.16.0.245,172.16.0.254,1000h

interface=eth0
```

I changed it to this:

```
dhcp-range=172.16.0.245,172.16.0.254,1000h

interface=eth0

dhcp-range=172.16.1.245,172.16.1.254,1000h

interface=eth1
```

Then I restarted dnsmasq, but the test client on the 172.16.1.0/24 subnet still cannot get a lease.

Here is my ifconfig:

```
eth0      Link encap:Ethernet  HWaddr 00:c0:f0:30:f0:44  

          inet addr:172.16.1.1  Bcast:172.16.1.255  Mask:255.255.255.0

          inet6 addr: fe80::2c0:f0ff:fe30:f044/64 Scope:Link

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:21 errors:1 dropped:0 overruns:0 frame:0

          TX packets:8 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000 

          RX bytes:4080 (3.9 KiB)  TX bytes:552 (552.0 B)

          Interrupt:18 Base address:0xc800 

eth1      Link encap:Ethernet  HWaddr 00:1e:e5:d6:24:8d  

          inet addr:172.16.0.1  Bcast:172.16.0.255  Mask:255.255.255.0

          inet6 addr: fe80::21e:e5ff:fed6:248d/64 Scope:Link

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:1812 errors:0 dropped:0 overruns:0 frame:0

          TX packets:1487 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000 

          RX bytes:194179 (189.6 KiB)  TX bytes:779955 (761.6 KiB)

          Interrupt:20 

eth2      Link encap:Ethernet  HWaddr 00:e0:29:43:d4:00  

          inet addr:192.168.227.3  Bcast:192.168.227.255  Mask:255.255.255.0

          inet6 addr: fe80::2e0:29ff:fe43:d400/64 Scope:Link

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:13307 errors:0 dropped:0 overruns:0 frame:0

          TX packets:1354 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000 

          RX bytes:1398863 (1.3 MiB)  TX bytes:148895 (145.4 KiB)

          Interrupt:19 Base address:0x8400 

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:16436  Metric:1

          RX packets:0 errors:0 dropped:0 overruns:0 frame:0

          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0 

          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
```

Interface eth2 is the WAN interface [to a different router], and eth0 and eth1 go to subnets on my private network behind the NAT.

Please direct me as to what I am doing wrong.

----------

## massimo

Instead of

 *CoderMan wrote:*   

> 
> 
> ```
> 
> dhcp-range=172.16.0.245,172.16.0.254,1000h
> ...

 

put

```

interface=eth0

interface=eth1

dhcp-range=eth0,172.16.0.245,172.16.0.254,1000h

dhcp-range=eth1,172.16.1.245,172.16.1.254,1000h

```

----------

## truc

also, it looks like you've mixed up eth0 and eth1 configuration (eth1 should be 172.16.0.1/24 and eth0 172.16.1.1/24 not the other way around).

----------

## CoderMan

Thank you for the help. However, I changed the config file according to your instructions but there does not seem to be any effect.

Perhaps there is something else wrong. I do not know. I know, at least, that there is not a low level network communication problem because I can manual set the ip address of the client PC and ping across the interface.

----------

## CoderMan

I found the problem. I posted the solution on my project page, under the 2010-02-17 post.

----------

## solamour

 *CoderMan wrote:*   

> I found the problem. I posted the solution on my project page, under the 2010-02-17 post.

 

The link seems to be down. Would you care to post your solution here, so that everyone can learn from your valuable experience? Thank you.

__

sol

----------

