DHCP Plug and Play

From LinuxMCE
Revision as of 01:00, 18 December 2007 by Matthew (Talk | contribs) (Link to Single to Double NIC)

Jump to: navigation, search

LinuxMCE allows a user to plug in any type of device and automatically configures it and lets the user start using it right away without doing anything. The way this is accomplished is with an extension to the DHCP server. When a new device is plugged into the network and requests an IP address, this program connects to a central database to do a lookup of the device's unique MAC address to see what type of device it is. The database defines all the configuration data the device needs to run, and references the software drivers needed. This program then downloads and installs any needed software, adds configuration pages for the device to the user's LinuxMCE Admin Website, and adds the device in the user's local database.

Single NIC & Existing DHCPd

LinuxMCE recommends its core server have 2 ethernet ports, connecting one to an existing LAN (that routes to the Internet), and the other to a LAN segment on which sit all devices that LMCE will serve. That recommended setup runs a DHCP server (DHCPd) on LMCE to assign IP numbers and other network configs to devices on the "inside" LAN served by LMCE. LMCE runs a DHCP client on its "outside" LAN interface to get its IP# (and any other configs the existing LAN might assign) on that outside LAN. LMCE than routes inside LAN traffic to the outside LAN, including to any router/gateway on the outside LAN, while running a firewall that protects devices on the inside from activity on the outside.

However, it is possible to run LMCE on a host with a single ethernet port. There is some complexity in the configuration, the solution is not as fully automated and robust as is the recommended 2 ethernet version, and the omission of the LMCE firewall reduces the overall security of the installation. However, it is possible to do. These are instructions, including switching the LAN from an existing DHCP server to using the LMCE DHCPd instead. AFAICT, this technique doesn't leave any wrong configurations anywhere inside either LMCE's complex interdependencies or the remnants of the previously existing DHCP system.

  1. In existing router/gateway
    1. Disable DHCPd
    2. Assign LAN IP# on desired subnet (eg 192.168.0.1 )
    3. Ensure router/gateway is configured to route properly between the newly specified subnet and the other network
  2. In LMCE Admin site:
    1. Homepage -> Advanced -> Network -> Network Settings
    2. Change all 192.168.80.x IP#s to desired subnet (eg. 192.168.0.x )
    3. Set both NICs to the same IP# (and proper subnet info)
    4. Reload DCERouter
    5. Check Homepage -> Advanced -> Network -> Network Settings to be sure settings were properly retained
  3. /etc/dhcp3/dhcpd.conf :
    1. Ensure "option routers" parameter(s) is the correct IP#(s) of the existing router(s)
    2. Exclude router/gateway IP# from allocatable ranges
    3. Change "host px[1,2]" lines from 192.168.80.x IP#s to desired subnet IP#s (eg. 192.168.0.253 )
    4. /etc/init.d/dhcp3-server restart
    5. Force a LAN host to reset its network configs by DHCP, then test pinging across the router
  4. Force each host on the LAN to reread its network configs by DHCP (eg. run its DHCP client or reboot if its DHCP client runs at startup).

Note that the dhcpd.conf file regenerated by the LMCE Admin site's Network Settings form has a bug which doesn't change all the IP#s properly. There might be other bugs, so check the whole file to be sure it's correct.

Caveat

This technique leaves a problem in that any configs of your original router/gateway DHCPd are not available to the LMCE DHCPd, unless you manually recreate them in the LMCE's dhcpd.conf file. Also, the router/gateway LAN IP# must be manually discovered/set, and then the LMCE LAN subnet must be manually configured to accommodate it. There is no way to fix that problem, unless the router/gateway allows its LAN IP# to be set by DHCP (ie. a DHCP client running on the router/gateway that is set by the LMCE DHCPd). Conversely, there is no way for LMCE to insert into the router/gateway DHCPd configs the configs that LMCE needs clients for its own services (like IP phones) to automatically get from a DHCPd when they're plugged into a network. The only way to make DHCP fully automatic for LMCE is to use the recommended network architecture of a pair of ethernet ports on the LMCE server (or use a router/gateway DHCPd that can be remotely configured by the LMCE, and a script to glue them together).

Switching From Single NIC to Double NIC

There are instructions for switching from Single to Double NIC.