Listing IP's from a dhcpd.conf file - Fedora Support Forums and Community
Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2006

    Thumbs up Listing IP's from a dhcpd.conf file

    Hy every body,

    Within a dhcpd.conf file, we got some fixed IP adresses from –
    The subnet


    #ddns-update-style interim;
    ddns-update-style none;
    ignore client-updates;
    deny client-updates;

    #### By red for PXE Booting
    allow booting;
    allow bootp;
    ### End by red

    log-facility local6;

    subnet netmask {
    # --- default gateway

    ##### By red for PXE booting
    class "pxeclients" { match if substring(option vendor-class-identifier, 0, 9) = "PXEClient";
    filename "linux-install/pxelinux.0"; }
    #### End by red

    option routers;
    option subnet-mask;
    # option nis-domain "";
    option domain-name "ensm.intranet";
    option domain-name-servers;
    option time-offset -18000;
    range dynamic-bootp;
    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:71C:6E:A3:33;

    host Labdazi-EISN1A {
    hardware ethernet C0:38:96:72:8B:5B;

    host Zair-EISN1A {
    hardware ethernet 08:ED:B9:08:94:09;

    host Laddi-EISN1A {
    hardware ethernet D0:53:49B:FE:0F;

    host Zeghar-EISN1A {
    hardware ethernet C4:8E:8F:8F:45:A7;


    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 :

    All the other IP's who are not part of the dhcpd.conf will be just listed one per line :

    Thanks a lot for your help Linux

    Last edited by hermouche; 9th November 2017 at 08:04 PM.
    IBM ThinkPad z60m

  2. #2
    Join Date
    Oct 2011

    Re: Listing IP's from a dhcpd.conf file

    $ grep "fixed-address" dhcpd.conf | sed -r 's/.*fixed-address ((\b[0-9]{1,3}\.){3}[0-9]{1,3}\b);/#\1/'

Similar Threads

  1. dhcpd.conf file not found in fedora 15
    By magicalshashank in forum Servers & Networking
    Replies: 4
    Last Post: 18th October 2011, 08:38 PM
  2. Cannot find dhcpd.conf file in FC3
    By Shamshir in forum Servers & Networking
    Replies: 3
    Last Post: 15th July 2005, 05:09 PM
  3. where i find DHCPd.conf file ???
    By hanybee in forum Using Fedora
    Replies: 9
    Last Post: 11th June 2005, 09:06 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts