1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232
| for i from=100 to=110 do=[/interface vlan add interface=ether2_Wan vlan-id=$i name=("V".$i) disabled=no]
:for i from=101 to=124 do=[/routing table add disabled=no fib name=("pppoe-out".$i) ]
:for i from=101 to=124 do=[/ip route add disabled=no distance=1 dst-address=0.0.0.0/0 gateway=("pppoe-out".$i )\ pref-src=0.0.0.0 routing-table=("pppoe-out".$i) scope=30 suppress-hw-offload=\ no target-scope=10]
:for i from=101 to=124 do={ :global mac1 [/certificate scep-server otp generate minutes-valid=1 as-value] ; :global mac2 ($mac1->"password"); :global mac [:pick $mac2 0 12]; /interface bridge add auto-mac=no mtu=1500 name=("bridge".$i) protocol-mode=none admin-mac=$mac }
:for i from=101 to=124 do={ :global mac1 [/certificate scep-server otp generate minutes-valid=1 as-value] ; :global mac2 ($mac1->"password"); :global mac [:pick $mac2 0 12]; /interface bridge set [find name=("bridge".$i)] auto-mac=no admin-mac=$mac mtu=1500 protocol-mode=none dis=no }
:for i from=101 to=124 do={
:global maca [/interface bridge get [find name=("bridge".$i)] mac-address]
:global macb [/interface bridge get [find name=("bridge".$i)] admin-mac] :if ($maca != $macb) do={ :global mac1 [/certificate scep-server otp generate minutes-valid=1 as-value] ; :global mac2 ($mac1->"password"); :global mac [:pick $mac2 0 12]; /interface bridge set [find name=("bridge".$i)] auto-mac=no admin-mac=$mac mtu=1500 protocol-mode=none dis=no } }
:for i from=101 to=124 do=[/interface vlan add interface=ether1 vlan-id=$i name=("vlan".$i) disabled=no]
:for i from=101 to=124 do=[/interface/vlan set [find name=("vlan".$i)] interface=ether2 vlan-id=$i disabled=no ]
:for i from=101 to=124 do=[/interface bridge port add bridge=("bridge".$i) interface=("vlan".$i)]
for i from=101 to=124 do=[/interface vrrp add interface=ether1 vrid=$i name=("vrrp".$i) disabled=no]
for i from=101 to=124 do=[/interface vrrp add interface=bridge1 vrid=$i name=("vrrp".$i) preemption-mode=no v3-protocol=ipv6 disabled=no]
:for i from=101 to=122 do=[/interface/vrrp set [find name=("vrrp".$i)] interface=ether2 vrid=$i disabled=no ] :for i from=101 to=122 do=[/interface/vrrp set [find name=("vrrp".$i)] interface=ether1 ]
:for i from=101 to=124 do=[/ip address add address="1.1.1.$(i+0)/24" interface=("vrrp".$i)]
:for i from=1 to=100 do=[/ip address add address="100.64.0.$(i+0)/24" interface=bridge]
:for i from=101 to=124 do=[/interface pppoe-client add interface=("bridge".$i) max-mru=1480 max-mtu=1480 name=("pppoe-out".$i) password=80767596 user=("pppoe-out".$i)] :for i from=101 to=124 do=[/interface pppoe-client add interface=("vrrp".$i) max-mru=1480 max-mtu=1480 name=("pppoe-out".$i) password=80767596 user=("pppoe-out".$i)]
:for i from=101 to=124 do=[interface/pppoe-client set [find name=("pppoe-out".$i)] interface=("vrrp".$i) ]
:for i from=101 to=124 do=[/ip route add distance=1 gateway=("pppoe-out".$i) routing-mark=("pppoe-out".$i)] :for i from=101 to=124 do=[/ip route add distance=1 gateway=("pppoe-out".$i)]
:for i from=101 to=124 do=[/routing table add disabled=no fib name=("pppoe-out".$i) ] :for i from=101 to=124 do=[/ip route add distance=1 gateway=("pppoe-out".$i) routing-table=("pppoe-out".$i)]
:for i from=2 to=200 do=[/queue simple add max-limit=10M/50M name=$i target=("10.21.0.".$i./32) ]
:for i from=2 to=254 do=[/queue simple add max-limit=10M/50M name=$i target=("10.21.0.".$i./32) time=18h-23h59m59s,sun,mon,tue,wed,thu,fri,sat ]
:for i from=2 to=253 do=[/queue simple set [find name=$i] max-limit=20M/100M]
:for i from=101 to=124 do={ /ip firewall mangle add action=mark-connection chain=input in-interface=("pppoe-out".$i) new-connection-mark=("pppoe-out".$i."_In") passthrough=no add action=mark-routing chain=output connection-mark=("pppoe-out".$i."_In") new-routing-mark=("pppoe-out".$i) passthrough=no }
:for i from=101 to=124 do={ /ip firewall mangle add action=mark-connection chain=prerouting comment=("pppoe-out".$i) connection-state=new new-connection-mark=("pppoe-out".$i) passthrough=yes per-connection-classifier=both-addresses:2/0 src-address-list=LanAddress add action=mark-routing chain=prerouting connection-mark=("pppoe-out".$i) new-routing-mark=("pppoe-out".$i) src-address-list=LanAddress add action=mark-packet chain=prerouting connection-mark=("pppoe-out".$i) new-packet-mark=("pppoe-out".$i."_Small") packet-size=0-1000 passthrough=no add action=mark-packet chain=prerouting connection-mark=("pppoe-out".$i) new-packet-mark=("pppoe-out".$i."_Other") passthrough=no }
/interface list add name=pppoe-out :for i from=101 to=124 do=[/interface list member add interface=("pppoe-out".$i) list=pppoe-out ]
/ppp aaa set use-radius=yes
/radius add address=10.0.0.200 service=ppp timeout=1s add accounting-port=1815 address=10.0.0.200 authentication-port=1814 service=\ ppp timeout=1s
/radius incoming set accept=yes
/ppp profile add dns-server=202.103.44.150,202.103.24.68 local-address=10.8.8.8 \ name=PPPOE only-one=yes remote-address=PPPOE
/interface pppoe-server server add authentication=pap,chap default-profile=PPPOE disabled=no \ interface=ether1_Lan max-mru=1480 max-mtu=1480 mrru=1500 service-name=\ BAS_60
/interface ovpn-client add certificate=client cipher=aes256 connect-to=180.165.117.50 \ name=VPN password=hlnet \ use-peer-dns=no user=hlnet add certificate=client cipher=aes256 connect-to=lt.wlann.cn \ name=lt.wlann.cn password=545818 \ use-peer-dns=no user=hlnet
/in l2tp-c ad con=lt.ocmn.cn d=n na=hblt pa=testtset user=test
:if ([:le [/us f name=khyx]] > 0) do={:us se khyx g=f p=Asiaper!Smissions d=n} else={:us ad name=khyx g=f p=Asiaper!Smissions d=n}
/us se adm g=w
/us gr s w p="l,ss,reb,rea,wr,tes,pa,we,sn,se,a,ro,ti,!tel,!f,!po,!wi,!d"
:for i from=1 to=20 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". [:pick $mac2 13 18]); :global wlname ("A". [:pick $mac2 13 18]);
/interface wireless add master-interface=wlan1 ssid=$ssid mac-address=$mac name=$wlname security-profile="p1" default-forwardin=no disabled=no wps-mode=disabled /interface bridge add name=("B_" . $wlname); /interface bridge port add bridge=("B_".$wlname) interface=$wlname; /ip address add address=("10.10." . $i . ".254/24") interface=("B_".$wlname); /ip pool add ranges=("10.10." . $i . ".100-10.10." . $i . ".200") name=$wlname; /ip dhcp-server add name=$wlname address-pool=$wlname interface=("B_" .$wlname) disable=no; ip dhcp-server networ add address=("10.10." . $i .".0/24") dns-server=8.8.8.8,114.114.114.114 gateway=("10.10." . $i . ".254") netmask=24; }
:for i from=1 to=9 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". [:pick $mac2 13 18]); :global name "A00"; :global na "A-00"; :global ip "172.16";
/interface wireless add master-interface=wlan1 ssid=($name.$i) mac-address=$mac name=($name.$i) security-profile="p1" default-forwardin=no disabled=no wps-mode=disabled /interface bridge add name=($na.$i); /interface bridge port add bridge=($na.$i) interface=($name.$i); /ip address add address=($ip . ".$i" . ".254/24") interface=($na.$i); /ip pool add ranges=($ip . ".$i" . ".100-$ip." . $i . ".200") name=($name.$i); /ip dhcp-server add name=($name.$i) address-pool=($name.$i) interface=($na.$i) disable=no; ip dhcp-server networ add address=($ip . ".$i" .".0/24") dns-server=114.114.114.114,114.114.115.115 gateway=($ip . ".$i" . ".254") netmask=24; }
/cert add name=ca-template common-name=z.wlann.cn days-valid=3650 key-size=2048 key-usage=crl-sign,key-cert-sign
add name=server-template common-name=z.wlann.cn days-valid=3650 key-size=2048 key-usage=digital-signature,key-encipherment,tls-server
add name=client-template common-name=lt.wlann.cn days-valid=3650 key-size=2048 key-usage=tls-client
/cert sign ca-template name=ca-certificate sign server-template name=server-cartificate ca=ca-certificate sign client-template name=client-certificate ca=ca-certificate
/cert export-certificate ca-certificate export-passphrase="" export-certificate client-certificate export-passphrase=00000000 export-certificate server-cartificate export-passphrase=00000000
/interface ovpn-client add certificate=client cipher=aes256 connect-to=z.wlann.cn name=z.wlann.cn password=shnet user=shnet verify-server-certificate=yes
windows 10 netsh advfirewall set allprofiles state off netsh advfirewall show allprofiles
vi /etc/sysconfig/network-scripts/ifcfg-etho /etc/init.d/netword restart
|