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

关于两个局域网之间使用 wireguard 的问题

  •  
  •   unknow01 · Sep 16, 2022 · 2356 views
    This topic created in 1353 days ago, the information mentioned may be changed or developed.

    https://imgur.com/mWwfAF6

    VPS---net.ipv4.ip_forward = 1 ---wg0.conf [Interface] PrivateKey = VPS PrivateKey Address = 30.100.100.1/24 ListenPort = 54321

    [Peer] PublicKey = Client A PublicKey AllowedIPs = 30.100.100.2/32

    [Peer] PublicKey = Client B PublicKey AllowedIPs = 30.100.100.3/32,20.20.20.0/24

    Client A---wg0.conf [Interface] PrivateKey = Client A PrivateKey Address = 30.100.100.2/24

    [Peer] PublicKey = VPS PublicKey AllowedIPs = 30.100.100.0/32 Endpoint = 1.2.3.4:54321 PersistentKeepalive = 25

    Client B---net.ipv4.ip_forward = 1 ---wg0.conf [Interface] PrivateKey = Client B PrivateKey Address = 30.100.100.3/24

    [Peer] PublicKey = VPS PublicKey AllowedIPs = 30.100.100.0/32 Endpoint = 1.2.3.4:54321 PersistentKeepalive = 25

    如图所示:系统基本为 Debian/ubuntu ,在 ClientC 没有公网 IP 和不用安装 WireGuard 的情况下(在 RouterB 下还有其他设备:如 ClientD[提供 FTP 服务]),ClientA 如何透过 ClientB 访问 ClientC(D.E.F...) 所提供的服务,请各位帮帮忙把详细的设置和命令告诉一下,谢谢。

    5 replies    2022-09-16 16:53:05 +08:00
    smallparking
        1
    smallparking  
       Sep 16, 2022 via Android
    tailscale
    lxc404
        2
    lxc404  
       Sep 16, 2022
    Client A 的 AllowedIPs 里加上 20.20.20.0/24 ,或者手动加路由表 试试
    还不行的话检查 Client B 的 iptables ,FORWARD 什么的得放行
    lxc404
        3
    lxc404  
       Sep 16, 2022
    我是把 4 张局域网连接起来的,在各自局域网的路由上做了 WireGuard ,网下所有设备可以用各自局域网 ip 互访

    不过时间长了,配置有点忘了
    aver4vex
        4
    aver4vex  
       Sep 16, 2022
    我是在 clientb 上用 firewalld 做流量重定向,
    firewall-cmd --zone=public --add-masquerade
    firewall-cmd
    --zone=public
    --add-forward-port=port=13389:proto=tcp:toport=3389:toaddr=192.168.0.4
    lsww
        5
    lsww  
       Sep 16, 2022
    tailscale 是神器,直接把家里 NAS 用 RADIDRIVE 挂到了本地。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2707 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 42ms · UTC 06:11 · PVG 14:11 · LAX 23:11 · JFK 02:11
    ♥ Do have faith in what you're doing.