# DHCP works through hub, but not directly through router

## Larry The Cow

I have had my computer's network cable plugged into a hub, which is plugged into a router which is plugged into another router which is plugged into a cable modem. Now I want to plug my computer into the other router, and found that if I plug my computer directly into either router, DHCP does not work. I get 

```
Bringing up eth0 via DHCP...
```

 then hangs for a while, and finally does [!!]. I have tried configuring my network setting manually and not using the DHCP server and I can connect, but I have bad packet loss. If my computer is plugged into the hub, no problems. I have a Via Rhine network card; one router is a Dlink, and the other is a Netgear. Thanks for any help.

----------

## NeddySeagoon

Larry The Cow,

Routers do not normally forward DHCP broadcast requests but they can usually be configured to do so.

How are your routers managed?

----------

## Larry The Cow

The router is configured for DHCP, another computer (running Fedora Core) connects via DHCP fine.

----------

## Larry The Cow

No one knows?  :Sad: 

----------

## think4urs11

Hi,

did you try different settings for your NIC already?

check with ethtool and/or  mii-tool

shoot in the dark:

your router is only capable of 10MB halfduplex and your NIC is set for 100MB fullduplex (or any other non working combination)

HTH

T.

----------

## Larry The Cow

If I have my network up (through the hub) and then run mii-tool, I get: 

```
eth0: no autonegotiation, 10baseT-HD, link ok
```

 then when I switch to the router (without restarting eth0), I get: 

```
eth0: negotiated 100baseTx-FD, link ok
```

 I'm not quite sure what that tells me... How would I set my NIC to the correct duplex? I do not have much experience with network configuration in linux.

----------

## j-m

That basically means that your hub is broken...

----------

## NeddySeagoon

j-m,

 *Quote:*   

> That basically means that your hub is broken...

 

Err, no. Hubs, unlike switches and routers have no internal storage and send all traffic to every port.

This prevents hubs from operating in full duplex mode.

----------

## j-m

 *NeddySeagoon wrote:*   

> 
> 
> Err, no. Hubs, unlike switches and routers have no internal storage and send all traffic to every port.
> 
> This prevents hubs from operating in full duplex mode.

 

I´m not talking about HD/FD, I am talking about the fact that it is only 10Mbps (10baseT-HD)... Or if that is a feature and the hub is really only 10Mbit, I would definitely ditch it and get myself some switch. You can have a decent one for $20 and it does much better job...  :Wink: 

----------

## Larry The Cow

 *j-m wrote:*   

>  *NeddySeagoon wrote:*   
> 
> Err, no. Hubs, unlike switches and routers have no internal storage and send all traffic to every port.
> 
> This prevents hubs from operating in full duplex mode. 
> ...

 

That is all good and well; but right now my problem is that the network does work through the hub, and doesn't work directly through the router. So my problem is not with the hub.

----------

## j-m

 *Larry The Cow wrote:*   

> 
> 
> That is all good and well; but right now my problem is that the network does work through the hub, and doesn't work directly through the router. So my problem is not with the hub.

 

Which router? Sorry, this is a terrible mess. The first router, the second router, or both routers?  :Confused: 

----------

## Larry The Cow

 *Larry The Cow wrote:*   

> ...Now I want to plug my computer into the other router, and found that if I plug my computer directly into either router, DHCP does not work...

  The network does not work through either router, only through the hub (which is plugged into the Dlink router).

```
GentooBox(and others)---------hub-------Dlink--------Netgear-------Internet (ok)

```

```

Other Computers-------hub-------Dlink-----Netgear-----Internet

                                  |

                                  |

                               GentooBox                             (bad)

```

```

Other Computers-------hub-------Dlink-----Netgear-----Internet

                                             |

                                             |

                                          GentooBox                   (bad)

```

----------

## j-m

One more question - which one of those is the DHCP server?  :Embarassed: 

----------

## Larry The Cow

Both routers are configured to be DHCP servers.

----------

## j-m

 *Larry The Cow wrote:*   

> Both routers are configured to be DHCP servers.

 

Now it makes even less sense. Are you sure, that these devices are capable of running like "master"/"slave" DHCP server? Also, from the scheme, DHCP is usually running only on one router interface, not on all of them... 

 :Confused:   :Question: 

----------

## Larry The Cow

They have different IP ranges, I believe this should work.

----------

## Larry The Cow

Also, as I mentioned above, all of this works fine with another computer.

----------

## j-m

It don´t think I will be able to solve this. Some basic troubleshooting would probably include disabling one of the DHCP servers and simplifying things in general. It is extremely difficult to troubleshoot such complex configuration. Turn both routers off to flush ARP tables.  Try only the first router via hub and without hub, only the second router, etc. This is a real mess, sorry.

----------

## Headrush

 *Larry The Cow wrote:*   

> Both routers are configured to be DHCP servers.

 

Why? Why do you have both routers as a DHCP server?

Can you explain your entire network a little clearer and why you are using the two routers? This would help tremendously in solving this problem.

A couple things:

Devices such as your router usually have an option to act as a router or gateway; can you see what yours are set at.

When connecting the 2 routers did you use the uplink port on the routers or just have the second one acting like a dhcp client of the first?

All a hub does is repeat the signal, so it seems odd that when connecting your Gentoo box through the hub your receive DHCP info, but removing the hub you don't receive any DHCP info. Are you connecting into the same ethernet port on the router as when the hub was connected?

You aren't plugging into any uplink ports on the router?

I would really like more info on why 2 DHCP servers, if you explain your reasoning better I think we can find a better more appropriate arrangement.

----------

## NeddySeagoon

Larry The Cow,

Post the router DHCP setups. I need to know the IP ranges served, the network addresses and the gateway address.

The output of the route command from one of the PCs connected to the hub will be useful too.

----------

## ARC2300

We had a similar problem in the dorms at Uni.  Sometimes the routers really, really screw up DHCP for one reason or another on the router the next level up.  Some comps work fine, others totally bomb out.

Just curious, but why are you running two routers in tandem anyways??

----------

## Larry The Cow

http://home.comcast.net/~jeh3pe/Network.png

The reason I have two routers is because I want two levels of security, because I want to open ports on the NetGear router so I can have servers and such in group A (see link). But I want computers in groups B and C to be secure, even if a hacker got through the NetGear router. The computers in group A are blocked from group B and C by the Dlink router, but groups B and C can access group A. The problem is that my Gentoo box's network only works in group C. I hope this clears things up a bit.

----------

## NeddySeagoon

Larry The Cow,

You want a proper firewall. Routers are no protection against crackers at all. The firewalls they contain are normally out of date because noone bothers to update the firmware.

Replace buth your routers with an old PC running Smoothwall or IPCop. A P1 will be plenty.

----------

## Headrush

 *NeddySeagoon wrote:*   

> Larry The Cow,
> 
> You want a proper firewall. Routers are no protection against crackers at all. The firewalls they contain are normally out of date because noone bothers to update the firmware.
> 
> Replace buth your routers with an old PC running Smoothwall or IPCop. A P1 will be plenty.

 

I second what NeddySeagoon says and I have done the same myself.

I found the "personal" hardware routers just don't cut it and are quite inflexible. I ditched them.

I picked up a complete dual Pentium II system for only $30 on ebay and its working great.

You could still try the way you mentioned, but I don't think its worth the effort.

I am at a loss still as to why the hub would make a difference unless the hub has an uplink port and the cable connecting it to the router was actually as crossover cable. (So using the same cable to the computer wouldn't work)

----------

## Larry The Cow

All this advice is very nice, but right now I am slightly more interested in solving my problem then improving my setup. And as I mentioned twice already, another computer running Fedora Core will connect to either router, and it has almost exactly the same hardware. So this is almost certainly a software issue.

----------

## j-m

OK, then try another DHCP client... Maybe the current one is not able to cope with such a mess...

----------

## jklmnop

warning:  i'm only experienced with big-***'d routers, not these consumer thingys.

computers plug into hubs, hubs plug into routers, to plug a computer

into a router you need a crossover cable.  it's like plugging a computer

into another computer.  some routers are smart enough to detect when

a crossover cable is not being used and compensate internally, some don't.

the rest of the time, 90% of all problems come down to duplex issues and

autonegotiation.  since the hub doesn't do any the router falls to 10-half

and the computer falls to 10-half and all is good.  when the computer and

router are directly connected and try to do auto-negotiation and something

goes wrong... you end up with a flakey connection.

since you have another machine that does work, does it have the same type

of NIC?  maybe your router is smart enough to work without a crossover cable,

but the NIC on your second machine doesn't auto-negoitiate well with the router.

if you can do 100-full, lock the NIC to that and turn off auto-negotiate.  do the same

on the router.

you don't really mention if the other box (that works connected to the router) is using

DHCP as well.  on bigger routers you have to turn on DHCP per interface, maybe it's

on for the port that feeds the hub but not on for the other ports.

it's also possible that it's not a real router-per-interface but a router between one

uplink interface and the rest of the ports are switched.

it boils down to:  if the other machine works and this one doesn't then it's most likely

an auto-negotiation issue.

----------

## Larry The Cow

The other machine does have the same NIC, and it does use DHCP. But I think the problem may be with my computer's hardware; I tried a Morphix livecd, and a Fedora livecd, and I have the same problem.

----------

## Larry The Cow

Oh, and BTW, how do you disable auto-negotiation?  :Embarassed: 

----------

