Distributions
Ubuntu
Fedora
CentOS
中文资源站
网易开源镜像站
cndns
V2EX  ›  Linux

Linux 可以实现这种功能吗

  •  
  •   cndns · Dec 28, 2023 · 3019 views
    This topic created in 946 days ago, the information mentioned may be changed or developed.

    在国内 IDC 租用一台电信联通双线路服务器 A 网卡 1.1.1.1 电信线路 B 网卡 2.2.2.2 联通线路 然后我搭建 VPN 网关 10.0.0.1/24 然后我拨上服务器的 VPN ,我打游戏 udp 数据让他走电信来回 我上网页的 443 80 想让他走联通线路来回 这种可以做到吗 策略路由和 iptables 是要怎么做?

    现在的情况是我和小伙伴们(家里都是安装电信宽带的)连上 VPN 的话。打网络游戏和上网页等所有的数据包都是走服务器电信那条默认路由 然后联通的线路带宽用不上

    6 replies    2023-12-29 10:34:07 +08:00
    pagxir
        1
    pagxir  
       Dec 29, 2023 via Android
    可以,根据端口策略路由。
    filtrate
        2
    filtrate  
       Dec 29, 2023 via iPhone
    你的需求用路由器更方便,比如 routeros
    hefish
        3
    hefish  
       Dec 29, 2023   ❤️ 1
    linux 路由有个文档,叫 LARTC ,搜一下仔细研习一下即可。
    lovelylain
        4
    lovelylain  
       Dec 29, 2023 via Android
    策略路由,ip route + ip rule 命令实现。openwrt 的话,建议用它自带的配置文件维护,自己写命令可能在网络重拨等情况下被重置不生效,它自带的不支持端口参数,可以用 iptables mangle 表打标记+按标记路由。
    yorks
        5
    yorks  
       Dec 29, 2023   ❤️ 2
    iptables -t mangle -A PREROUTING -s 10.0.0.1/24 -p tcp -m multiport --dports 80,443 -j MARK --set-mark 0xc8
    ip rule add fwmark 0xc8 lookup 200
    ip route add default dev $pppCNC table 200
    ttvast
        6
    ttvast  
       Dec 29, 2023
    稍微学习以下 ip rule/route 和 iptables 的语法,比那些整合过的第三方系统好用的多。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2686 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 32ms · UTC 15:17 · PVG 23:17 · LAX 08:17 · JFK 11:17
    ♥ Do have faith in what you're doing.