fivesheep/chnroutes

在mikrotik的ROS路由器上,我觉得做成Access-list比做成路由表更有效率

stevemorrisLian opened this issue · 0 comments

因为权限access-list还可以有优先级设置,放入NAT更加灵活
rsc是RouterOS的脚本文件,可以导入后在路由器上运行

以下是我做的修改
def generate_ros(metric):
results = fetch_ip_data()
rfile=open('routes.rsc','w')
for ip,datenum,mask2 in results:
route_item="add list=domesticList address=%s/%s \t %s \n"%(ip,mask2,datenum)
rfile.write(route_item)
rfile.close()
print "Usage: Append the content of the newly created routes.txt to your openvpn config file,"
" and also add 'max-routes %d', which takes a line, to the head of the file." % (len(results)+20)

在fetch_ip_data,不过这个无关紧要,就是个日期,作为路由表的注释,自行时候可以ignore

datenum=unit_items[5]