LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   dhcpd.conf for 2 NICS (PXE) (https://www.linuxquestions.org/questions/linux-networking-3/dhcpd-conf-for-2-nics-pxe-430381/)

terp4life2001 03-31-2006 01:14 PM

dhcpd.conf for 2 NICS (PXE)
 
Hello everyone,

I currently have a computer which I run a dhcp and dns server on. It serves my home network and does a pretty good job of it. What I want to do is extend this servers functionality so that I can PXE boot of it's second NIC. I think that I will use a cross-over cable to connect the target system with the PXE server. Also, I'm attempting statically assigned dhcp, so the ifcfg-ethX files use dhcp but the dhcpd assigns static addresses. I'm slightly confused about a few things.

1) I think that I want two subnets, one for each NIC. I.e. 192.168.1.x for the general purpose home network and 192.168.3.x for the PXE server and client. The only reason that I'd can think to do this is just for organization, so that when a client has a 192.168.3.x IP I know he's connected to the correct NIC. Does this sound right?

2) Frankly I'm confused about the syntax of the dhcpd.conf file and how I associate a subnet with a NIC. I thought that using the MAC address I'd be able to force a NIC into a certian subnet but I must be missing something. I would think that without the PXE NIC connected to anything it should be able to give itself an address. However, I know that NICs broadcast the dhcp request, so maybe if the NIC isn't connected it can't broadcast correctly. Here is my dhcpd.conf and ifcfg-eth0, when I restart the eth0 interface it doesn't get an IP. Am I doing something obviously wrong?

[rwlove@LOVE_file ~]$ cat /etc/dhcpd.conf
ddns-update-style interim;
ignore client-updates;

subnet 192.168.1.0 netmask 255.255.255.0 {

# --- default gateway
option routers 192.168.1.1;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.1.255;
option ip-forwarding off;

# option nis-domain "LOVESHACK.org";
option domain-name "LOVESHACK.org";
option domain-name-servers 192.168.1.201;

# option time-offset -18000; # Eastern Standard Time
# option ntp-servers 192.168.1.1;
option netbios-name-servers 192.168.1.201;
# --- Selects point-to-point node (default is hybrid). Don't change this unless
# -- you understand Netbios very well
# option netbios-node-type 2;

range dynamic-bootp 192.168.1.200 192.168.1.254;
default-lease-time 21600;
max-lease-time 43200;

# we want the nameserver to appear at a fixed address
# gigabit nic interface
host LOVE_file {
hardware ethernet 00:0E:0C:65:1E:18;
fixed-address 192.168.1.201;
option host-name "LOVE_file.LOVESHACK.org";
}

# Eth0 interface
# hardware ethernet 00:07:E9:EF:7C:8B;

host MythTVClient {
hardware ethernet 00:50:70:26:4F:9E;
fixed-address 192.168.1.202;
}

host LOVE_media {
hardware ethernet 00:11:95:B9:27:D9;
fixed-address 192.168.1.203;
}

host LOVE_mobile {
hardware ethernet 00:90:4B:12:31:26;
fixed-address 192.168.1.204;
}

host PictureFrame {
hardware ethernet 00:03:47:B4:7F:5F;
fixed-address 192.168.1.205;
}

host TrueMobile2300 {
hardware ethernet 00:90:4b:35:29:9a;
hardware ethernet 00:90:4b:35:29:9b;
fixed-address 192.168.1.206;
}
}


subnet 192.168.3.0 netmask 255.255.255.0 {

allow booting;
allow bootp;

range dynamic-bootp 192.168.3.0 192.168.3.10;

# --- default gateway
option routers 192.168.3.1;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.3.255;
option ip-forwarding off;

# option nis-domain "LOVESHACK.org";
option domain-name "LOVESHACK.org";
option domain-name-servers 192.168.3.1;

# option time-offset -18000; # Eastern Standard Time
# option ntp-servers 192.168.1.1;
option netbios-name-servers 192.168.3.1;
# --- Selects point-to-point node (default is hybrid). Don't change this unless
# -- you understand Netbios very well
# option netbios-node-type 2;

range dynamic-bootp 192.168.3.1 192.168.3.10;
default-lease-time 21600;
max-lease-time 43200;

option domain-name "LOVESHACK.org";

host PXEServer {
hardware ethernet 00:07:E9:EF:7C:8B;
fixed-address 192.168.3.1;
option host-name "PXEServer";

}

filename "pxelinux.0";

}


[root@LOVE_file ~]# ifconfig eth0 down ; ifconfig eth0 up
[root@LOVE_file ~]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:07:E9:EF:7C:8B
inet6 addr: fe80::207:e9ff:feef:7c8b/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:306 errors:0 dropped:0 overruns:0 frame:0
TX packets:12 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:63670 (62.1 KiB) TX bytes:896 (896.0 b)

eth1 Link encap:Ethernet HWaddr 00:0E:0C:65:1E:18
inet addr:192.168.1.201 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::20e:cff:fe65:1e18/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:108255131 errors:3 dropped:0 overruns:0 frame:2
TX packets:116303168 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:2564484497 (2.3 GiB) TX bytes:527943314 (503.4 MiB)
Base address:0xdf00 Memory:feac0000-feae0000

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:48028027 errors:0 dropped:0 overruns:0 frame:0
TX packets:48028027 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:911761205 (869.5 MiB) TX bytes:911761205 (869.5 MiB)


Thanks in advance!!

//Rob

michaelsanford 04-01-2006 05:44 PM

"Frankly I'm confused about the syntax of the dhcpd.conf file and how I associate a subnet with a NIC. I thought that using the MAC address I'd be able to force a NIC into a certian subnet but I must be missing something."

I had the same problem a while back (when I started working at an ISP actually). You included a lot of info, so I'll try to help you address problems one at a time, starting with that one (above).

I will assume that you actually have three NICs, eth0, eth1 and eth2 (one of which is used to connect to the internet, the other two for routing). When you bring up an interface you will specify its IP address if it is not asking for a DHCP lease from somewhere else (which it's not since YOU are the DHCP server).

eth0 192.168.1.1 netmask 255.255.255.0 up
eth1 192.168.3.1 netmask 255.255.255.0 up

When you run `dhcpd' it will automatically bind to the interfaces whose netmasks and IP addresses match an antry in dhcpd.conf. So, dhcpd will listen for 192.168.1.X DHCP_REQs on eth0.

Try dealing with that and then we'll see.

Herer's a small section of mine, I'll explain what it means below:
Code:

####
# eth1
subnet 10.0.0.0 netmask 255.255.0.0 {
        option routers 10.0.0.1;
        option ip-forwarding on;
        option domain-name-servers 206.47.244.13, 206.47.244.60;

        host airport {
                hardware ethernet 00:11:24:06:53:ca;
                fixed-address 10.0.0.2;
        }
}

As you can see I assign a netmask of 255.255.0.0 on the subnet of 10.0.0.0. This means that dhcpd will assign addresses from 10.0.0.2 - 10.0.1.254 on that interface and that all machines in that range can see each other. You can stick in whatever static-ip mappings you want.

So unless you have a physical reason to split it into two NICs you can, but you may not need to...

Overwhelmed yet :P


All times are GMT -5. The time now is 06:21 PM.