LinuxQuestions.org
Help answer threads with 0 replies.
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 07-26-2005, 12:03 AM   #1
Moebius
Member
 
Registered: Dec 2002
Location: Milwaukee, WI
Distribution: Ubuntu, Kubuntu, Debian, CentOS
Posts: 216

Rep: Reputation: 30
[SOLVED] DHCP on my router


I set up debian as a router and I have everything working except the DHCP server. eth0 is connected to the local network and eth1 is connected to my cable modem. When I try to start dhcp I get

moe-server:~# /etc/init.d/dhcp start
Starting DHCP server: dhcpd failed to start - check syslog for diagnostics.

/var/log/daemon.org says:

Jul 25 23:48:03 localhost dhcpd: No subnet declaration for eth1 (xxx.xxx.xxx.xxx).
Jul 25 23:48:03 localhost dhcpd: Please write a subnet declaration in your dhcpd.conf file for the
Jul 25 23:48:03 localhost dhcpd: network segment to which interface eth1 is attached.
Jul 25 23:48:03 localhost dhcpd: exiting.

I don't understand why DHCP should have to know anything about eth1 because I'm only assigning IP addresses to my local network on eth0.

my /etc/init.d/dhcp has the line INTERFACES="eth0"

my /etc/dhcpd.conf looks like:
Code:
authoritative;
ddns-update-style interim;

default-lease-time 259200;
max-lease-time 518400;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.1.255;
option routers 192.168.1.1;
option domain-name-servers 192.168.1.1;
option netbios-name-servers 192.168.1.1;

subnet 192.168.1.0 netmask 255.255.255.0 {
    range 192.168.1.100 192.168.1.250;
}

/etc/network/interfaces
Code:
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static
name Local Ethernet LAN card
address 192.168.1.1
netmask 255.255.255.0
broadcast 192.168.1.255
network 192.168.1.0
gateway 192.168.1.1

iface eth1 inet dhcp
name Ethernet LAN card (WAN)

auto eth1

Last edited by Moebius; 07-26-2005 at 04:51 PM.
 
Old 07-26-2005, 06:44 AM   #2
deoren
Member
 
Registered: Oct 2003
Location: USA
Distribution: Ubuntu
Posts: 216

Rep: Reputation: 30
https://listman.redhat.com/archives/.../msg00528.html

Perhaps that is what you're looking for?

This doesn't like like it'll help, but here it is anyway:
https://listman.redhat.com/archives/.../msg00737.html
 
Old 07-26-2005, 08:43 AM   #3
mpeg4codec
Member
 
Registered: Jul 2005
Distribution: Debian, Gentoo, self-built [not LFS]
Posts: 109

Rep: Reputation: 15
As root, try running:

dhcpd eth0

And see if it still gives you the same error.
 
Old 07-26-2005, 04:50 PM   #4
Moebius
Member
 
Registered: Dec 2002
Location: Milwaukee, WI
Distribution: Ubuntu, Kubuntu, Debian, CentOS
Posts: 216

Original Poster
Rep: Reputation: 30
mpeg4codec, you were right. starting the server as "dhcpd eth0" works, but using the init.d file doesn't. I looked at it and could not figure out why the $INTERFACES variable wasn't working. So eventually I just replaced this line:

Code:
--exec /usr/sbin/dhcpd -- -q $INTERFACES
with
Code:
--exec /usr/sbin/dhcpd -- -q eth0
I hate these bloody scripts, they never work right.

this is my full, working /etc/init.d/dhcpd

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="eth0"

# 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 eth0
#                       --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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Connection, Router, DHCP Sapient Linux - Networking 1 08-25-2005 10:05 PM
dhcp router ThunderChicken Linux - Networking 1 03-14-2005 02:50 PM
Router inconsistency? DHCP nvidiausr Linux - Networking 0 10-18-2004 02:08 PM
dhcp *thru* router electron_lemon Linux - Networking 6 08-21-2003 05:36 PM
dhcp, firewall, router, and such Spaz17 Linux - Networking 4 08-11-2003 01:41 PM

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

All times are GMT -5. The time now is 05:31 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