首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Wireguard客户端在nixos上没有完成握手。

Wireguard客户端在nixos上没有完成握手。
EN

Unix & Linux用户
提问于 2021-03-07 12:14:55
回答 1查看 1.5K关注 0票数 0
代码语言:javascript
复制
Mar 07 12:10:16 nixos kernel: wireguard: wg0: Handshake for peer 1 (192.248.152.91:58338) did not complete after 5 seconds, retrying (try 3)
Mar 07 12:10:16 nixos kernel: wireguard: wg0: Sending handshake initiation to peer 1 (192.248.152.91:58338)

如果我将允许的IPs设置为0.0.0.0以外的东西,这似乎是正确的-我的理解是,它只会通过wireguard发送到这些ips的连接。

代码语言:javascript
复制
  networking.firewall = {
      enable = false;
    };

  # Enable Wireguard
  networking.wireguard.interfaces = {
    wg0 = {
      ips = [ "10.66.66.2/32" ];
      listenPort = 58338; # to match firewall allowedUDPPorts (without this wg uses random port numbers)
      privateKey= "************************";

      peers = [

        {
          publicKey = "***************";
          presharedKey = "*****************";

          allowedIPs = [ "0.0.0.0/0" ];
          #allowedIPs = [ "10.66.66.1" "94.130.178.87" ];

          endpoint = "192.248.152.91:58338"; # ToDo: route to endpoint not automatically configured https://wiki.archlinux.org/index.php/WireGuard#Loop_routing https://discourse.nixos.org/t/solved-minimal-firewall-setup-for-wireguard-client/7577

          # Send keepalives every 25 seconds. Important to keep NAT tables alive.
          persistentKeepalive = 25;
        }
      ];
    };
  };

我已经阅读过https://discourse.nixos.org/t/solved-minimal-firewall-setup-for-wireguard-client/7577/4,但是即使在使用ip route add 192.248.152.91 via 10.66.66.1 dev wg0添加了ip路由之后,它的行为似乎也没有任何变化。

代码语言:javascript
复制
root@nixos> ip route                                                                                                ~
default dev wg0 scope link 
default via 10.0.2.2 dev eth0 proto dhcp src 10.0.2.15 metric 202 
10.0.2.0/24 dev eth0 proto dhcp scope link src 10.0.2.15 metric 202 
192.248.152.91 via 10.66.66.1 dev wg0
EN

回答 1

Unix & Linux用户

发布于 2021-03-07 12:21:08

我不得不添加以下路线:

ip route add 192.248.152.91 via 10.0.2.2

这里有很多关于这个问题的讨论:https://github.com/NixOS/nixpkgs/issues/51258#issuecomment-673839893

票数 0
EN
页面原文内容由Unix & Linux提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://unix.stackexchange.com/questions/638007

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档