今天学习到ROS的PCC的新的一种场景,用PCC不是为了带宽叠加而是为了换IP,PCC的标准做法


之前有一个工作室的需求就是要求在一个浏览器窗口保持IP不变,新增一个窗口就变化IP。那就用src-address and port模式。

很多需求是为了换IP,但是并不想实现带宽叠加的场景。

 这种用src address and port比用both-address and port更好 
就比如你开游戏,开一个游戏,那么IP保持不变,再开 一个游戏IP才会变化。
关于TCP的源目地址,以及源目端口,可以通过管理员模式下用命令netstat -anbp tcp来查看,或者通过资源监视器来查看都可以
但是上述做法,访问网银会有问题,因为如果你IP老变化,银行的网银会出问题的。所以你用both address模式,可以避免这个问题。
简单来说,就是源IP就是本地不同的主机有不同的IP,源端口就是本地每个窗口每个进程都有不同的IP;目的IP以及目的端口,只是更加细化的变化IP,主要在源IP和源端口上。
 
PCC的标准做法

1、新建地址列表:/ip firewall address-list add add
address=192.168.120.0/24 list=LAN

2、从哪进从哪出(便于ROS对外发布服务,比如VPN等等)

add action=mark-connection chain=input comment=cnc-in connection-state=new \
in-interface=cnc-pppoe new-connection-mark=cnc-in passthrough=yes
add action=mark-routing chain=output comment=cnc-in-route connection-mark=\
cnc-in new-routing-mark=cnc-in-route passthrough=yes
add action=mark-connection chain=input comment=cnc2-in connection-state=new \
in-interface=cnc2-pppoe new-connection-mark=cnc2-in passthrough=yes
add action=mark-routing chain=output comment=cnc2-in-route connection-mark=\
cnc2-in new-routing-mark=cnc2-in-route passthrough=yes

3、mangle 标记:

/ip firewall mangle
add action=mark-connection chain=prerouting connection-mark=no-mark dst-address-type=!local new-connection-mark=C1 passthrough=yes per-connection-classifier=src-port:2/0 src-address-list=LAN
add action=mark-connection chain=prerouting connection-mark=no-mark dst-address-type=!local new-connection-mark=C2 passthrough=yes per-connection-classifier=src-port:2/1 src-address-list=LAN
add action=mark-routing chain=prerouting connection-mark=C1 new-routing-mark=R1 passthrough=yes src-address-list=LAN
add action=mark-routing chain=prerouting connection-mark=C2 new-routing-mark=R2 passthrough=yes src-address-list=LAN
4、路由策略:
/ip route
add distance=1 gateway=pppoe-out2 routing-mark=R1
add distance=1 gateway=pppoe-out3 routing-mark=R2
5、NAT 伪装
/ip firewall nat
add action=masquerade chain=srcnat src-address-list=LAN


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM