Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Correct DHCP Server Configuration for a Router

  1. #1
    Join Date
    Mar 2013
    Beans
    17

    Correct DHCP Server Configuration for a Router

    I'm trying to setup a 13.04 server edition based router. It has 4 network ports (eth0-eth3) and an USB WWAN modem (ppp0).

    Currently my /etc/dhcp/hdcpd.conf reads:
    Code:
    ddns-update-style none;
    #option definitions common to all supported networks...
    #optiondomain-name-servers ns1.example.org, ns2.example.org;
    
    option domain-name "home";
    option routers 192.168.0.1; #Default Gateway
    option domain-name-servers 192.168.0.1;
    default-lease-time600;
    max-lease-time7200;
    
    
    #If this DHCP server is the official DHCP server for the local
    #network, the authoritative directive should be uncommented.
    authoritative;
    
    
    #Use this to send dhcp log messages to a different log file (you also
    #have to hack syslog.conf to complete the redirection).
    log-facilitylocal7;
    
    
    subnet192.168.0.0 netmask 255.255.255.0 {
               option subnet-mask                     255.255.255.0;
               option broadcast-address               192.168.0.255;
        
        range 192.168.0.51 192.168.0.61;   #DHCP Range to assign
    }


    I have edited my /etc/default/isc-dhcp-server to read:

    Code:
    # On what interfacesshould the DHCP server (dhcpd) serve DHCP requests?
    #       Separate multipleinterfaces with spaces, e.g. "eth0 eth1".
    INTERFACES="eth0 eth1 eth2 eth3"

    and my /etc/network/interfaces reads:

    Code:
    #The primary network interface
    auto ppp0
    iface ppp0 inet dhcp
    
    
    # LAN Ports served by DHCPD
    auto eth0
        iface eth0 inet static
                address 192.168.0.1
                netmask 255.255.255.0
                gateway 192.168.0.1
    
    
    auto eth1
        iface eth1 inet static
                address 192.168.0.2
                netmask 255.255.255.0
                gateway 192.168.0.1
    
    
    auto eth2
        iface eth2 inet static
                address 192.168.0.3
                netmask 255.255.255.0
                gateway 192.168.0.1
    
    
    auto eth3
        iface eth0 inet static
                address 192.168.0.4
                netmask 255.255.255.0
                gateway 192.168.0.1
    This doesn't work for me. The command dhcpd -t /etc/dhcp/dhcpd.conf returns: "/etc/dhcp/dhcpd.conf: interface name too long (is 20)"

    sudo tail /var/log/syslog yields the following (repeats for each lan port):
    Code:
    Mar 13 13:20:33 home dhcpd: No subnet declaration for eth0 (no IPv4 addresses).
    Mar 13 13:20:33 home dhcpd: ** Ignoring requests on eth0.  If this is not what
    Mar 13 13:20:33 home dhcpd:    you want, please write a subnet declaration
    Mar 13 13:20:33 home dhcpd:    in your dhcpd.conf file for the network segment
    Mar 13 13:20:33 home dhcpd:    to which interface eth0 is attached. **
    If anyone could point out where I went wrong, I'd appreciate it.
    Last edited by BhimaPandava; March 13th, 2013 at 05:13 PM.

  2. #2
    Join Date
    Feb 2008
    Location
    Planet earth, for now.
    Beans
    Hidden!
    Distro
    Xubuntu

    Re: Correct DHCP Server Configuration for a Router

    Thread moved to Ubuntu +1 (Raring Ringtail)

    13.04 not yet released (end of April). Just wondering if you might be better with an LTS release for a server.

  3. #3
    Join Date
    Jun 2010
    Location
    London, England
    Beans
    6,769
    Distro
    Ubuntu Development Release

    Re: Correct DHCP Server Configuration for a Router

    I know nothing about networking but I do see this:
    INTERFACES="eth0 eth1 eth2 eth3"
    and I compare that with this:
    autoeth0
    and I do wonder if that mismatch is the reason for this message:
    please write a subnet declaration in your dhcpd.conf file for the network segment to which interface eth0 is attached.
    It is just an observation from an uneducated tester. Regards.
    It is a machine. It is more stupid than we are. It will not stop us from doing stupid things.
    Ubuntu user #33,200. Linux user #530,530


  4. #4
    Join Date
    Oct 2008
    Location
    ExodusHair<Čubura
    Beans
    3,855
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: Correct DHCP Server Configuration for a Router

    Quote Originally Posted by grahammechanical View Post
    I know nothing about networking but I do see this: and I compare that with this: and I do wonder if that mismatch is the reason for this message: It is just an observation from an uneducated tester. Regards.
    Also, there is no command/option
    Code:
    autoeth0
    That should be
    Code:
    auto ethx
    x in {0,1,2,3...}
    Also,
    Code:
    ifaceeth0 inet static
    should be
    Code:
    iface ethx inet static
    Last edited by zika; March 13th, 2013 at 05:01 PM.

  5. #5
    Join Date
    Mar 2013
    Beans
    17

    Re: Correct DHCP Server Configuration for a Router

    I think you are making a good point. I could not figure out how to indicate "all wired ethernet ports" in network/interfaces so I just listed them all individually but that appears to interfere with the dhcpd.conf subnet declaration. Unfortunately all the how-tos I've found so far only use one nic for listening for DHCP requests. I want anything that is plugged in to any of the 4 ethernet ports to be assigned an IP in the subnet.

    No wait... I just twigged that in many places there are spaces missing in what I had pasted into my submission. ("autoeth0" should read "auto eth0"). I've gone through and tried to fix that in my submission but they were there all along in my configuration.

  6. #6
    Join Date
    Mar 2013
    Beans
    17

    Re: Correct DHCP Server Configuration for a Router

    Great! Just to be clear: in /etc/default/isc-dhcp-server I should use "INTERFACES="ethx"

    and for etc/network/interfaces:
    #LAN Ports served by DHCPD
    auto ethx
    iface ethx inet static
    address 192.168.0.1
    netmask 255.255.255.0
    gateway 192.168.0.1

    How do I indicate that each of the 4 ethernet ports should receive IP addresses? (I'm assuming they should be static and must be unique)

    Why are the spaces in my pasted text disappearing?

  7. #7
    Join Date
    Nov 2008
    Location
    Metro Boston
    Beans
    8,754
    Distro
    Kubuntu 14.04 Trusty Tahr

    Re: Correct DHCP Server Configuration for a Router

    It sounds like you only have one physical network and a single subnet, 192.168.0.0/24. If so, bind dhcpd to just one of the interfaces, presumably eth0.

    Also if you have a computer with multiple network cards, you're going to have problems if they are all connected to the same subnet. Usually a so-called "multi-homed" server would have each network adapter assigned to a different IP subnet so that it can route traffic between the subnets. In most cases there is no reason to assign all the cards to the same subnet unless you are implementing some type of "bonding" for bandwidth reasons or you want to use IP-based web hosting for SSL.
    If you ask for help, please have the courtesy to check for responses and thank the people who helped you.

    Blog · Linode System Administration Guides · Android Apps for Ubuntu Users

  8. #8
    Join Date
    Oct 2008
    Location
    ExodusHair<Čubura
    Beans
    3,855
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: Correct DHCP Server Configuration for a Router

    Be sure to look into /etc/udev/rules.d/70-persistent-net.rules to see which NIC is recognized and how...
    Also, disable UFW since it made me pull my hair before I recognized it is him that's making all the mess...
    Lot of stuff, check them one-by-one...

  9. #9
    Join Date
    Mar 2013
    Beans
    17

    Re: Correct DHCP Server Configuration for a Router

    Quote Originally Posted by zika View Post
    Be sure to look into /etc/udev/rules.d/70-persistent-net.rules to see which NIC is recognized and how...
    Also, disable UFW since it made me pull my hair before I recognized it is him that's making all the mess...
    Lot of stuff, check them one-by-one...
    I haven't setup the firewall yet because I know that it can be diffiuclt... and I haven't even got the basics working yet!
    My /etc/udev/rules.d/70-persistent-net.rules currently is:

    Code:
    # PCI device 0x8086:/sys/devices/pci0000:00/0000:00:19.0/0000:08:00.0/0000:09:03.0/0000:0b:00.0 (e1000e)
    SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:00:24:cf:28:3f", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth3"
    
    
    # PCI device 0x8086:/sys/devices/pci0000:00/0000:00:18.0/0000:03:00.0/0000:04:02.0/0000:05:00.0 (e1000e)
    SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:00:24:cf:28:3c", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
    
    
    # PCI device 0x8086:/sys/devices/pci0000:00/0000:00:18.0/0000:03:00.0/0000:04:03.0/0000:06:00.0 (e1000e)
    SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:00:24:cf:28:3d", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
    
    
    # PCI device 0x8086:/sys/devices/pci0000:00/0000:00:19.0/0000:08:00.0/0000:09:02.0/0000:0a:00.0 (e1000e)
    SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:00:24:cf:28:3e", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth2"

  10. #10
    Join Date
    Oct 2008
    Location
    ExodusHair<Čubura
    Beans
    3,855
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: Correct DHCP Server Configuration for a Router

    Quote Originally Posted by BhimaPandava View Post
    I haven't setup the firewall yet because I know that it can be diffiuclt... and I haven't even got the basics working yet!
    My /etc/udev/rules.d/70-persistent-net.rules currently is:

    Code:
    # PCI device 0x8086:/sys/devices/pci0000:00/0000:00:19.0/0000:08:00.0/0000:09:03.0/0000:0b:00.0 (e1000e)
    SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:00:24:cf:28:3f", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth3"
    
    
    # PCI device 0x8086:/sys/devices/pci0000:00/0000:00:18.0/0000:03:00.0/0000:04:02.0/0000:05:00.0 (e1000e)
    SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:00:24:cf:28:3c", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
    
    
    # PCI device 0x8086:/sys/devices/pci0000:00/0000:00:18.0/0000:03:00.0/0000:04:03.0/0000:06:00.0 (e1000e)
    SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:00:24:cf:28:3d", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
    
    
    # PCI device 0x8086:/sys/devices/pci0000:00/0000:00:19.0/0000:08:00.0/0000:09:02.0/0000:0a:00.0 (e1000e)
    SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:00:24:cf:28:3e", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth2"
    On first glance they seem to be recognized OK. About ufw: Even if You have it disabled, if ethx stall just try
    Code:
    sudo ufw disable
    because that was a problem that I had on one setup. I even had to put that to eb executed every time at boot. I still have to find some time to investigate that setup because it does not make any sense but only that works with it...

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •