找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 9506|回复: 0

[脚本] 热点的多VLAN,桥,DHCP服务器,子网划分

[复制链接]
发表于 2015-9-7 22:09:43 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册

×
本帖最后由 jike106397 于 2015-9-7 22:50 编辑
  1. :local cadd 10.4.0.0
  2. :local cdns 8.8.8.8
  3. :local cname
  4. :local ss 192.168.168.8/24
  5. :local vfrom 2021
  6. :local vto 3000
  7. :local j 0.0.0.0
  8. /system identi set name=2.2.2.2
  9. /ip address add interface=ether3 address=$ss
  10. /ip route add gateway=192.168.168.1
  11. /ip dns set server=$cdns
  12. /interface bridge add name=bridge-hotspot
  13. /interface bridge port add bridge=bridge-hotspot interface=ether1
  14. /interface bridge port add bridge=bridge-hotspot interface=ether2
  15. /interface bridge port add bridge=bridge-hotspot interface=ether5
  16. /ip firewall address-list add list=dshoublist address=($cadd . "/16")
  17. /ip firewall mangle add chain=prerouting src-address-list=dshoublist action=sniff-tzsp  sniff-target=9.9.9.9 sniff-target-port=37008
  18. /ip firewall nat add chain=srcnat action=masq src-address-list=dshoublist


  19. :for i from=$vfrom to=$vto do={
  20. :set $j (((($cadd>>5)+$i-$vfrom)<<5)+1)
  21. /interface vlan add interface=bridge-hotspot vlan-id=$i name=("vlan-" . $i)
  22. /interface bridge add name=("bridge-" . $i)
  23. /interface bridge port add bridge=("bridge-" . $i) interface=("vlan-" . $i)


  24. /ip address add interface=("bridge-" . $i) address=($j . "/27")
  25. /ip pool  add name=("pool-" . $i) ranges=(($j+1) . "-" . ($j+29))
  26. /ip dhcp-server network add gateway=$j address=(($j-1) . "/27") dns-server=8.8.8.8
  27. /ip dhcp-server add name=("dhcp-server-" . $i) interface=("bridge-" . $i) address-pool=("pool-" . $i)


  28. /ip hotspot profile add copy-from=0 hotspot-address=$j name=("hotspot-profile-" . $i) use-radius=yes
  29. /ip hotspot add name=("hotspot-server-" . $i) interface=("bridge-" . $i) address-pool=("pool-" . $i) profile=("hotspot-profile-" . $i) disabled=no

  30. }
复制代码
原文:http://blog.dshoub.com/?id=17
routeros
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|手机版|小黑屋|软路由 ( 渝ICP备15001194号-1|渝公网安备 50011602500124号 )

GMT+8, 2024-5-6 16:54 , Processed in 0.077244 second(s), 4 queries , Gzip On, Redis On.

Powered by Discuz! X3.5 Licensed

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表