# dhcp server/router configuration? [SOLVED]

## sdfg

Hi,

I've got 2 network cards - one for the net and one for the lan. The net one uses dhcpcd to detect the IP and all is well, however as there isn't a DHCP server on my network (as the linux machine is the server/gateway) it times out and doesn't work. I need these so that I can route all the other computers to get net access through this machine.

I've just emerged udhcp (which claims to be a server and a client), however I can find absolutely no documentation on it - no man pages, and the website is abysmal. 

Has anyone got any advice on setting up udhcp? Or any other advice about my setup? Ideally I just need something to let the other machines on my network get to the net.

Thanks in advance,

-KLast edited by sdfg on Tue Sep 20, 2005 8:02 pm; edited 2 times in total

----------

## adsmith

dnsmasq is a great little dhcp server, which has a cacheing DNS built in, too!

----------

## sdfg

 *adsmith wrote:*   

> dnsmasq is a great little dhcp server, which has a cacheing DNS built in, too!

 

Oooh, that's not bad. I've configured the .conf and started the service, but how do I edit conf,d/net to make it look for dnsmasq instead of dhcpcd?

I'm so confused  :Sad: 

----------

## adsmith

I don't get it -- do you want to set up a dhcp server or client?  

/etc/conf.d/net has nothing to do with the server.  Just set it on the client machines to 

```
iface_eth0="dhcp"
```

----------

## Le_Mackeux

About the built-in dnsmasq caching feature, it's not the only one. As far as i know all dns server does some caching. what's good with dnsmasq it is easy to configure cuz there is nothing to configure. You only configure your hosts file and dnsmasq does the rest.

If you feel limited with dnsmasq, don't be shy to try BIND.

Cheers

----------

## beatryder

I use dnsmasq on both my laptop (for setting up a wifi hot spot at school) and at home on my proxie server.

It seems to work great. For the best results I would follow the gentoo network configuration guide http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=4

you need to configure one eth to dhcp and one to a static ip.subnet and configure dnsmasq to listen on that network.

it should be as simple as changing one line in the /etc/dnsmasq.conf file.

----------

## Redeeman

its VERY easy to setup isc dhcpd, just emerge dhcp, and look at my sample config:

http://wiki.kaspersandberg.com/doku.php?id=configs:dhcpd.conf

also, my bind configuration files are availiable on my wiki.

----------

## beatryder

dnsmasq is easier.... and it will handle the resolve.conf stuff for you.

----------

## sdfg

Ok, I've decided to just statically assign ips for the network. (There were, and possibly could be, complications about this, as I've compiled my NIC drivers into the kernel, so I can never guaruntee which will get loaded first to set rules for eth0 and eth1. I'm just going to recompile my kernel with them set as modules.)

I can ping all the other machines on the network, and they can ping me. I can also ping outside websites. However, with eth1 (netwrk) running, my web stuff doesn't load. That's the first problem.

My second is that I need to route through any web requests from my network, coming via eth1, out through eth0 - and back again. How would I do this? (I'm assuming that I can also just send any web requests from the ip eth1 has (or lo) through the same rules, resulting in no problems.)

Anyone help? 

-K

----------

## davidblewett

Take a look at Shorewall. It's a firewall, and you can easily forward traffic on a port on one interface to be sent to another interface or to a specific host. It's basically a front-end for iptables in the kernel. It's dead easy to configure.

----------

## sdfg

 *davidblewett wrote:*   

> Take a look at Shorewall. It's a firewall, and you can easily forward traffic on a port on one interface to be sent to another interface or to a specific host. It's basically a front-end for iptables in the kernel. It's dead easy to configure.

 

Thank you! It works! Well, almost...

My other computers can get to the web, which is fantastic. However, when I have my internal interface up, this machine (the router) can't! How do I solve this?

EDIT: My routing:

Kernel IP routing table

Destination     |Gateway         |Genmask         |Flags |Metric |Ref    |Use |Iface

82.41.16.0      |0.0.0.0         |255.255.248.0   |U     |0      |0        |0 |eth1

127.0.0.0       |127.0.0.1       |255.0.0.0       |UG    |0      |0        |0 |lo

0.0.0.0         |82.41.16.1      |0.0.0.0         |UG    |0      |0        |0 |eth1

And the tracepath

Neptune ~ # tracepath 68.142.197.72

 1:  82-41-21-3.cable.ubr03.edin.blueyonder.co.uk (82.41.21.3)  11.213ms pmtu 1500

 1:  10.123.128.1 (10.123.128.1)                           90.321ms

 2:  80.195.0.6 (80.195.0.6)                              128.399ms

 3:  pc-62-30-251-22-ro.blueyonder.co.uk (62.30.251.22)   asymm 12  76.841ms

 4:  no reply

 5:  no reply

 6:  no reply

 7:  no reply

...

Is the problem with my provider?

EDIT 2:

I think I've solved it. I set eth0 to be 192.168.0.1/1, but that isn't the correct setup. I removed the /1 and everything seems to be ok so far!

----------

