Chinaunix首页 | 论坛 | 博客
  • 博客访问: 494103
  • 博文数量: 112
  • 博客积分: 10
  • 博客等级: 民兵
  • 技术积分: 662
  • 用 户 组: 普通用户
  • 注册时间: 2011-02-20 07:22
个人简介

一步一个脚印

文章分类

全部博文(112)

文章存档

2019年(2)

2017年(2)

2016年(2)

2015年(6)

2014年(35)

2013年(65)

分类: LINUX

2013-06-15 22:53:54

基本情况:用户有两条INTERNET线路,一条是使用中国电信光纤10M,另一条是使用中国电信4MADSL.使用IP伪装使一个有200个终端局域网共享 上网. RouteOS共有3块网卡,ether1用于ADSL,ether2用于光纤,ether3用于连接终端. 目的:实现负载平衡,并且在其中一条线路断?5?%8后自动切换为单线路,线路恢复后,继续使用负载平衡.

1、配置光纤线路 在/ip address中为光纤线路配置IP地址,子网掩码. 

CODE 
/ip address add address 61.139.77.77 mask 24 interface ether2 

2、配置ADSL线路 

CODE 
/interface pppoe-client 

配置ADSL拨号信息. 

CODE 
/interface pppoe-client add name pppoe-line1 service CHN-telecom/ user mailtrh999@169rh999   password kkjjh interface ether1 use-peer-dns yes mtu 1942 mru 1942 

3、配置IP伪装 

CODE 
/ip firewall src-nat add action masquerade     
/ip firewall mangle add protocol tcp tcp-options syn-only tcp-mss 1448 

4、配置路由 

CODE 
/ip route add dst 0.0.0.0/0 gat 219.159.78.65,222.217.117.118 (注:61.139.77.1为光纤的网关,218.88.32.1则为ADSL的网关)     
/ip route add dst 61.139.88.105/32 get 218.88.32.1(注:如果ADSL连通后PING不通网关的话,才加这条,如果PING得通则不须要.) 

5、配置自动切换脚本 


CODE 
/system script add source="/in pppoe-client dis [/in pppoe-client find name pppoe-lin owner="admin" policy=reboot,read,write,policy,test     
/system script add source="/ip route set[/ip route find dst 0.0.0.0] gateway 219.159.78.65,222.217.117.118" owner="admin" policy=reboot,read,write,policy,test     
/system script add source="/ip route set[/ip route find dst 0.0.0.0] gateway 222.217.117.118 owner="admin" policy=reboot,read,write,policy,test     
/system script add source="/ip route set[/ip route find dst 0.0.0.0] gateway 219.159.78.65,222.217.117.118" owner="admin" policy=reboot,read,write,policy,test 

6、配置NETWATCH用于监视网络的通断情况. 

CODE 
/tool netwatch add host=222.217.117.118 timeout=1s interval=5s up-script=upadsl down-script=downadsl (注:61.157.88.105是监视ADSL是否通的IP,也可以是ADSL的网关.)   
/tool netwatch add host=219.159.78.65 timeout=1s interval=5s up-script=upf down-script=downf 
阅读(1269) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~