Hy everybody,
Within a dhcpd.conf file, we got some fixed IP adresses from 192.168.0.1 - 192.168.0.254.
Sample:
#ddns-update-style interim;
ddns-update-style none;
ignore client-updates;
deny client-updates;
authoritative;
#### By red for PXE Booting
allow booting;
allow bootp;
### End by red
log-facility local6;
subnet 192.168.0.0 netmask 255.255.255.0 {
# --- default gateway
##### By red for PXE booting
class "pxeclients" { match if substring(option vendor-class-identifier, 0, 9) = "PXEClient";
next-server 192.168.0.1;
filename "linux-install/pxelinux.0"; }
#### End by red
option routers 192.168.0.1;
option subnet-mask 255.255.255.0;
# option nis-domain "domain.org";
option domain-name "ensm.intranet";
option domain-name-servers 192.168.0.1;
option time-offset -18000;
range dynamic-bootp 192.168.0.5 192.168.0.239;
default-lease-time 3600;
max-lease-time 7200;
# we want the nameserver to appear at a fixed address
group {
use-host-decl-names true;
host Naoui-EISN1A {
hardware ethernet 00:71:CC:6E:A3:33;
fixed-address 192.168.0.6;
}
host Labdazi-EISN1A {
hardware ethernet C0:38:96:72:8B:5B;
fixed-address 192.168.0.7;
}
host Zair-EISN1A {
hardware ethernet 08:ED:B9:08:94:09;
fixed-address 192.168.0.8;
}
host Laddi-EISN1A {
hardware ethernet D0:53:49:CB:FE:0F;
fixed-address 192.168.0.9;
}
host Zeghar-EISN1A {
hardware ethernet C4:8E:8F:8F:45:A7;
fixed-address 192.168.0.10;
}
}
}
We need a bash script which list all the IP's in one text file in a way that :
Those Ip's who are part of the dhcpd.conf will be listed one per line and will have a '#' symbol at the begining, such as :
#192.168.0.6
#192.168.0.7
#192.168.0.8
.......
.......
All the other IP's who are not part of the dhcpd.conf will be just listed one per line :
192.168.0.100
192.168.0.101
192.168.0.201
.........
.........
Thanks a lot for your help
red