LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 08-11-2006, 06:54 AM   #1
spank
Member
 
Registered: Aug 2003
Location: Romania
Distribution: Ubuntu 6.06
Posts: 278

Rep: Reputation: 30
dhcp server configuration


I have a sever with two nics. eth0 and eth1. on eth0 i get the internet conection and it's ip is asigned by dhcp, on eth1 i want to make a dhcp server that asigns ips on the subnetwork.
if i stop eth0 and start dhcp and then start eth0 it works just fine. but if eth0 is up and i start dhcp i get in /var/log/syslog the following error message(and dhcp doesn't start)
Code:
Aug 11 14:50:50 marlboro dhcpd: No subnet declaration for eth0 (192.168.10.108).
Aug 11 14:50:50 marlboro dhcpd: Please write a subnet declaration in your dhcpd.conf file for the
Aug 11 14:50:50 marlboro dhcpd: network segment to which interface eth0 is attached.
Aug 11 14:50:50 marlboro dhcpd: exiting.
how can i fix it ?
 
Old 08-11-2006, 07:04 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
You can start dhcpd like this:
Code:
dhcpd eth1
 
Old 08-11-2006, 07:55 AM   #3
spank
Member
 
Registered: Aug 2003
Location: Romania
Distribution: Ubuntu 6.06
Posts: 278

Original Poster
Rep: Reputation: 30
well i have the following /etc/init.d/dhcp init script:
Code:
#!/bin/sh
#
# $Id: dhcp.init.d,v 1.3.2.2 2002/08/11 22:11:54 peloy Exp $
#

test -x /usr/sbin/dhcpd || exit 0

# Defaults
INTERFACES="eth1"

# Reads config file (will override defaults above)
[ -r /etc/default/dhcp ] && . /etc/default/dhcp

DHCPDPID=/var/run/dhcpd.pid

case "$1" in
        start)
                echo -n "Starting DHCP server: "
                start-stop-daemon --start --quiet --pidfile $DHCPDPID \
                        --exec /usr/sbin/dhcpd -- -q $INTERFACES
                sleep 2

                if [ -f "$DHCPDPID" ] && ps h `cat "$DHCPDPID"` >/dev/null; then
                        echo "dhcpd."
                else
                        echo "dhcpd failed to start - check syslog for diagnostics."
                fi
                ;;
        stop)
                echo -n "Stopping DHCP server: dhcp"
                start-stop-daemon --stop --quiet --pidfile $DHCPDPID
                echo "."
                ;;
        restart | force-reload)
                $0 stop
                sleep 2
                $0 start
                ;;
        *)
                echo "Usage: /etc/init.d/dhcp {start|stop|restart|force-reload}"
                exit 1
esac

exit 0
and the /etc/dhcpd.conf file:
Code:
subnet 10.0.0.0 netmask 255.255.255.0 {
default-lease-time 345600;
max-lease-time 691200;
option domain-name "supaweb.local";
option domain-name-servers 192.168.0.1,192.168.1.1;
option routers 10.0.0.1;
option broadcast-address 10.0.0.255;
range 10.0.0.2 10.0.0.10;
}
 
Old 08-11-2006, 08:16 AM   #4
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Does
Code:
/usr/sbin/dhcpd eth1
works
If it works then try to change your init script accordingly
 
Old 08-11-2006, 08:17 AM   #5
bartonski
Member
 
Registered: Jul 2006
Location: Louisville, KY
Distribution: Fedora 12, Slackware, Debian, Ubuntu Karmic, FreeBSD 7.1
Posts: 443
Blog Entries: 1

Rep: Reputation: 48
Ok, this is just a wild guess... how is your network set up? What device are each of these ethernet interfaces connected to?

I'm imagining that they're both connected to, say, a switch. There's another device connected to the switch, a cable modem perhaps, which is acting as a dhcp server, assigning a 192.168.10.108 ip address to eth0.

You fire up dhcpd on eth1, but eth0 still has an IP address from the previous dhcp server. If you do an ifdown and on eth0, eth0 then releases from the previous DHCP server, and on ifup aquires a 10.x.x.x address from your DHCP server.
 
Old 08-11-2006, 08:36 AM   #6
spank
Member
 
Registered: Aug 2003
Location: Romania
Distribution: Ubuntu 6.06
Posts: 278

Original Poster
Rep: Reputation: 30
i get the internet conection from my isp on eth0. this nics ip is set by the dhcp of the isp. i have on the server another nic eth1. i want to run on the server a dhcp server that works only on eth1 and sets the ips for the hosts that connect to eth1 via a switch
 
Old 08-11-2006, 10:01 PM   #7
bartonski
Member
 
Registered: Jul 2006
Location: Louisville, KY
Distribution: Fedora 12, Slackware, Debian, Ubuntu Karmic, FreeBSD 7.1
Posts: 443
Blog Entries: 1

Rep: Reputation: 48
Just out of curiosity, what's in /etc/default/dhcp?
 
Old 08-12-2006, 03:46 AM   #8
spank
Member
 
Registered: Aug 2003
Location: Romania
Distribution: Ubuntu 6.06
Posts: 278

Original Poster
Rep: Reputation: 30
Code:
# Defaults for dhcp initscript
# sourced by /etc/init.d/dhcp
# installed at /etc/default/dhcp by the maintainer scripts

#
# This is a POSIX shell fragment
#

# On what interfaces should the DHCP server (dhcpd) serve DHCP requests?
#       Separate multiple interfaces with spaces, e.g. "eth0 eth1".
INTERFACES="eth1"
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How To know if a host configured with DHCP has obtained IP address from DHCP server? Prassanta SUSE / openSUSE 1 06-29-2006 09:48 AM
eth0 ip assigned by dhcp , how would i know the ip address of the dhcp server where.. kublador Linux - Networking 14 05-16-2006 06:33 AM
Help DHCP configuration? tradewind Linux - Networking 2 06-30-2004 04:04 PM
XP Pro Build 2600/sp1 v.1105 DHCP Client to Redhat 8.0 DHCP Server - Problems atomant Linux - Networking 5 06-28-2003 11:24 AM
RH 6.2 DHCP configuration SpanFool Linux - Networking 1 03-29-2001 11:31 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 11:27 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration