[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

MAC management tool -- was: RE: [K12OSN] Logging in a terminal



On Wed, 5 Jun 2002, Bert Rolston wrote:

> This runs a Win4Lin session in full screen mode, instead of windowed mode.
> 
> I forgot to mention this in the message. I covered it in the preceding 
> message, sorry.

yeah -- I spoke the command and the answer revealed itself 
<smile>

> As an aside. Would it be possible to use this stanza, but have it parse a 
> separate file for MAC / IP addresses, and host name?

There is no internal dhcpd scripting language beyond the
'grammar' of the stanza's ... and under the Simple *nix Tool
philosophy, probably should NOT be.

That said, it is pretty trivial to parse a $file consisting 
of lines like

pizza|00:80:f1:00:53:6d|172.16.33.103|pizza|y

into

>            host pizza {
>             hardware ethernet 00:80:f1:00:53:6d ;
>                 fixed-address 172.16.33.103 ;
>               option host-name "pizza";
>         }

in php, it would be something like:

#!/usr/bin/php
<?php
$file = "./statics.txt";
$fp = fopen("$file","r");
while (!feof($fp)) { 
	$buffer=fgets($fp,128); 
	$list($common,$MAC,$IP,$hname,$active) = 
		split("|",$buffer);
if ("$active" == "y") {
  print "	
host $common {
     hardware ethernet$MAC ;
     fixed-address $IP ;
   option host-name "hname";
  }
";
	}
	}
fclose ($fp);
?>

which will build the static table stanza's to std out --
change the print to a proper puts to a filehandle to make a
file instead.  then assemble a fill ducpd.conf file from a
mess of stanza's ...  Left as an exercise for the student,
although I would appreciate seeing a MySQL backend and a CGI
front end to Add, Change, Active/Inactive, and Delete entries,
and a finished product crossing the list with a GPL license,
if someone has a couple hours to spare.

Contact me off list if you get stuck making that project, with 
a anon ftp site for me to pull code to review ... I'll polish 
and report a finished product to the group.

-- Russ Herrold





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]