linuxmuster / linuxmuster-base7

Mangement scripts for linuxmuster.net V7
GNU General Public License v3.0
13 stars 8 forks source link

subnet structure in dhcpd.conf #80

Closed HappyBasher closed 4 years ago

HappyBasher commented 5 years ago

Host entries should be entered in dhcpd.conf within the respective subnets to allow fixed ip adresses for hosts in different subnets.

HappyBasher commented 4 years ago

/etc/dhcp/subnet.conf and /etc/dhcp/devices.conf, which are included in /etc/dhcp/dhcpd.conf, will be removed and replaced by the new file /etc/dhcp/linuxmuster.conf. This file will contain the subnet declarations imported from /etc/linuxmuster/subnets.csv. Host declarations imported from /etc/linuxmuster/sophomorix//devices.csv were included within the corresponding subnet declaration from files created by the linuxmuster-import scripts under /etc/dhcp/linuxmuster.d. In this way hosts are hierarchically assigned to the respective subnet declaration. Example linuxmuster.conf (note: subnet 10.0.50.0 has no hosts defined in devices.csv):

subnet 10.0.0.0 netmask 255.255.255.0 {
    option routers 10.0.0.253;
    option subnet-mask 255.255.255.0;
    option broadcast-address 10.0.0.255;
    option netbios-name-servers 10.0.0.1;
    option host-name pxeclient;
    range 10.0.0.201 10.0.0.250;
    include "/etc/dhcp/linuxmuster.d/10.0.0.0.conf";
}
subnet 10.0.50.0 netmask 255.255.255.0 {
    option routers 10.0.50.254;
    option subnet-mask 255.255.255.0;
    option broadcast-address 10.0.50.255;
    option netbios-name-servers 10.0.0.1;
    option host-name pxeclient;
    range 10.0.50.201 10.0.50.250;
}
subnet 10.0.100.0 netmask 255.255.255.0 {
    option routers 10.0.100.254;
    option subnet-mask 255.255.255.0;
    option broadcast-address 10.0.100.255;
    option netbios-name-servers 10.0.0.1;
    option host-name pxeclient;
    range 10.0.100.201 10.0.100.250;
    include "/etc/dhcp/linuxmuster.d/10.0.100.0.conf";
}

Example 10.0.0.0.conf:

host 10.0.0.1 {
  hardware ethernet 52:54:00:93:00:15;
  fixed-address 10.0.0.1;
  option host-name "server";
}
host 10.0.0.254 {
  hardware ethernet 52:54:00:CD:FF:02;
  fixed-address 10.0.0.254;
  option host-name "firewall";
}
host 10.0.0.2 {
  hardware ethernet 52:54:00:E2:4B:B6;
  fixed-address 10.0.0.2;
  option host-name "opsi";
}
host 10.0.0.3 {
  hardware ethernet 52:54:00:36:AD:60;
  fixed-address 10.0.0.3;
  option host-name "docker";
}

Example 10.0.100.0.conf:

host 10.0.100.1 {
  hardware ethernet 00:0c:29:22:22:21;
  fixed-address 10.0.100.1;
  option host-name "r100-pc01";
  option extensions-path "win7";
  filename "boot/grub/i386-pc/core.0";
}
host 10.0.100.2 {
  hardware ethernet 52:54:00:6a:8b:75;
  fixed-address 10.0.100.2;
  option host-name "r100-pc02";
  option extensions-path "bionic";
  filename "boot/grub/i386-pc/core.0";
}
host 10.0.100.3 {
  hardware ethernet 08:00:27:d3:3c:57;
  fixed-address 10.0.100.3;
  option host-name "r100-pc03";
  filename "linux/pxelinux.0";
  next-server 10.0.0.2;
}

Is the webui affected by this changes @kiarn @PLanB2008 ?

HappyBasher commented 4 years ago

Because host declarations are global and not limited to the scope they are declared in, this issue is lapsed.