[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Forcing specific IP address with DHCP



Hi,

I find myself in a bizarre networking predicament.  I need to have
a server (henceforth 'edith') accept incoming connections (e.g. ssh)
from the Internet.  edith is behind a home gateway / router / switch
( Trendware / Trendnet TEW-452BRP [0] - henceforth 'gwen').  gwen will
forward specific ports to specific private, internal IP addresses, but
bizarrely, it seems to provide no facility for ensuring that a specific
host will be assigned, via DHCP, a particular IP address.  My previous
box, an old Netgear unit, would reserve specific IP addresses for
particular MAC addresses, which was exactly what I want, but after a
fairly exhaustive search through gwen's web interface, I can see no way
to do this with gwen.  What use is port forwarding when one can't
guarantee which LAN host will receive the connections?  I can see
several solutions, all of which involve telling gwen to exclude some IP
address from its DHCP pool and then somehow guaranteeing that edith
gets a specific one of them:

I)  Use static network configuration, rather than DHCP, for edith.  The
problem is that edith needs to get my ISP's nameservers from gwen,
which normally occurs through DHCP.  Several sub-solutions:

	A)  Hard code the nameservers, and hope they don't change.  The
drawback to this approach is obvious; hope isn't a valid substitute for
correctness.

	B)  Use other nameservers, such as OpenDNS's [1].  This might
work, but I'd rather use my ISP's.

	C)  Write a script to extract my ISP's nameservers from the
appropriate page of gwen's web interface, similar to what ddlient can
do to get the router's external IP address.  I suppose this is doable,
but far too much trouble for something that should be trivial.

II)  Use dhclient's supersede facility to override gwen's DHCP offer.
After struggling with the various DHCP manpages, I can't figure out how
to supersede the IP address; all the examples deal with superseding
things such as the nameservers.  Am I missing something?

III)  Accept the DHCP offer, but use an alias stanza to alias the
interface to a fixed IP address.  This is the solution I'm currently
using; it seems to work fine, but it feels a bit kludgy.  I added this
to /etc/dhcp3/dhclient3.conf:

alias {
        interface "ath0";
        fixed-address 192.168.0.2;
        option subnet-mask 255.255.255.0;
}

What would you do in this situation (besides getting a different router
or using a general purpose computer as one)?

Celejar
--
mailmin.sourceforge.net - remote access via secure (OpenPGP) email
ssuds.sourceforge.net - A Simple Sudoku Solver and Generator


Reply to: