马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
×
原为地址 http://www.irouteros.com/?p=463
客户通过windows电脑使用PPTP连接进入routeros,这时该PPTP账号对应一个运营商PPPoE拨号,并自动启动连接,这个PPPoE拨号获取一个公网IP上网,该账号的PPTP默认走这个PPPoE拨号上网,当PPTP账号断开后,对应的PPPoE拨号也同样断开。
On up脚本: :local pptpname :local pppoename :log info “user login and script start” :foreach i in=[/interface pptp-server find ] do={ :if ( [/interface pptp-server get $i running] = true ) do={ :set pptpname [/interface pptp-server get $i name] :log info “check $pptpname” :set pppoename [:pick $pptpname [find $pptpname “-“] [:len $pptpname]] :set pppoename (“pppoe” . $pppoename) :if ( [/interface pppoe-client get [find name=$pppoename] disable ] = true ) do={ /interface pppoe-client enable [ find name =$pppoename ] :log info “$pptpname online $pppoename dail-up” } } }
On down脚本: :local pptpname :local pppoename :log info “user logout and script start” :foreach i in=[/interface pptp-server find ] do={ :if ( [/interface pptp-server get $i running] = false ) do={ :set pptpname [/interface pptp-server get $i name] :log info “check $pptpname” :set pppoename [:pick $pptpname [find $pptpname “-“] [:len $pptpname]] :set pppoename (“pppoe” . $pppoename) :if ( [/interface pppoe-client get [find name=$pppoename] disable ] = false ) do={ /interface pppoe-client disable [ find name =$pppoename ] :log info “$pptpname offline $pppoename dail-down” } } }
这个脚本在ros 6.48上运行有问题,请会的帮忙改下,谢谢!!
|