网吧VIP官方网站

    官方信息
    网站首页 > 牛逼信息 > 使用教程

    ros需求创建10个ssid,走10根pptp线路,同时更换mac

    2020-08-09 10:21:49 网吧VIP官方网站 阅读

    一个ros需求创建10个ssid,走10根pptp线路,同时更换mac

    红色的部分,是你要创建10个ssid的编号。从1到10一共10个。顺序不能变。

    foreach y in={[/interface wireless find where interface-type=virtual]} do={/interface wireless remove $y};

    foreach y in={[/ip address find address ~ "172.16"]} do={/ip address remove $y};
    foreach y in={[/ip pool find ranges ~ "172.16"]} do={/ip pool remove $y};
    foreach y in={[/ip dhcp-server find name ~ "A"]} do={/ip dhcp-server remove $y};
    foreach y in={[/ip dhcp-server network find address ~ "172.16"]} do={/ip dhcp-server network remove $y};
    foreach y in={[/certificate scep-server otp find]} do={/certificate scep-server otp remove $y};

    :global oo [/ip firewall mangle find];
    :global cc [/ip firewall nat find];
    :global jj 0;

    :for i from=21 to=30 do={
    :global mac1 [/certificate scep-server otp generate minutes-valid=1 as-value] ;
    :global mac2 ($mac1->"password");
    :global mac [:pick $mac2 0 12];
    :global ssid ("A". $i);
    :global wlname ("A". $i);
    :log error ("正在创建ssid" . $ssid);

    /interface wireless add master-interface=wlan2 ssid=$ssid mac-address=$mac name=$wlname security-profile="profile1" default-forwarding=no disabled=no wps-mode=disabled;

    /ip address add address=("172.168." . $i . ".1/24" ) interface=$wlname;

    /ip pool add ranges=("172.168." .$i .".100-172.168.". $i.".200") name=$wlname;

    /ip dhcp-server add name=$wlname address-pool=$wlname interface=$wlname disa=no;

    /ip dhcp-server network add address=("172.168.". $i .".0/24") dns-server=114.114.114.114 gateway=("172.168." .$i. ".1") netmask=24;

    /ip firewall mangle set ($oo->$jj) src-address=("172.168.".$i.".0/24");

    /ip firewall nat set ($cc->$jj) src-address=("172.168.".$i.".0/24");

    set $jj ($jj+1);

    }

    今天发现一个问题,创建了10个虚拟SSID,小米手机都可以搜索到。但是华为或者一些其他品牌的就只能搜索到几个,原因是mac不能随意,必须用原有的无线网卡的mac来更改,就是华为等手机只能识别正确的真实存在的网络厂家的mac。

    foreach y in={[/interface wireless find where interface-type=virtual]} do={/interface wireless remove $y};
    foreach y in={[/ip address find address ~ "172.16"]} do={/ip address remove $y};
    foreach y in={[/ip pool find ranges ~ "172.16"]} do={/ip pool remove $y};
    foreach y in={[/ip dhcp-server find name ~ "A"]} do={/ip dhcp-server remove $y};
    foreach y in={[/ip dhcp-server network find address ~ "172.16"]} do={/ip dhcp-server network remove $y};

    :global oo [/ip firewall mangle find];
    :global cc [/ip firewall nat find];
    :global jj 0;

    :for i from=1 to=10 do={
    :global mac ([pick [/interface wireless get [/interface wireless find name=wlan1] mac-address ] 0 15] . [:pick $i ([:len $i] -2) [:len $i]]);
    :global ssid ("A". $i);
    :global wlname ("A". $i);
    :log error ("正在创建ssid" . $ssid);

    /interface wireless add master-interface=wlan2 ssid=$ssid mac-address=$mac name=$wlname security-profile="profile1" default-forwarding=no disabled=no wps-mode=disabled;

    /ip address add address=("172.168." . $i . ".1/24" ) interface=$wlname;

    /ip pool add ranges=("172.168." .$i .".100-172.168.". $i.".200") name=$wlname;

    /ip dhcp-server add name=$wlname address-pool=$wlname interface=$wlname disa=no;

    /ip dhcp-server network add address=("172.168.". $i .".0/24") dns-server=114.114.114.114 gateway=("172.168." .$i. ".1") netmask=24;

    /ip firewall mangle set ($oo->$jj) src-address=("172.168.".$i.".0/24");

    /ip firewall nat set ($cc->$jj) src-address=("172.168.".$i.".0/24");

    set $jj ($jj+1);

    /interface enable ("pptp" . $jj);

    :log error ("重新拨号pptp" . $jj ."完毕!")

    }


    Powered by MetInfo 5.3.19 ©2008-2020 www.wbvip.cn