找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 69535|回复: 212

[vpn] 讨论下热议中的 光纤(vpn)走上行 ADSL走下行

  [复制链接]
发表于 2010-9-18 01:17:53 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 zooyo 于 2011-2-9 20:22 编辑

看大坛友讨论比较激烈。还有哥们吵了起来,真是伤和气。
先发规则,脚本。

/ip firewall mangle
add action=jump chain=prerouting comment=adsl_bonding disabled=no dst-port=80,81,82,8080 jump-target=bonding protocol=tcp src-address=192.168.0.0/16
add action=jump chain=prerouting comment="" disabled=no jump-target=bonding src-address-list=other_list
add action=mark-connection chain=bonding comment="" disabled=no dst-address-type=!local in-interface=LAN new-connection-mark=adsl1conn passthrough=yes per-connection-classifier=both-addresses:3/0
add action=mark-routing chain=bonding comment="" connection-mark=adsl1conn disabled=no in-interface=LAN new-routing-mark=main passthrough=yes
add action=mark-connection chain=bonding comment="" disabled=no dst-address-type=!local in-interface=LAN new-connection-mark=adsl2conn passthrough=yes per-connection-classifier=both-addresses:3/1
add action=mark-routing chain=bonding comment="" connection-mark=adsl2conn disabled=no in-interface=LAN new-routing-mark=main passthrough=yes
add action=mark-connection chain=bonding comment="" disabled=no dst-address-type=!local in-interface=LAN new-connection-mark=adsl3conn passthrough=yes per-connection-classifier=both-addresses:3/2
add action=mark-routing chain=bonding comment="" connection-mark=adsl3conn disabled=no in-interface=LAN new-routing-mark=main passthrough=yes

要让哪走上行就new-routing-mark=main 到哪,当然vpn也行。按常规方式添加VPN网关(vpn服务器是要未做NAT伪装的)。

/ip firewall nat
add action=src-nat chain=srcnat comment=ADSL1 connection-mark=adsl1conn disabled=yes src-address=192.168.0.0/16 to-addresses=121.69.45.22
add action=src-nat chain=srcnat comment=ADSL2 connection-mark=adsl2conn disabled=yes src-address=192.168.0.0/16 to-addresses=121.71.114.11
add action=src-nat chain=srcnat comment=ADSL3 connection-mark=adsl3conn disabled=yes src-address=192.168.0.0/16 to-addresses=121.69.47.21
add action=src-nat chain=srcnat comment="" disabled=yes src-address=192.168.0.0/16 to-addresses=221.219.144.111

虽然mark-routing 到了指定的线路,但src-nat 伪装到了ADSL线路IP,回来的数据(下载)就通过ADSL返回了,连接正常建立,当然也就不会断线。

:local curaddress
:local newaddress
:local status
:local x
:set x 3
:for i from=1 to=$x do={
    :set status [/interface get [/interface find  name=("pppoe-out" . $i)] running]
    :if ($status=true) do={
    :set newaddress [/ip address get [/ip address find dynamic=yes interface=("pppoe-out" . $i)] address ]
    :set newaddress [:pick $newaddress 0 [:find $newaddress "/"]]
    :set curaddress [ /ip firewall nat get [/ip firewall nat find comment=("ADSL" . $i)] to-addresses ]
    :if ($curaddress != $newaddress) do={
       /ip firewall nat set [ /ip firewall nat find comment=("ADSL" . $i) ] to-addresses=$newaddress
       :log info ("Change ADSL" . $i . " NAT IP" )
         }
     }
}

自动修改 NAT ip脚本 注意 comment=ADSL1  这样的格式。

不是所有运营商都会不检测源地址是否合法,具体能否这样成功应用,自己测。

routeros
发表于 2010-9-18 01:21:20 | 显示全部楼层
深圳的目前可以,不过我的做法跟你的不同,看看有十么区别
routeros
回复

使用道具 举报

发表于 2010-9-18 02:50:53 | 显示全部楼层
感谢楼主.依葫芦已经画出瓢了.对楼主今天的2贴技术和金钱含量给予无尚的敬意.
routeros
回复

使用道具 举报

发表于 2010-9-18 06:46:52 | 显示全部楼层
感谢楼主.依葫芦已经画出瓢了.对楼主今天的2贴技术和金钱含量给予无尚的敬意
routeros
回复

使用道具 举报

发表于 2010-9-18 07:29:05 | 显示全部楼层
恩,不错,非常有技术含量
routeros
回复

使用道具 举报

发表于 2010-9-18 08:59:45 | 显示全部楼层
学习了 谢谢!!
routeros
回复

使用道具 举报

发表于 2010-9-18 09:38:39 | 显示全部楼层
看了40多人 结果回帖只有几个人 到底是 不需要呢 还是 就没有回帖的精神呢?纳闷ing。。。。。。。。。。。。
routeros
回复

使用道具 举报

发表于 2010-9-18 11:09:53 | 显示全部楼层
40多人都是观望,因为这些人都没有搞懂!
routeros
回复

使用道具 举报

发表于 2010-9-18 11:45:35 | 显示全部楼层
这功能实用,多谢楼主分享
routeros
回复

使用道具 举报

发表于 2010-9-18 12:09:46 | 显示全部楼层
感谢楼主,虽然还没有看明白
routeros
回复

使用道具 举报

发表于 2010-9-18 12:26:36 | 显示全部楼层
就是src-nat吧
routeros
回复

使用道具 举报

发表于 2010-9-18 12:53:00 | 显示全部楼层
技术贴 支持楼主
routeros
回复

使用道具 举报

发表于 2010-9-18 17:04:55 | 显示全部楼层
总算看到了有技术含量的!
routeros
回复

使用道具 举报

 楼主| 发表于 2010-9-18 17:44:22 | 显示全部楼层
根本就没啥技术含量,而且还是个很过时的技术,仅仅是个思路问题。

加了个回复可见,想看的就回吧。
routeros
回复

使用道具 举报

发表于 2010-9-18 18:38:16 | 显示全部楼层
看看了哦呵呵。
routeros
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-5-18 12:35 , Processed in 0.162828 second(s), 4 queries , Gzip On, Redis On.

Powered by Discuz! X3.5 Licensed

© 2001-2023 Discuz! Team.

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