LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Red Hat (http://www.linuxquestions.org/questions/red-hat-31/)
-   -   Reserve IP in DHCP (http://www.linuxquestions.org/questions/red-hat-31/reserve-ip-in-dhcp-151410/)

plexus 02-27-2004 11:23 PM

Reserve IP in DHCP
 
Hi all

My machine has 2 network interface (eth0 & eth1). I would like to know how is it possible to reserve IP address for these 2 interface? It seems like dhcpd don't allow similar hostname. How can I resolve this when I have only a hostname for this machine?

My hostname is: computer1.domain.com

Below is an extract of my dhcpd.conf file

Code:

host computer1 {
    hardware ethernet 00:80:48:XX:XX:XX;
    fixed-address 192.168.1.20;
}

host computer1 {
    hardware ethernet 00:0B:CD:XX:XX:XX;
    fixed-address 192.168.1.30;
}

Also, can I know if it is possible to obtain dynamic IP address from my own dhcp server on the 2 interface? (EG: the machine acts as a dhcp server and the interface obtain the IP from the dhcp as well)

Thanks :)

DavidPhillips 02-28-2004 10:20 AM

It should take it. Mine does
Code:

subnet 192.168.0.0 netmask 255.255.255.0 {
        option routers                        192.168.0.1;
        option subnet-mask                255.255.255.0;
        option nis-domain                  "dcphillips.net";
        option domain-name                "dcphillips.net";
        option domain-name-servers    192.168.0.1, 68.63.0.5, 68.63.0.6;
        option time-offset                      0;
        option ntp-servers                    time.nist.gov;
        option netbios-name-servers    192.168.0.1;
        option netbios-node-type          2;
        option smtp-server                  192.168.0.1;
 
        range dynamic-bootp              192.168.0.101 192.168.0.200;
        default-lease-time                    21600;
        max-lease-time                        43200;
 
 
host firedragon {
hardware ethernet 00:04:.........;
fixed-address 192.168.0.2;
option host-name "firedragon";
}
 
host firedragon {
hardware ethernet 00:50:.........;
fixed-address 192.168.0.7;
option host-name "firedragon";
}
}


plexus 02-29-2004 12:41 AM

Hmm. What if it's for 2 subnet?

I forget to mention that important point :)

DavidPhillips 02-29-2004 10:06 AM

What's the error your getting and how does your file look?
Code:

subnet 192.168.0.0 netmask 255.255.255.0 {
        option routers                        192.168.0.1;
        option subnet-mask                255.255.255.0;
        option nis-domain                  "dcphillips.net";
        option domain-name                "dcphillips.net";
        option domain-name-servers    192.168.0.1, 68.63.0.5, 68.63.0.6;
        option time-offset                      0;
        option ntp-servers                    time.nist.gov;
        option netbios-name-servers    192.168.0.1;
        option netbios-node-type          2;
        option smtp-server                  192.168.0.1;
 
        range dynamic-bootp              192.168.0.101 192.168.0.200;
        default-lease-time                    21600;
        max-lease-time                        43200;
 
 
host firedragon {
hardware ethernet 00:04:.........;
fixed-address 192.168.0.2;
option host-name "firedragon";
}
 
host firedragon {
hardware ethernet 00:50:.........;
fixed-address 192.168.0.7;
option host-name "firedragon";
}
}

subnet 192.168.1.0 netmask 255.255.255.0 {
        option routers                  192.168.1.1;
        option subnet-mask              255.255.255.0;
        option nis-domain              "dcphillips.net";
        option domain-name              "dcphillips.net";
        option domain-name-servers      192.168.1.1, 68.63.0.5, 68.63.0.6;
        option time-offset              0;
        option ntp-servers              time.nist.gov;
        option netbios-name-servers    192.168.1.1;
        option netbios-node-type 2;
        option smtp-server              192.168.1.1;
        range dynamic-bootp 192.168.1.101 192.168.1.200;
        default-lease-time 21600;
        max-lease-time 43200;
                                                                                                                                                                       
host firedragon {
hardware ethernet 00:04:.........;
fixed-address 192.168.1.2;
option host-name "firedragon";
}
 
host firedragon {
hardware ethernet 00:50:.........;
fixed-address 192.168.1.7;
option host-name "firedragon";
}
}


plexus 03-02-2004 06:31 AM

yeah, my config is about the same as yours..

Code:

subnet 192.168.10.0 netmask 255.255.255.0 {

        option routers                              192.168.10.1;
        option subnet-mask                    255.255.255.0;

        option domain-name                    "mydomain.com";
        option domain-name-servers      192.168.10.1,192.168.20.2;

        range dynamic-bootp 192.168.10.3 192.168.10.254;
        default-lease-time 21600;
        max-lease-time 43200;                                                                             
        host PC1 {
              hardware ethernet 00:80:48:XX:XX:XX;
              fixed-address 192.168.10.2;
        }
}

subnet 192.168.20.0 netmask 255.255.255.0 {

        option routers                              192.168.20.2;
        option subnet-mask                    255.255.255.0;

        option domain-name                    "mydomain.com";
        option domain-name-servers      192.168.10.1,192.168.20.2;

        range dynamic-bootp 192.168.20.10 192.168.20.254;
        default-lease-time 21600;
        max-lease-time 43200;                                                                             
        host PC1 {
              hardware ethernet 00:0B:CD:XX:XX:XX;
              fixed-address 192.168.20.3;
        }
}


plexus 03-06-2004 02:25 AM

Alright, I got it to work.

Just place the following in the global section of the config file:

Code:

host PC1 {
    hardware ethernet XX:XX:XX:XX:XX:XX;
    fixed-address 10.1.1.1,20.1.1.1,30.1.1.1;
}

Anyway, thanks DavidPhillips :)

DavidPhillips 03-08-2004 01:20 PM

cool, I never had to do that one before.

Good job!


All times are GMT -5. The time now is 02:09 PM.