# dhcp problem

## salmonix

Hi there, the problem environment is the following:

WAN > wlan0   "server"    

"server" eth0 > LAN

"server" eth1 > LAN

Now, eth0-1 are: 192.168.1.1-2. 

I use dnsmasq, NOT listening on wlan0. 

The IP range is  *Quote:*   

> dhcp-range=192.168.1.50,192.168.1.60,12h

 

Plus dnsmasq gives 2 addresses fixed by name, and the machine "argos" should always get 192.168.1.11.

Now, the box connected to eth0 gets all fine and works.

The box connected to eth1 fails. /var/log/messages of the "server" has the following:

 *Quote:*   

> May 25 17:05:38 darkstar dnsmasq[4630]: DHCPDISCOVER(eth1) 00:15:f2:6a:be:db 
> 
> May 25 17:05:38 darkstar dnsmasq[4630]: DHCPOFFER(eth1) 192.168.1.11 00:15:f2:6a:be:db 
> 
> May 25 17:05:41 darkstar dnsmasq[4630]: DHCPDISCOVER(eth1) 00:15:f2:6a:be:db 
> ...

 

The requester machine "argos" eth0 MAC address if properly shown as 00:15:f2:6a:be:db  and the IP would be 192.168.1.11. Still, argos sees no IP address, no connection, even when I try to set the IP on argos manually.

Anyone?

----------

## SeaTiger

Not sure if it is typo or copy from dhcpd.conf, your dhcp range is 

```
dhcp-range=x.y.z.50,x.y.z.60,12h
```

That is from 50 to 60, and 11 is not inside that range.

----------

## magic919

You seem to have various, unconnected, problems here.  If you don't get connectivity when you manually set the address on the machine you can't pin that on dnsmasq.

Turn on log-dhcp to find out the details of the DHCP chit-chat.  I expect the client machine is the problem.

2 NICs on the same subnet.  What's that all about?

Hmmm.

----------

## salmonix

 *junksiu wrote:*   

> Not sure if it is typo or copy from dhcpd.conf, your dhcp range is 
> 
> ```
> dhcp-range=x.y.z.50,x.y.z.60,12h
> ```
> ...

 

You are right, but the line for fixed IPs - that I truly not copied here - needs not be in the dynamic range. My bad that I missed that piece of info.

----------

## salmonix

 *magic919 wrote:*   

> You seem to have various, unconnected, problems here.  If you don't get connectivity when you manually set the address on the machine you can't pin that on dnsmasq.
> 
> Turn on log-dhcp to find out the details of the DHCP chit-chat.  I expect the client machine is the problem.
> 
> 2 NICs on the same subnet.  What's that all about?
> ...

 

Ok. Working on it.

2 NICs on the same subnet - the PC acts as a router. Now, why not to keep the other boxes connected to it on the same nw like on a real router? It meant to me that then the 2 eth's on the "server" must be on the same nw...

----------

## magic919

I see.  You are trying to use the server as a network switch then.  Not just as a router.  I wouldn't do this unless you fully understand it.

----------

## cyrillic

You would need to setup a bridge in order to have both ethernet cards working on the same subnet.

----------

## SeaTiger

I completely missed the problem of eth0 and eth1 are on the same netowrk till cyrillic point it out.

Actually if the 2 network cards are on the same network, it is a waste as only 1 will be use as the limitation of network routing within the machine. If you want 2 ips on the same network for the box, you can assign additional ips to eth0.

----------

## salmonix

cyrillic: I've just thought about it but never done it. (Eth. bridging.) I wanted to find a different solution.

magic919: I think yes. But with a hint I can probably try to understand it.  :Wink: 

junksiu: adding additional ips - I do not fully understand what You mean.

Thanx for replies!

----------

## cyrillic

 *salmonix wrote:*   

> cyrillic: I've just thought about it but never done it. (Eth. bridging.) I wanted to find a different solution.
> 
> 

 

The better (and easier) solution is to just use 1 ethernet card plus a switch, instead of making your computer into a switch.

----------

## SeaTiger

It is possible to have more than one IP on a network interface.

For example, 192.168.1.1 and 192.168.1.2 can be assigned to eth0:

```
ifconfig eth0 192.168.1.1/24

ifconfig eth0:1 192.168.1.2/24
```

----------

## salmonix

 *cyrillic wrote:*   

>  *salmonix wrote:*   cyrillic: I've just thought about it but never done it. (Eth. bridging.) I wanted to find a different solution.
> 
>  
> 
> The better (and easier) solution is to just use 1 ethernet card plus a switch, instead of making your computer into a switch.

 

I have no switch and not planning to buy one. But I have some 4 spare eth cards for 4 empty slots....   :Smile: 

The traffic is limited - only one "server" and 3 pc-s, home use, nothing heavy load, all behind a router.

Why eth.bridg. is less advised and where can I find info on it? Could U please help?

----------

## salmonix

 *junksiu wrote:*   

> It is possible to have more than one IP on a network interface.
> 
> For example, 192.168.1.1 and 192.168.1.2 can be assigned to eth0:
> 
> ```
> ...

 

I know this option but never thought about it because I want to give IP's of the same network for 2 interfaces (or 1 IP for 2 eth's).

Bur probably I will make 2 subnets and some name resolution would do for the time... but I  keep the thread UNSOLVED for this is not that I wanted to.

----------

