Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Ubuntu - setting up DHCP server

  • 12-01-2011 12:49pm
    #1
    Registered Users, Registered Users 2 Posts: 383 ✭✭


    Hey All,

    kind of stumped, trying to setup dhcp3-server, have followed a bunch of tutorials, but still having issues.

    Contents of /etc/network/interfaces (modified first two blocks of IP for privacy)
    # 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
            address x.x.220.230
            netmask 255.255.254.0
            network x.x.220.0
            broadcast x.x.221.255
            gateway x.x.220.1
            # dns-* options are implemented by the resolvconf package, if installed
            dns-nameservers 208.67.222.222 208.67.220.220
            dns-search localdomain
    

    The server has only 1 IP (x.x.220.230) and a direct connection to the Net (I cannot get any more static ips). I will connect to the server via a VPN (pptpd), so I want the server to hand out a dhcp address on connection, preferably in block 192.168.x.x so it is clear it is a nat/dhcp address.

    Contents of /etc/default/dhcp3-server
    # Defaults for dhcp initscript
    # sourced by /etc/init.d/dhcp
    # installed at /etc/default/dhcp3-server 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="eth0"
    
    


    Contents of /etc/dhcp3/dhcpd.conf
    # The ddns-updates-style parameter controls whether or not the server will
    # attempt to do a DNS update when a lease is confirmed. We default to the
    # behavior of the version 2 packages ('none', since DHCP v2 didn't
    # have support for DDNS.)
    ddns-update-style none;
    
    # option definitions common to all supported networks...
    option domain-name "home.lan";
    option domain-name-servers ubuntu.home.lan;
    
    default-lease-time 600;
    max-lease-time 7200;
    
    # If this DHCP server is the official DHCP server for the local
    # network, the authoritative directive should be uncommented.
    #authoritative;
    
    option subnet-mask 255.255.255.0;
    option broadcast-address 192.168.1.255;
    option routers 192.168.1.254;
    option domain-name-servers 192.168.1.1, 192.168.1.2;
    option domain-name “yourdomainname.com”;
    
    subnet 192.168.1.0 netmask 255.255.255.0 {
        range 192.168.1.10 192.168.1.200;
    }
    


    I am pretty sure my problem is in the dhcpd.conf, I have tried a whole bunch of variations, but the server refuses to start.

    In /var/log/syslog it always either says "No subnet declaration for eth0 (x.x.220.230)." or if I change the IPs to be something more like the actual server ip, "/etc/dhcp3/dhcpd.conf line 24: subnet x.x.220.230 netmask 255.255.255.0: bad subnet number/mask combination".

    Totally stumped, any suggestions for what values I should have in dhcpd.conf?

    Thanks in advance! :)


Comments

  • Registered Users, Registered Users 2 Posts: 2,755 ✭✭✭niallb


    You're not going to be serving addresses out on eth0.
    Depending on your VPN, you'll be connecting to tun0, ppp0 or something completely different.
    The IP of your eth0 is outside the scope of what you're trying to serve, and you may even cause problems for other users of your ISP if you manage to get a dhcp server active there.
    Set up the VPN first, or add another network card.
    Then you can set the INTERFACES value in /etc/default/dhcp3-server to tun0 or whatever you're connecting to.

    There's nothing fundamentally wrong with the dhcpd.conf settings, though you might want to change the domain-name-servers to something real.
    Either use your own or your ISPs nameserver, or use 208.67.222.222 for opendns, or 8.8.8.8 for google dns.

    The interface dhcpd is handing out addresses on must be in the same subnet as the addresses served,
    so it would need to be x.x in your case rather than 192.168 - and you don't own those addresses.


Advertisement