Changeset 7123 in genesis for tools/iris/wleiden.pl


Ignore:
Timestamp:
Aug 15, 2009, 10:02:26 AM (15 years ago)
Author:
rick
Message:

Initial setup off dnsmasq configuration

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tools/iris/wleiden.pl

    r7076 r7123  
    6060    $output .= $config{$interface};
    6161  };
     62  return($output);
     63};
     64
     65
     66sub dnsmasq_conf {
     67  my $output = genHeader("#");
     68  $output .=
     69    "# Query all upstream dns servers by default\n" .
     70    "--all-servers \n" .
     71    "# DHCP server options \n" .
     72    "--dhcp-authoritative \n" .
     73    "--dhcp-fqdn \n" .
     74    "--domain=dhcp.$nodename.$domain. \n" .
     75    "\n";
     76
     77  foreach my $interface (sort keys %config) {
     78    if( $interface =~ /^[a-z]+[0-9]+$/i ) {
     79      (my $ip, my $netmask) = split('/', $IP{$interface});
     80      my $subnet = IP::toSubnet($netmask);
     81     
     82      $output .=
     83      "## $interface $DESC{$interface}\n";
     84     
     85      if ( $DHCP{$interface} =~ /[0-9]+\-[0-9]+/i ) {
     86        my $dhcp_part = $ip;
     87        $dhcp_part =~ s/[0-9]+$//;
     88        (my $dhcp_start, my $dhcp_stop) = $DHCP{$interface} =~ /([0-9]+)\-([0-9]+)/i;
     89        $dhcp_start = $dhcp_part . $dhcp_start;
     90        $dhcp_stop = $dhcp_part . $dhcp_stop;
     91        $output .= "--dhcp-range=$interface,$dhcp_start,$dhcp_stop,$subnet,24h\n\n";
     92      }
     93      else {
     94       $output .= "# not autoritive \n\n";
     95      };
     96    };
     97  };
     98 
    6299  return($output);
    63100};
Note: See TracChangeset for help on using the changeset viewer.