当前位置:网站首页>The correct way to set the bypass route
The correct way to set the bypass route
2022-07-01 21:56:00 【Full stack programmer webmaster】
Hello everyone , I meet you again , I'm your friend, Quan Jun .
Recently, I'm playing side route , Stepped on some pits , I also learned some related knowledge , Specially arrange and record .
One 、 Configuration of side route
The above figure shows the connection mode of side route , Generally, there is only one side route LAN mouth , Think of it as an ordinary computer connected to a router . Let them ip In one network segment , For example, the main routing gateway 192.168.3.1, The side route is configured as 192.168.3.2
1. Primary route configuration :DHCP In the configuration, the gateway and DNS Change to side route ip Address , Such as 192.168.3.2.
2. Side route configuration : close DHCP, Change the gateway to the main routing address , Such as 192.168.3.1, Turn off bridging mode , What other subnet masks , Don't say the broadcast address .
explain : Others turn off the main route dhcp, Turn on the side route dhcp, Personally, this practice is not recommended , although dhcp Just one. ip distributor , The difference is only who distributes ip The problem of , But we use side routing , I want to minimize the impact on the main route . After the above configuration , After the bypass route is removed or there is a problem with the bypass route , Just change the main route dhcp gateway , Just restart , Very convenient .
After this configuration , The network traffic is shown in the figure below :
Scientific flow is processed , Will be carried out in nat, In this way, both uplink and downlink will follow the bypass route for encryption and decryption .
Ordinary traffic is just forwarded by the upstream route ,ip Will not change ; When going down, the main route is found ip Bag is a computer , Will send it directly .
It is perfect to deal with it in this way , Side route only encrypts and decrypts scientific traffic , But some routers are configured like this , Domestic traffic is not available online , Only foreign ones are ok , You must configure a firewall rule .
iptables -t nat -I POSTROUTING -j MASQUERADEWhy is that ?
Huawei usually has problems , millet ,360 Wait for the main router ( I found that they all have a common feature - Can't configure dhcp gateway ), The essential reason is , These routers will verify packets ip and mac Correspondence of address . When the uplink of domestic packets is forwarded to the main route through the side route , The primary route finds packets sent by the secondary route ip Not its own , Check failed , So the road of ordinary traffic in the figure is blocked .
Then add firewall rules. Why is it ok , The above rule means to execute SNAT function , The source of the packet ip Change to the current machine , That is, by-pass ip, But also dynamic change ( Prevent side routing ip It's dynamic ?). After this configuration , The network traffic becomes the following figure :
In this way, the bypass router is actually a secondary router without routing function , You will find that when you are downloading at a high speed, such as Xunlei, there is a side route cpu Will be abnormally high , All for nat 了 , Not the purpose of the original bypass – Only encrypt and decrypt scientific traffic .
Another setting method is not to add firewall rules , Add one to the side route wan mouth , Share one etho so , In this way, I understand that it is actually single arm routing ? In fact, it's similar to the above .
It's easy to check whether the correct method is set
1. Watch it when Xunlei waits for high-speed download cpu Is the occupation very high
2. A more reliable one , Look at the upstream and downstream traffic , If configured correctly , The uplink of the side route is greater than the downlink , If the top and bottom are the same and the data flow is large ( It is obvious when downloading at high speed ), There is a problem with the configuration .
This is the download speed :
Correctly configured uplink and downlink speeds and cpu Occupy :
Misconfigured uplink and downlink speeds and cpu Occupy :
3. The most reliable thing is to go to the main route to see the information of networked devices , You will find the device ip It's computer. , however mac The address is soft routed
Of course , If the main route used is Huawei 、 millet 、360 etc. , There's no way , You can only add firewall rules or wan mouth , use nat The way to avoid its inspection ( In this way, it is better to make secondary routing time-saving and worry saving ), Or change the main router .
Publisher : Full stack programmer stack length , Reprint please indicate the source :https://javaforall.cn/130484.html Link to the original text :https://javaforall.cn
边栏推荐
- Using closures to switch toggle by clicking a button
- 考虑关系的图卷积神经网络R-GCN的一些理解以及DGL官方代码的一些讲解
- Tops, the unit of computing power of the processor, can be carried out 1 trillion times per second
- locust 系列入门
- MySQL series transaction log redo log learning notes
- 名单揭晓 | 2021年度中国杰出知识产权服务团队
- Pytest collection (2) - pytest operation mode
- 打出三位数的所有水仙花数「建议收藏」
- leetcode刷题:栈与队列01(用栈实现队列)
- Application of real estate management based on 3D GIS
猜你喜欢
随机推荐
[NOIP2013]积木大赛 [NOIP2018]道路铺设 贪心/差分
想请教一下,券商选哪个比较好尼?本人小白不懂,现在网上开户安全么?
“丝路正青春 风采看福建”在闽外籍青年短视频大赛火热征集作品中
require与import的区别和使用
运放-滞回(迟滞)比较器全流程实战计算
pytest合集(2)— pytest運行方式
Significance and measures of security encryption of industrial control equipment
leetcode刷题:二叉树02(二叉树的中序遍历)
GCC编译
【opencv】train&test HOG+SVM
业务可视化-让你的流程图'Run'起来
leetcode刷题:二叉树03(二叉树的后序遍历)
Pytest Collection (2) - mode de fonctionnement pytest
十三届蓝桥杯B组国赛
选择在同花顺上炒股开户可以吗?安全吗?
EMC-电路保护器件-防浪涌及冲击电流用
leetcode刷题:栈与队列04(删除字符串中的所有相邻重复项)
Internet of things RFID, etc
Go — 相关依赖对应的exe
Kuberntes云原生实战一 高可用部署架构









