今天學習到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