Menu

Feauture request: DNSMASQ proxy DHCP option

2009-11-11
2012-12-12
  • Nikolay Kasatkin

    Hello DRBL Team! Is it possible to include dnsmasq as installation option for DRBL?
    It is useful in situations where one must add DRBL server to network with existing DHCP server without disturbing it. Since version 2.49 dnsmasq provide proxy DHCP function, which described in Intel PXE spec: http://download.intel.com/design/archives/wfm/downloads/pxespec.pdf
    With dnsmasq DHCP configuration looks like:

    port=0  # Disable DNS functions
    enable-tftp
    tftp-root=/tftpboot/nbi_img
    pxe-service=x86PC,"Network boot",pxelinux  # Boot pxelinux.0 loader
    dhcp-range=192.168.10.0,proxy  # Act as proxy DHCP
    dhcp-range=192.168.40.0,proxy  # on networks with
    dhcp-range=192.168.50.0,proxy  # existing and configured
    dhcp-range=192.168.60.0,proxy  # DHCP server

     
  • Nikolay Kasatkin

    Oops, dnsmasq config file:
    <pre><code>

    port=0 # Disable DNS functions enable-tftp tftp-root=/tftpboot/nbi_img
    pxe-service=x86PC,"Network boot",pxelinux # Boot pxelinux.0 loader
    dhcp-range=192.168.10.0,proxy # Act as proxy DHCP
    dhcp-range=192.168.40.0,proxy # on networks with
    dhcp-range=192.168.50.0,proxy # existing and configured
    dhcp-range=192.168.60.0,proxy # DHCP server

    </code></pre>

     
  • Steven Shiau

    Steven Shiau - 2009-11-13

    Hi,

    Great! Thanks for sharing this. We will test it and try to include it as an option, or document it so that people can install that by themselves.

    Steven.

     
  • Nikolay Kasatkin

    Steps to be done to get DNSMASQ hack work:

    - install DRBL and do all configurations;

    - disable and stop DHCPd;

    - install dnsmasq;

    - configure dnsmasq in proxy DHCP mode for your subnet (please, read man carefully);

    - set rootpath variable in /usr/lib/mkpxeinitrd-net/initrd-skel/bin/udhcpc-post file like this:

    rootpath="192.168.10.42:/tftpboot/$clientdir"
    

    - run sudo /opt/drbl/sbin/mknic-nbi -check-server-name n

    Unfortunately you must set address of DRBL server manually. It is because there is no other way to send ip address of DRBL server if it different from DHCP server address. Hope this will be fixed in the future.

     
  • Steven Shiau

    Steven Shiau - 2010-06-05

    "there is no other way to send ip address of DRBL server if it different from DHCP server address. Hope this will be fixed in the future" -> We will try to use boot parameter to assign that in the future release.

    Thanks!

    Steven.

     
  • Steven Shiau

    Steven Shiau - 2010-06-08

    Cool.
    Thanks for sharing that.

    Steven.

     
  • Drastik Penguin

    Drastik Penguin - 2010-07-06

    Please, can you explain the final method to avoid disturbing main DHCP server with more specifics?
    Because I'm a bit lost.

    Thank you for all!

     
  • Nikolay Kasatkin

    Sorry, I'm at vacation till September and can't provide my patches right now. But from memory steps is:

    - install DRBL and do all configurations;

    - disable and stop DHCPd;

    - install dnsmasq;

    - configure dnsmasq in proxy DHCP mode for your subnet (please, read dnsmasq man carefully; install recent version which support proxy DHCP);

    - add IPAPPEND 1 option to /tftpboot/nbi_img/pxelinux.cfg/default (please, read syslinux documentation carefully);

    - add parsing functions to /usr/lib/mkpxeinitrd-net/initrd-skel/bin/udhcpc-post file and extract needed ip from /proc/cmdline. The string like "ip=192.168.0.100:255.255.255.0.192.168.0.23…" is appended to kernel command line by syslinux (see syslinux wiki for IP= option). Second or third address is for proxy DHCP server (e.g. Clonezilla server). Set rootpath variable like this: rootpath="$PARSED_IP_FROM_CMDLINE:/tftpboot/$clientdir"

    - run sudo /opt/drbl/sbin/mknic-nbi -check-server-name n

    This method for NFS-based client boot. I will try to adapt booting with new livecd-style method to proxy DHCP environment in September.

    Hope you can read my scary English =)

     
  • Anonymous

    Anonymous - 2010-07-27

    Total newb here.
    Does anyone have a step by step on this? I have tried to get it to work but unfortunately no dice.  I think its a bit too vague for my level of experience(Which is nil with pxe cz etc)
    Thanks in advance for any help you can provide.
    And a huge thanks to kasatkin for figuring out how to do this!!

     
  • Alessio Pollero

    Alessio Pollero - 2011-01-10

    I've a dnsmasq DHCP Server(192.168.1.1) that is a router with dd-wrt, in the same network i've installed a Ubuntu Server(192.168.1.100) with Clonezilla-Server installed on it.

    I want to keep the dd-wrt router as the DHCP Server and the Clonezilla-Server without DHCP server installed on it.

    I've installed and configured the Clonezilla-SE without creating a second virtual network interface and once installed and configured i've removed the dhcp server that automatically has been created, then i've added pxeboot configuration to my dnsmasq DHCP Server :

    dhcp-boot=pxelinux.0,,192.168.1.100
    

    Then i've done the following from your previous post on the Clonezilla-SE Server:

    - set rootpath variable in /usr/lib/mkpxeinitrd-net/initrd-skel/bin/udhcpc-post file like this:

    rootpath="192.168.1.100:/tftpboot/$clientdir"
    

    - run sudo /opt/drbl/sbin/mknic-nbi -check-server-name n

    When i boot a computer from pxe on the LAN, clonezilla start but give me an error :

    The IPAdress of the computer is not given by Clonezilla Server and can't continue starting clonezilla, why ?

    What have i done wrong ?

     
  • Diamond

    Diamond - 2011-05-24

    - add parsing functions to /usr/lib/mkpxeinitrd-net/initrd-skel/bin/udhcpc-post file and extract needed ip from /proc/cmdline. The string like "ip=192.168.0.100:255.255.255.0.192.168.0.23…" is appended to kernel command line by syslinux (see syslinux wiki for IP= option). Second or third address is for proxy DHCP server (e.g. Clonezilla server). Set rootpath variable like this: rootpath="$PARSED_IP_FROM_CMDLINE:/tftpboot/$clientdir"

    Hello,

    I am lost there. I am using ubuntu 10.04 Server

    My /proc/cmdline

    BOOT_IMAGE=/vmlinuz-2.6.32-31-generic-pae root=/dev/mapper/clone-root ro quiet

    There is no IP address as kasatkin said, so I cannot extract it…

    My /usr/lib/mkpxeinitrd-net/initrd-skel/bin/udhcpc-post

    ROOT_NFS_OPT="ro,rsize=65536,wsize=65536,tcp,nolock"

    # We can assign the root directory for clients, but it's rare, and you still
    # have to modify a lot of settings, such as /etc/exports in server.
    clientdir="$(grep clientdir /proc/cmdline | sed -e "s/.*clientdir=\(\+\).*$/\1/")"
    if ; then
      # Use the default one if not assigned. Normally we will use node_root always.
      clientdir=node_root
    fi

    if ; then
      ifconfig $interface 0.0.0.0 up
      TIMEOUT="$sleep_time_after_NIC_up"
      echo -n "Sleep for $sleep_time_after_NIC_up sec(s) to wait for this NIC ready… "
      while ; do
        echo -n "$TIMEOUT "
        sleep 1
        TIMEOUT="$((TIMEOUT - 1))"
      done
      echo
    else if  ; then
        echo $sname > /dev/sname
        # Do we want to check server name ?
        case "$check_server_name" in
          n|N|)
            echo "I do not care which DHCP server provides me an IP address…"
            echo "DHCP server name now is: $sname"
            ;;
          *)
            echo "I just want DHCP server with server name \"$dhcp_server_name\" provides me an IP address…"
            echo "DHCP server name now is: $sname"
            # force to get the right dhcp server, i.e we want $dhcp_server_name server
             && exit
    ;;
        esac

        # If the rootpath is empty, it's not DRBL server,
        #we will try to get another IP from dhcpd server
        # && exit 1
        echo "UDHCPC: I am $ip, booting from $serverid"
         && echo $hostname > /proc/sys/kernel/hostname
         && BROADCAST="broadcast $broadcast"
         && NETMASK="netmask $subnet"
        ifconfig $interface $ip $BROADCAST $NETMASK
        route add default gw $router dev $interface
        echo -n > /etc/resolv.conf
        for i in $dns; do
          echo nameserver $i >> /etc/resolv.conf
        done
         || siaddr=$serverid
         || rootpath="$siaddr:/tftpboot/$clientdir"
        # erase the space
        rootpath_=`echo $rootpath | sed -e "s/ //g"`
        rootpath="$rootpath_"
        # erase the space
        echo "rootpath= $rootpath"
        echo "Mounting root filesystem $rootpath at /sysroot…"
        echo "If this appears to hang, check"
        kernel_ver=`uname -r`
        echo "1. Is the driver of the network card loaded successfully in this computer ? Press Shift-PageUp to check the message in the screen ? If not, maybe
    this network card is too new so in this kernel \"$kernel_ver\" a suitable driver is not available! Run /bin/ls_pciid.sh then compare the results with the fi
    le /usr/lib/mkpxeinitrd-net/initrd-skel/etc/pcitable in the DRBL server."
        echo "2. The TCPwrapper setting (/etc/hosts.allow and /etc/hosts.deny) and firewall rules in your DRBL server, do you block the clients ?"
        echo "3. Is there any other dhcp server in this subnet ?"
        echo "4. The server of $rootpath is able to reverse-map my IP address $ip to obtain my hostname $hostname."
        echo "check http://drbl.sourceforge.net/faq for more details!"

        echo "Mounting root filesystem $rootpath at /sysroot with option \"$ROOT_NFS_OPT\"…"
        mount -t nfs -n -o $ROOT_NFS_OPT $rootpath /sysroot
        retv=$?
        if ; then
          echo "Mounted the root filesystem successfully! Continue…"
        else
          echo "Failed to mount the root filesystem! Something went wrong!!!"
        fi

      fi
    fi

    Please guide me step by step.
    Thanks

     
  • Diamond

    Diamond - 2011-07-25

    bump

     
  • Nikolay Kasatkin

    Hello, I am lost there. I am using ubuntu 10.04 Server My /proc/cmdline…

    Hello, diamond2!

    File /proc/cmdline on client not on the server.

    The script /usr/lib/mkpxeinitrd-net/initrd-skel/bin/udhcpc-post will be executed on client side after booting it from PXE.

     
  • Anonymous

    Anonymous - 2011-12-08

    Here is a good howto to install dnsmasq with a ltsp server!
    https://help.ubuntu.com/community/UbuntuLTSP/ProxyDHCP

    and it works on debian too!

     
  • Steven Shiau

    Steven Shiau - 2011-12-15

    Thanks for sharing that.

    Steven.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.