masir

Nintendo Switch 联网加速的一种姿势

  •  
  •   masir · Oct 14, 2019 · 15509 views
    This topic created in 2414 days ago, the information mentioned may be changed or developed.

    最近 switch 上有了狂野飙车,但是在酒店的网络死活连不上。刚好朋友的 switch 想用舞力全开 unlimited 也不行,就天天试着各种方法。

    开始就想着花钱用各种加速器,但是出差只带了公司的电脑,各种限制,电脑上开了各种加速器之后,根本没法共享给 switch。然后转战淘宝,发现有卖代理服务器的,就是给你个 IP+Port,先买个 1 块的试了试,下东西是很快,但是还是没法登陆狂野飙车,顺便看了下卖家给的服务器 IP 是美帝的。

    然后想着能不能找个香港的服务器会好些,于是刚刚自己买了个阿里云国际的轻应用服务器,3.5$,搭建好之后,NAT 类型变成了 B,测速是 20Mbps 左右,几个朋友一起用,还是很合算的。

    下面写下搭建过程,希望能帮得上有需要的人。如果有啥写错的,请轻喷~

    #教程基于 CentOS

    1.安装 Squid 并修改配置:

    yum install squid -y
    cp /etc/squid/squid.conf /etc/squid/squid.conf.bak
    vi /etc/squid/squid.conf
    

    我的配置文件,主要是修改端口和添加认证信息:

    #
    # Recommended minimum configuration:
    #
    
    # Example rule allowing access from your local networks.
    # Adapt to list your (internal) IP networks from where browsing
    # should be allowed
    acl localnet src 10.0.0.0/8     # RFC1918 possible internal network
    acl localnet src 172.16.0.0/12  # RFC1918 possible internal network
    acl localnet src 192.168.0.0/16 # RFC1918 possible internal network
    acl localnet src fc00::/7       # RFC 4193 local private network range
    acl localnet src fe80::/10      # RFC 4291 link-local (directly plugged) machines
    
    acl SSL_ports port 443
    acl Safe_ports port 80          # http
    acl Safe_ports port 21          # ftp
    acl Safe_ports port 443         # https
    acl Safe_ports port 70          # gopher
    acl Safe_ports port 210         # wais
    acl Safe_ports port 1025-65535  # unregistered ports
    acl Safe_ports port 280         # http-mgmt
    acl Safe_ports port 488         # gss-http
    acl Safe_ports port 591         # filemaker
    acl Safe_ports port 777         # multiling http
    acl CONNECT method CONNECT
    
    #
    # Recommended minimum Access Permission configuration:
    #
    # Deny requests to certain unsafe ports
    #http_access deny !Safe_ports
    
    # Deny CONNECT to other than secure SSL ports
    #http_access deny CONNECT !SSL_ports
    
    # Only allow cachemgr access from localhost
    http_access allow localhost manager
    http_access deny manager
    
    # We strongly recommend the following be uncommented to protect innocent
    # web applications running on the proxy server who think the only
    # one who can access services on "localhost" is a local user
    #http_access deny to_localhost
    
    #
    # INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS
    #
    
    # Example rule allowing access from your local networks.
    # Adapt localnet in the ACL section to list your (internal) IP networks
    # from where browsing should be allowed
    #http_access allow localnet
    http_access allow localhost
    
    # And finally deny all other access to this proxy
    #http_access deny all
    
    # Squid normally listens to port 3128
    #http_port 3128
    
    # Uncomment and adjust the following to add a disk cache directory.
    #cache_dir ufs /var/spool/squid 100 16 256
    
    # Leave coredumps in the first cache dir
    coredump_dir /var/spool/squid
    
    #
    # Add any of your own refresh_pattern entries above these.
    #
    refresh_pattern ^ftp:           1440    20%     10080
    refresh_pattern ^gopher:        1440    0%      1440
    refresh_pattern -i (/cgi-bin/|\?) 0     0%      0
    refresh_pattern .               0       20%     4320
    #用户认证文件的位置
    auth_param basic program /usr/lib64/squid/basic_ncsa_auth /etc/squid/passwd
    auth_param basic realm proxy
    acl authenticated proxy_auth REQUIRED
    http_access allow authenticated
    #http 代理的端口,默认为 3128
    http_port 12306
    acl OverConnLimit maxconn 16       #定义每个 IP 最大允许 16 个连接,防止攻击
    

    2.然后配置用户,为了安全:

    先安装 httpd

    yum install httpd* -y
    

    添加用户:

    htpasswd -c /etc/squid/passwd <username>
    #然后输入密码。
    

    重启 Squid 并启用开机启动:

    systemctl restart squid
    systemctl enable squid
    

    3.测试:

    先在 VPS 上本地测试下:

    curl --proxy 127.0.0.1:PORT --proxy-user <username>:<password> http://www.baidu.com
    

    如果有返回的话,应该就是 OK 了。

    然后可以从其它 Linux 上测试下,记得在 VPS 管理的地方防火墙放通自己定义的 PORT:

    curl --proxy <服务器 IP>:PORT --proxy-user <username>:<password> http://www.baidu.com
    

    然后 Switch 只需要在连接 wifi 的地方配置好代理服务器 IP + PORT + User + Password,就能用了。

    不保证每个地区都好用,具体的网络还是跟当地的情况有很大关系。阿里云这个机器带宽是 30M,我现在在杭州,网络是电信,测速有 20Mbps 左右,sShop 下载的时候,从服务器侧看,带宽跑到 17M 左右;朋友在重庆,测速只有 6Mbps,但是可以正常缓冲出舞力全开的在线歌曲。

    Ps.也欢迎大家讨论其他更好用的方法。

    16 replies    2024-07-22 08:58:32 +08:00
    0ZXYDDu796nVCFxq
        1
    0ZXYDDu796nVCFxq  
       Oct 14, 2019 via Android
    然而经过 gfw 的 http 代理,用不了几天就会被封
    chocolatesir
        2
    chocolatesir  
       Oct 14, 2019 via Android   ❤️ 1
    头像加急的一楼讲得对。你带了电脑直接开$,勾选允许局域网设备连接即可。
    billytom
        3
    billytom  
       Oct 15, 2019
    这个不就是很多很多年前的 http 大力吗?最多 48 小时应该就倒了吧
    masir
        4
    masir  
    OP
       Oct 15, 2019 via Android
    @chocolatesir 自己电脑可以这样,带的公司干活的电脑试过这么搞不行,一堆各种安全软件,不然也不愿意这么搞啊。在家是直接路由器上搞定的😂😂
    1daydayde
        5
    1daydayde  
       Oct 15, 2019
    你这等于给🧱送经验
    akvo
        6
    akvo  
       Oct 15, 2019 via Android
    弄个树莓派,直接跑个透明代理就能让网络质量到 A 了
    (不过在电脑上用 surge 做网关就是 F,看反馈 Mellow 也有这个现象)
    heqiaokyou
        7
    heqiaokyou  
       Oct 15, 2019
    建议随身带个路由器,路由器上装好威批恩+UDP 类加速工具。
    masir
        8
    masir  
    OP
       Oct 15, 2019
    @heqiaokyou 是的啊,昨天刚买,正在路上~
    locoz
        9
    locoz  
       Oct 15, 2019
    墙:你这是看不起我?
    masir
        10
    masir  
    OP
       Oct 15, 2019 via Android
    @locoz 😄😄
    natsji
        11
    natsji  
       Oct 24, 2019 via Android
    路由器酸酸乳然后给 switch 开全局加速
    marcosteam
        12
    marcosteam  
       Oct 29, 2019 via Android
    lean 的 lede 自带游戏加速模式,找个支持 UDP 转发的机场就行了
    Frannk
        13
    Frannk  
       Nov 10, 2019
    你这个是 HTTP 代理 按理来说不能提升 NAT 类型,因为 UDP 不走这个代理。你确定提升了 NAT 类型吗?
    kamui0523
        14
    kamui0523  
       Mar 19, 2020
    你在网络连接时设置的 http 代理只能加速 eshop,无法联机吧
    kamui0523
        15
    kamui0523  
       Mar 19, 2020
    @Frannk 我试过 NAT 类型会变成 A,但实际联机是连不上的,没用.....加速 eshop 效果还可以,但还是比 UU 加速差很多.
    我现在想研究下 Mellow 之类的做 UDP 代理加速
    molezznet
        16
    molezznet  
       Jul 22, 2024
    @0ZXYDDu796nVCFxq 这种如果设置成 https 呢? 我看 squid 是支持的
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   956 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 466ea39e · 57ms · UTC 18:50 · PVG 02:50 · LAX 11:50 · JFK 14:50
    ♥ Do have faith in what you're doing.