最后更新:2022-07-20 18:41:12 手机定位技术交流文章
在同一设备上运行不同的IP流量在不同的运营商网络上的影响
首先, 让我们谈谈家庭网络访问.淀电讯是全国最昂贵的(而且可能没有)宽带运营商
运营商
,如果这只是一个月的169个宽带融合方案,那么我可能认出来,可是我住的那所房子要求我提供电讯,并让我按照商业建筑进行计算,至少有399个月宽带服务,那我就谢谢你吧,我不能等你了,电讯先生。
另外两家,
联通
说没有资源,根本没有选择。就办移动好了。移动宽带300/60Mbps(FTTH接入,它已经升级为100MB,然而,经过多次评估,发现300M的带宽可以下降到400M-450M。已经完全够用),后来, 海鲜市场出现了100 / 30 Mbps ( 同轴电缆 ) 连接, 并与当地运营商的租用电视机结合起来.可以提供一个虚拟固定的外部网络IP。两个带宽的每月费用不到80元人民币(包括手机号码)。
这样一来,如何将两个宽带网络集成到家庭网络是一个问题.体验了Unifi Security Gateway(GUI配置自由度太低,在配置文件配置和持久性问题之后)和RouterOS(不适合您自己的思维风格),最后,我发现 EdgeOS系列相对适合我的使用。这里就记录一下。
移动宽带是纤维接口,更换猫杖也感觉很好。直接插在 EdgeRouter-8-Pro 的 sfp 口设置 Vlan 41 (移动的设置是41)以后就可以直接 PPPoE 拨号上网了,珠江宽带线(以下简称连接线)是由于老宽带网络,当您登录时只提供轴线需要由轴猫转换为RJ45接口,但是,门前走廊里有一个小墙,你可以把同轴猫放在那里,然后,通过电线进入机器室 交换机 上 Vlan 119 Tagged (至于为什么是接到交换机,后面说吧)。
先理一下各个网段
Vlan41移动PPoE拨号上网
Vlan119连接DHCP获取公共IP
Vlan88家庭主机网络
让我们谈谈一般的想法:移动宽带没有公开IPv4,但是,这里有一个完美的IPv6/60地址段,v6网络的扩散,它也被用作主要的网络;连接的带宽几乎是固定的(如果你不重新启用相同的轴猫,它不会改变,即使IPv4公共网络地址仅在IPv4/29地址节中更改,但因为是同轴传输,流感的症状可能有未知原因,例如 ping值的上升,主要用作 IPv6 故障或无 IPv6 环境时 fallback 的回家链路和移动网络抽风时的 failover fallback。
以下设置从零开始的流量帐户:
因为大多数人从一开始就找不到两个宽带连接,但根本无法上网,因此,我开始时的默认是:猫条已经配置了LOID和密码认证,如果 vlan 和 ppoe 设置好, 你可以直接拨入互联网.如果你想了解如何配置LOID和密码认证,还有太多的教训给其他大家伙。
柜台连接图,从上到下分别是 Patch Panel 、 PoE 开关、路由器
接线图如上
路由器
到交换机之间使用两根1G链路通过LACP做Bond相连,又由于使用了vlan,首先要在EdgeRouter上给eth1和eth2创建新的Bond
configure
set interfaces bonding bond0 mode 802.3ad
set interfaces ethernet eth1 bond-group bond0
set interfaces ethernet eth2 bond-group bond0
然后为家庭主机网络和连接网络在0键下配置vlan并添加地址
set interfaces bonding bond0 vif 88 address 192.168.88.1/24
set interfaces bonding bond0 vif 119 address dhcp
添加移动的ppoe拨号(猫条附着牙齿6),保存上面的设置
set interfaces ethernet eth6 vif 41 pppoe 0 user-id 1xxxxxxxxxx@139.gd
set interfaces ethernet eth6 vif 41 pppoe 0 password xxxxxx
commit
save
exit
然后开始ppoe0
connect intreface pppoe0
移动纤维从门上接收到 Patch Panel 16 个端口,然后从路由器齿的 sfp 端口接收到猫条。
联通的同轴线在门口的壁龛通过同轴猫转成rj45口网线后接入一个PoE供电的EdgerouterX(因为只预留了一根网线去门口然而现在发现设备越来越多,没有额外的电源供应,因此我不得不带出ERX来做PoE开关。为什么要用ERX?因为ERX有PoE Passthru,在Eth0電源後,Et4也可以用於運載PoE裝置。。比如一个AP。.一切都倒退了,我会有机会再说一遍,然后我敲了vlan119标签,连接到 Patch Panel 11 端口,并连接到开关,整个过程,TRUNK返回路由器并接收了0.119的绑定,然后它通过路由器的 DHCP 到达公共网络地址。
(如果你能看懂我这一段在说什么的话那应该能领略到,vlan这么用真是。。妙啊。。。
毫不奇怪,您现在可以在路由器 dashboard中看到ppoe0已经连接到内部网络地址, bond0.119也已经访问到公共网络地址。
下面开始了双线负载平衡的核心部分
因为两条线路的带宽比例大概是4:1,在loadbalance下建立一个名叫G的lb组,然后分配各条线路的比重。
configure
set load-balance group G interface pppoe0 weight 40
set load-balance group G interface bond0.119 weight 10
因为在我这里主要是运用移动线路,联通线路就设置成failover only
set load-balance group G interface bond0.119 failover-only
接下来是一系列的firewall设置,对哪些流量怎么走做一个规定
首先,分别创建两个路由表
CM-fallback对于移动线路和不连接时的连接失败是优先的(1x.x.x.x是为dhcp获取的连接外部网关的地址,如下)
set protocols static table 12 description CM-fallback
set protocols static table 12 interface-route 0.0.0.0/0 next-hop-interface pppoe0 distance 10
set protocols static table 12 route 0.0.0.0/0 next-hop 1x.x.x.x distance 100
13:CU-fallback 优先走联通线路,不通时fallback到移动
set protocols static table 13 description CU-fallback
set protocols static table 13 interface-route 0.0.0.0/0 next-hop-interface pppoe0 distance 100
set protocols static table 13 route 0.0.0.0/0 next-hop 1x.x.x.x distance 10
添加防火墙规则,
定义一个modify组叫做balance
将添加到NULL地址组的IP切断
set firewall group address-group NULL
set firewall modify balance rule 1 description NULL
set firewall modify balance rule 1 action drop
set firewall modify balance rule 1 source group address-group NULL
非互联网流量分离
set firewall modify balance rule 10 description do NOT load balance lan to lan
set firewall modify balance rule 10 action modify
set firewall modify balance rule 10 destination group network-group PRIVATE_NETS
set firewall modify balance rule 10 modify table main
特定源IP的优先路由网络
set firewall group address-group CU-SRC-IP
set firewall modify balance rule 30 description SRC-IP-via-CU-fallback
set firewall modify balance rule 30 action modify
set firewall modify balance rule 30 source group address-group CU-SRC-IP
set firewall modify balance rule 30 modify table 13
特定源IP优先的移动网络
set firewall group address-group CM-SRC-IP
set firewall modify balance rule 25 description SRC-IP-via-CM-fallback
set firewall modify balance rule 25 action modify
set firewall modify balance rule 25 source group address-group CM-SRC-IP
set firewall modify balance rule 25 modify table 12
非分配地址是外部网络IP的流量。
set firewall modify balance rule 70 description do NOT load balancec CU destination public address
set firewall modify balance rule 70 action modify
set firewall modify balance rule 70 destination group address-group ADDRv4_bond0.119
set firewall modify balance rule 70 modify table main
非分割移动ppoeIP流量的目的地地址
set firewall modify balance rule 80 description do NOT load balance CM destination public address
set firewall modify balance rule 80 action modify
set firewall modify balance rule 80 destination group address-group ADDRv4_pppoe0
set firewall modify balance rule 80 modify table main
分流其他所有
set firewall modify balance rule 110 description Load-Balance else
set firewall modify balance rule 110 action modify
set firewall modify balance rule 110 modify lb-group G
当然因为我已经做了failover-only的设置,上述分离的实际效果主要是与连接线相关设置的分离。但是谁知道呢,万一有天心血来潮取消了failover-only就会有用了。当然,上述的规则只是一些相对必要的,还有其他需要,可以根据它们的情况增加。
最重要的步骤是将平衡组应用于内部网络,需要分配。如果你不这样做,它就不再工作了
set interface bonding bond0 vif 88 firewall In modify balance
commit
save
exit
这样,再把192.168.88.12加到CM-SRC-IP组,把192.168.88.13加到CU-SRC-IP组,就可以 得到 一开始的那张图片的效果了。
通过smokeping设置不同的probe也就可以实现在一个slave上进行两条线路的监控了~
大家学废了吗
我反正是写累了
下次见
有缘的话
作者声明,本文无关紧要,欢迎有价值朋友的理性交流和和谐讨论
本文由 在线网速测试 整理编辑,转载请注明出处 。