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

Re: /etc/dhclient.conf not recognised



On Fri, Jun 23, 2006 at 11:51:49AM +0530, L.V.Gandhi wrote:
> I have dhcp server in my ADSL modem cum router. I have following lines in
> /etc/dhclient.conf
> lease {
>  interface "eth1";
>  option host-name "lvghomepc";
>  fixed-address 192.168.1.2;
> }

If the DHCP server in the ADSL modem/router is working, then the
dhclient will *not* be using the "lease" section in /etc/dhclient.conf.

The client uses the lease section as a fall-back when no server
responds...

Besides: The whole premise behind DHCP is that the clients know
*nothing* about the network - this knowledge is centralised in the DHCP
server(s). 

Basically, the clients broadcast out "I'm new here. I don't know
anybody. Help. Somebody give me an IP address" and the ever-friendly
DHCP server responds with "here's IP address x.x.x.x, your network mask,
default gateway and name servers. It's yours for the next hour - if you
want it longer, let me know".

> But ifconfig gives the following results.
> eth1      Link encap:Ethernet  HWaddr 00:26:54:0E:8E:C0
>          inet addr:192.168.1.4  Bcast:192.168.1.255  Mask:255.255.255.0

Yep. Looks like the server responded. If you check /var/log/syslog and
search for "dhc" you should see the dhclient chatter to confirm the
sequence of events.

> I want to connect a laptop and pc to this dhcp server by their respective
> ethernet ports and do lan jobs between pc and laptop.

Depending on your ADSL modem, you may be able to tell its DHCP server to
hand out specific IP addresses to specific MAC addresses (HWaddr as
listed by /sbin/ifconfig). You'll have to check the documentation for
your modem/router for this.

If you cannot convince the DHCP server to hand out "fixed" IP addresses,
then you have (at least) two other options:

- Use dynamic DNS: This allows the IP-addresses to "float", but the DNS
  names can be fixed. This is the "neatest" solution from a technical
  point-of-view, but it does require the cooperation of the DHCP server
  and a friendly name server. I'm sure there's a HOWTO out there
  describing it better than I ever could.

- Use fixed IP addresses for the clients. For this, you'll need to:
   - check the DHCP server config in your adsl modem/router: There will
     be a range of IP addresses that it hands out. Pick some IP
     addresses *outside* that range (but still within the range for the
     subnet). You may have to change the DHCP range to "make room".

   - On the clients: configure /etc/network/interfaces. There should be
     some example lines in there you can use ("iface eth0 inet static"
     etc...). You only need to do this on the clients that need fixed IP
     addresses: let the other clients use DHCP as per usual. Then bounce
     the client network interfaces:
        # ifdown eth0
        # ifup eth0
    and start playing.

> Where am I doing mistake?

Not being rude, but rtfm :-)  - at least with regard to the "lease"
declarations in /etc/dhclient.conf.

Hope this helps

-- 
Karl E. Jorgensen
karl@jorgensen.org.uk  http://www.jorgensen.org.uk/
karl@jorgensen.com     http://karl.jorgensen.com
==== Today's fortune:
Who loves not wisely but too well
Will look on Helen's face in hell,
But he whose love is thin and wise
Will view John Knox in Paradise.
		-- Dorothy Parker

Attachment: signature.asc
Description: Digital signature


Reply to: