cancel
Showing results for 
Search instead for 
Did you mean: 

Linux DHCP

Firejack
Grafter
Posts: 921
Registered: 26-06-2007

Linux DHCP

I have 2 devices, eth0 (external/ internet adapter) and eth1 (internet/ LAN adapter) on my Linux box. The box is running DHCPd. DHCP isn't being assigned to any of my machines LAN side. I'm thinking there is some sort of conflict to do with the DHCP protocal. eth0 is receiving its IP details from my DSL router acting as another DHCP server (just to complicate things Wink ) Should I be using different subnets for each DHCP service?

Also Routing the two adapters together so they can talk is simply a matter of enabling IP forwarding using the command
echo "1" > /proc/sys/net/ipv4/ip_forward
?Huh
17 REPLIES
Community Veteran
Posts: 14,469
Registered: 30-07-2007

Linux DHCP

The external and internal lans must use different subnets (i.e. external 192.168.0.X, internal 192.168.1.X).
Firejack
Grafter
Posts: 921
Registered: 26-06-2007

Linux DHCP

I thought that might be it. Cheers.
Firejack
Grafter
Posts: 921
Registered: 26-06-2007

Linux DHCP

OK I've setup the internet and external LANs but still no DHCP details are reaching my local machines from the Linux DHCP server.

Here is the config file for DHCPd
Quote
# a minimal /etc/dhcpd.conf example

# at first, edit /etc/sysconfig/dhcpd to configure all network interfaces
# that the server should listen on (DHCPD_INTERFACE) **Configured this**

# if you don't use dynamical DNS updates:
#
# this statement is needed by dhcpd-3 needs at least this statement.
# you have to delete it for dhcpd-2, because it does not know it.
#
# if you want to use dynamical DNS updates, you should first read
# read /usr/share/doc/packages/dhcp-server/DDNS-howto.txt
ddns-update-style none; ddns-updates off;

# this subnet is served by us
authoritative;

# declare the lease times (the time after which a client needs to renew its lease)
# for production use you'll probably use lease times of several days or even longer
# (depending on whether hosts move in/out often (notebook note) or not. for
# example, you could assign long leases to your printers by class ids)
default-lease-time 86400; # 1 days
max-lease-time 604800; # 1 week

# this assumes that your dhcp server is also the router for the subnet
option routers 192.168.1.1;

# clients shall use this host as nameserver, too
option domain-name-servers 212.159.13.49, 212.159.13.50;

# this can explicitely be specified
option broadcast-address 192.168.1.255;

# these 10 addresses will be given out dynamically
subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.1 192.168.1.10;
# options may also be put here if they are not global
}

host linux {
hardware ethernet 00:90:48:21:09:38;
fixed-address 192.168.1.1;
}
N/A

Linux DHCP

Hi,

I'm going to make an assumption based on the following snippet:

Quote

option routers 192.168.1.1;

subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.1 192.168.1.10;
# options may also be put here if they are not global
}

host linux {
hardware ethernet 00:90:48:21:09:38;
fixed-address 192.168.1.1;
}


I am guessing that you are setting up your linux router to be the dhcp server also? In which case, it is not possible to have the dhcp server assign it's own address - so this will need to be set manually to a static address. (If the dhcp server is on different box, then I'm completely barking up the wrong tree).

On a different note, have seen any comments in /var/log/messages? Ideally it would be something along the lines of:

Quote

May 13 07:34:52 Martell dhcpd: DHCPREQUEST for 192.168.253.69 from 00:07:95:42:80:92 (passoa) via eth0
May 13 07:34:52 Martell dhcpd: DHCPACK on 192.168.253.69 to 00:07:95:42:80:92 (passoa) via eth0


But if not, if should (hopefully) give you a hint as to the problem.

Regards,
D'Essen
Firejack
Grafter
Posts: 921
Registered: 26-06-2007

Linux DHCP

Thanks for the help. Doing what you suggested returns the following in messages
Quote
May 13 11:02:32 linux dhcpd: Internet Software Consortium DHCP Server V3.0.1rc10
May 13 11:02:32 linux dhcpd: Copyright 1995-2002 Internet Software Consortium.
May 13 11:02:32 linux dhcpd: All rights reserved.
May 13 11:02:32 linux dhcpd: For info, please visit http://www.isc.org/products/DHCP
May 13 11:02:32 linux dhcpd: Wrote 1 leases to leases file.
May 13 11:02:32 linux dhcpd: Listening on LPF/eth1/00:60:08:81:03:78/192.168.1.0/24
May 13 11:02:32 linux dhcpd: Sending on LPF/eth1/00:60:08:81:03:78/192.168.1.0/24
May 13 11:02:32 linux dhcpd: Sending on Socket/fallback/fallback-net
But still no working DHCP :?
N/A

Linux DHCP

Acording to that, it apeatrs to be listening on the wrong interface.
Firejack
Grafter
Posts: 921
Registered: 26-06-2007

Linux DHCP

In /etc/sysconfig/dhcpd I've setup DHCPd to listen on eth1 which is connected to my Switch and Internal network.
Is it possible that message has another meaning?
N/A

Linux DHCP

Hi,

Quote
Acording to that, it apeatrs to be listening on the wrong interface.


I guess you're referring to the bit that says:

Quote
192.168.1.0/24


? This is referring to the network as a whole - the actual IP address of the local doesn't get shown. (Unless of course, the machines IP address is 192.168.1.0 - which would raise a host of other questions in my mind!).

Firefox,

What do you see in your logs when a client machine attempts to collect an IP address?

Actually, thinking of the beginning of this post - for the sake of sanity (!), could you please confirm the IP Address of your DHCP server?

Regards,
D'Essen
Firejack
Grafter
Posts: 921
Registered: 26-06-2007

Linux DHCP

Quote
Firefox,
Great web browser Wink

Quote
What do you see in your logs when a client machine attempts to collect an IP address?
Nothing Sad

Quote
Actually, thinking of the beginning of this post - for the sake of sanity (!), could you please confirm the IP Address of your DHCP server?
I've actually rebuilt the entire configuration from scratch since that post.

eth0 is connected to the outside world and is setup as follow;
IP = 192.168.2.21
netmask = 255.255.255.0
Gateway = 192.168.2.20 (my DSL Router)

eth1 is connected to my LAN as follow;
IP = 192.168.1.20
netmask = 255.255.255.0
Gateway = 192.168.1.20 (for some reason this is the only setting that works. If i point it at eth0, eth0 stops working)
DNS's = 212.159.13.49, 212.159.13.50

/etc/sysconfig/dhcpd is set to listen on eth1 with DHCPd

dhcpd.conf reads;
ddns-update-style ad-hoc;

default-lease-time 86400; #1 day
max-lease-time 86400; #1 day

option domain-name "home";
option domain-name-servers 212.159.13.49, 212.159.13.50;
option broadcast-address 192.168.1.255;
option routers 192.168.2.20;
option subnet-mask 255.255.255.0;

subnet 192.168.1.0 netmask 255.255.255.0
{
range 192.168.1.21 192.168.1.28;
}
N/A

Linux DHCP

My bad. That was the correct interface. Trust me to skim read.

192.168.1.0 is correct.

Why this isn't working is another matter. What systems to your have in the 192.168.1.0/24 subnet?

If there are any XP boxes, goto the network control panel and disable the network card then re-enable.

Check the logs in the linux box again.

Also, if you assign systems static IPs, do they work? Will they ping each other?
Firejack
Grafter
Posts: 921
Registered: 26-06-2007

Linux DHCP

There are some Win XP boxes on the 192.168.1.0/24 subnet. I've tried refreshing the networking cards by deactivating and reactivating them ... nothing :roll:

I can ping eth0, eth1, my router and the internet. but nothing LAN side of the DHCPd server :shock:

Seriously thinking of re-installing Linux now :x
N/A

Linux DHCP

Hi,

Quote
Great web browser Wink


Doh! Shockedops: Sorry I evidently wasn't paying attention - my apologies.

Quote
Nothing Sad


Hmm, I would have expect to see at least a request! :?

Do you have a firewall configured by any chance?

Regards,
D'Essen
N/A

Linux DHCP

Hi,

Quote
There are some Win XP boxes on the 192.168.1.0/24 subnet.


As another sanity check, it may be worth temporarily configuring one of these with a static address - then to follow through with acarrs suggestion, and ping on the LAN side. This will then at least eliminate any physical suspects from your enquiry.

Regards
D'Essen
Firejack
Grafter
Posts: 921
Registered: 26-06-2007

Linux DHCP

No firewall installed at the moment. Going too once DHCPd works.

I've tried configuring a statis address for my windows machine and I still can't ping them.

Time to re-install me thinks Sad
To check I have the process correct....

Install Linux, remove DHCPcd and install DHCPd.
Configure eth0, eth1, dhcp.conf and /etc/sysconfig/dhcp to above configuration and enable IP_forwarding. Reboot.

That correct?