LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (http://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Fixed IP Address with DHCP (http://www.linuxquestions.org/questions/linux-networking-3/fixed-ip-address-with-dhcp-230901/)

dgreenbean 09-15-2004 09:18 AM

Fixed IP Address with DHCP
 
Hi there,

I'm somewhat of a newbie trying to set up a Linux (RH9) box on a LAN that I have set up. The Linux machine is going to be a web server behind a firewall controlled by a router (similar to a DLink router).

The issue is that I want the Linux machine to always try to get the same IP from the DHCP on the router, say 192.168.1.150. I will never have more than 20 machines on the LAN, so this shouldn't conflict with anything, but if it does, I can change the address. The problem is that I can't configure the DHCP server on the router to assign that IP address to a hardware address.

Also, since I want the Linux box to be a web server, I need for the router to send traffic on port 80, which it will only do if it assigns the IP address using DHCP (it's very picky).

I tried creating /etc/dhclient-eth0.conf and putting this in it:
lease {
interface "eth0";
fixed-address 192.168.1.150;
}

After restarting the network service and rebooting the machine, all I got was 192.168.1.101 (dynamically assigned by DHCP).

What bothers me even more is that I had done this successfully at one point, but completely forgot how I did it, other than the dhclient.conf file above.

Does anyone have an idea of what I missed?

By the way, if I run `dhclient -1 -q -cf /etc/dhclient-eth0.conf eth0`, the same thing happens.

Any help will be extremely appreciated.

Thanks,
David

r0b0 09-15-2004 09:33 AM

So don't get the address from DHCP but set it statically on this server.

dgreenbean 09-15-2004 09:40 AM

Thanks for your reply.

Unfortunately I had tried that. When I statically set the address, the router would no longer route port 80 to it. The router requires that the machine asks for a DHCP lease from it.

I think there's a way to configure the DHCP client to ask for a specific address from the DHCP server. Do you know if this is possible?

Thanks,
David

linux_newbie_23 09-15-2004 11:30 AM

I forget what DHCP client RH9 uses. If it's "dhclient"
say "man dhclient" (and if it's "pump" say "man pump"
etc.). If it's dhclient you can also say "man dhclient.conf"
to get information about its configuration file.

dgreenbean 09-15-2004 11:41 AM

RH9 uses dhclient. I actually used those man pages to create the dhclient-eth0.conf mentioned in the initial post.

I fear that the conf file either isn't being read or that there is something blocking the fixed-address property from being processed.

Thank you for your reply, but it seems that there is something more complex at work here.

reetep 09-15-2004 03:52 PM

Does the manufacturer of your router not provide you with documentation? I would have thought you want to ask the DHCP server to hand out the same IP address based on the hardware address.

jschiwal 09-15-2004 05:20 PM

If you select a static address below the starting address for DHCP, you may be able to route port 80 to it. Isn't there a page where you can enter the last ip number for the machine receiving that port?

michaelk 09-15-2004 09:17 PM

I do not believe that the router will not send traffic if a PC is not assigned an IP address via DHCP. What is the make and model of the router?

linux_newbie_23 09-15-2004 10:00 PM

I can't say I understood most (any?) of what I read, but "man dhclient-script"
mentions the "BOUND" variable, which seems to say to me that a client could
request a particullar address, what you originally asked about. Let us know
if it works. Thanks.

dgreenbean 09-19-2004 01:12 PM

Hi all,

Thank you for your replies. In the end, I switched to a Linksys router, and used a static IP address. It bugs me that I couldn't do it with the other router, BritePort 8120, but such is life. I wouldn't be surprised if they have a firmware upgrade for that router.

I guess my hack from before will remain a mystery for now.

Thanks again,
David


All times are GMT -5. The time now is 11:17 AM.