Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a debian box that is serving as a router (using iptables NAT). When first turned on, everything works fine for a few minutes. Then the dhcp server assigns an IP (other than 192.168.0.1) to its' host NIC, eth0. This is NOT what I want. I just want dhcp3-server to listen on eth0, not assign it an IP, and changes the kernel routing table. This of course ruins the NAT capablities of the box. How can I tell the dhcp3-server NOT to do this?


Thanks



Before dhcp3-server tampers with eth0, the IP is 192.168.0.1, and the routing table looks like this:

~# netstat -r Kernel IP routing table
Destination Gateway Iface
192.168.0.0 * eth0
173.33.220.0 * eth1
default 173.33.220.1 eth1

After dhcp3-server tampers with eth0, the IP is 192.168.0.3, and the routing table looks like this:

~# netstat -r Kernel IP routing table
Destination Gateway Iface
192.168.0.0 * eth0
173.33.220.0 * eth1
default 192.168.0.1 eth0
default 173.33.220.1 eth1

SETUP

Outbound NIC is eth1
Internal NIC is eth0

/etc/network/interfaces

...
iface eth0 inet static
address 192.168.0.1
netmask 255.255.255.0

/etc/default/dhcp3-server

INTERFACES="eth0"

share|improve this question

1 Answer 1

So I figured out this DHCP problem, in case anyone runs across it. My kernel routing tables were being trampled by an updated route besides the external nic. It turns out that dhcpd3 needs dhclient in order to operate. dhclient makes lease requests for dhcpd3 (don't think server works without client). dhclient configures the logical interface based on the information it gets from dhcpd3.

What I had to do was explicitly request dhcp information, WITHOUT the router data. The 'dhclient.conf' file is below.

~$ more /etc/dhcp3/dhclient.conf

...
request subnet-mask, broadcast-address, time-offset, routers,
    domain-name, domain-name-servers, domain-search, host-name,
    netbios-name-servers, netbios-scope, interface-mtu,
    rfc3442-classless-static-routes;
...

interface "eth0" {
  send dhcp-client-identifier 1:70:71:bc:43:55:44;
  send dhcp-lease-time 86400;
  request subnet-mask, broadcast-address, time-offset, domain-name, domain-name-servers, host-name;   # 'router' option NOT included 

}
interface "eth1" {
  send dhcp-client-identifier 1:00:1f:1f:b1:e5:9e;
  send dhcp-lease-time 86400;
}

... 

Good-luck

share|improve this answer
    
The dhcp server does not require the dhcp client in order to operate. You can happily run one without the other, depending on your particular needs. The dhcp client is only necessary if you expect to configure your network interfaces using dhcp -- which, arguably, doesn't make much sense on a system acting as a dhcp server. Additionally, the dhcp server does not modify your routing tables or network interface configuration; this only happens when the client acquires a new lease, and it only happens indirectly via the dhclient-script. –  larsks Jan 18 '11 at 21:44

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.