DHCP服务器自动调用外部脚本

DHCP服务器当有新客户端连接时,自动调用外部脚本的方法:

subnet 172.16.0.0 netmask 255.255.255.0 {
 
	range 172.16.0.10 172.16.0.200;
	option routers 172.16.0.1;
 
        on commit {
                set clip = binary-to-ascii(10, 8, ".", leased-address);
		set clhw = binary-to-ascii(16, 8, ":", substring(hardware, 1, 6));
                execute("/server/shell/newip", clip , clhw , 'aaa' , 'bbbb');
        }
 
}
 
clip: 客户端IP
clhw:客户端mac
后面的是其他参数
参数将作为shell的参数传入脚本/server/shell/newip
 
 

 

发表评论


注意 - 你可以用以下 HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" cssfile="">

普人特福的博客cnzz&51la for wordpress,cnzz for wordpress,51la for wordpress