AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / unix / 问题 / 753043
Accepted
Marius
Marius
Asked: 2023-08-02 19:46:35 +0800 CST2023-08-02 19:46:35 +0800 CST 2023-08-02 19:46:35 +0800 CST

当 eth0 启动时 Wireguard 不工作

  • 772

设置

  • 路由器作为我网络上的 Wireguard 服务器
  • 树莓派
    • 操作系统:Raspbian Buster
    • 通过 wifi 连接到移动热点(接口 wlan0)
    • et0设置为静态IP,可以直接控制静态IP的设备,无需交换机或路由器
    • wg0 配置为连接到我的路由器上的服务器

问题

仅当我使用 禁用 eth0 时,wireguard 连接才有效ifconfig eth0 down。

我想做的事:

我需要在 Pi 上更新并测试软件的更新。该软件使用连接在 eth0 上的设备,因此我需要 eth0 处于活动状态。

我尝试过的

除了谷歌之外,什么也没有,但我找不到任何适合我的具体问题的东西。

我怀疑我需要更改路由表,但我不确定谁和我不想中断 wifi 连接。

Pi 上的 Wireguard 配置

[Interface]
PrivateKey = myPrivateKey
Address = 192.168.180.201/24
DNS = 192.168.180.1
DNS = fritz.box

[Peer]
PublicKey = myPublicKey
PresharedKey = Key
AllowedIPs = 192.168.180.0/24,0.0.0.0/0
Endpoint = myfritzdomain:59047
PersistentKeepalive = 25

/etch/dhcpcd.conf 中的 eth0 配置

# A sample configuration for dhcpcd.
# See dhcpcd.conf(5) for details.

# Allow users of this group to interact with dhcpcd via the control socket.
#controlgroup wheel

# Inform the DHCP server of our hostname for DDNS.
hostname

# Use the hardware address of the interface for the Client ID.
clientid
# or
# Use the same DUID + IAID as set in DHCPv6 for DHCPv4 ClientID as per RFC4361.
# Some non-RFC compliant DHCP servers do not reply with this set.
# In this case, comment out duid and enable clientid above.
#duid

# Persist interface configuration when dhcpcd exits.
persistent

# Rapid commit support.
# Safe to enable by default because it requires the equivalent option set
# on the server to actually work.
option rapid_commit

# A list of options to request from the DHCP server.
option domain_name_servers, domain_name, domain_search, host_name
option classless_static_routes
# Respect the network MTU. This is applied to DHCP routes.
option interface_mtu

# Most distributions have NTP support.
#option ntp_servers

# A ServerID is required by RFC2131.
require dhcp_server_identifier

# Generate SLAAC address using the Hardware Address of the interface
#slaac hwaddr
# OR generate Stable Private IPv6 Addresses based from the DUID
slaac private

interface eth0
static ip_address=192.168.1.45/16
static routers=192.168.1.1
static domain_name_servers=192.168.1.1

raspberry-pi
  • 1 1 个回答
  • 21 Views

1 个回答

  • Voted
  1. Best Answer
    Marius
    2023-08-03T14:49:13+08:002023-08-03T14:49:13+08:00

    对我来说,解决方案是删除定义静态 IP 的行static routers。我不确定是否必须将两者都删除。我认为删除 dns 应该就足够了,因为 Pi 可能试图通过不可用的静态 dns 找到我的wiregurad 域。static domain_name_servers/etch/dhcpcd.conf

    感谢 AB 提供了正确方向的提示。

    • 0

相关问题

  • Raspberry:从 USB 笔而不是 SD 卡启动

  • vwdial RPI 上的错误初始化字符串 [关闭]

  • 如何从家里的树莓派服务器自动更新 Route53?

  • /etc/init.d/hostname.sh 仍然是 debian 拉伸的选项吗?

  • “pacman -Syu”“可能”破坏了我的系统,因为未安装引导

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    模块 i915 可能缺少固件 /lib/firmware/i915/*

    • 3 个回答
  • Marko Smith

    无法获取 jessie backports 存储库

    • 4 个回答
  • Marko Smith

    如何将 GPG 私钥和公钥导出到文件

    • 4 个回答
  • Marko Smith

    我们如何运行存储在变量中的命令?

    • 5 个回答
  • Marko Smith

    如何配置 systemd-resolved 和 systemd-networkd 以使用本地 DNS 服务器来解析本地域和远程 DNS 服务器来解析远程域?

    • 3 个回答
  • Marko Smith

    dist-upgrade 后 Kali Linux 中的 apt-get update 错误 [重复]

    • 2 个回答
  • Marko Smith

    如何从 systemctl 服务日志中查看最新的 x 行

    • 5 个回答
  • Marko Smith

    Nano - 跳转到文件末尾

    • 8 个回答
  • Marko Smith

    grub 错误:你需要先加载内核

    • 4 个回答
  • Marko Smith

    如何下载软件包而不是使用 apt-get 命令安装它?

    • 7 个回答
  • Martin Hope
    user12345 无法获取 jessie backports 存储库 2019-03-27 04:39:28 +0800 CST
  • Martin Hope
    Carl 为什么大多数 systemd 示例都包含 WantedBy=multi-user.target? 2019-03-15 11:49:25 +0800 CST
  • Martin Hope
    rocky 如何将 GPG 私钥和公钥导出到文件 2018-11-16 05:36:15 +0800 CST
  • Martin Hope
    Evan Carroll systemctl 状态显示:“状态:降级” 2018-06-03 18:48:17 +0800 CST
  • Martin Hope
    Tim 我们如何运行存储在变量中的命令? 2018-05-21 04:46:29 +0800 CST
  • Martin Hope
    Ankur S 为什么 /dev/null 是一个文件?为什么它的功能不作为一个简单的程序来实现? 2018-04-17 07:28:04 +0800 CST
  • Martin Hope
    user3191334 如何从 systemctl 服务日志中查看最新的 x 行 2018-02-07 00:14:16 +0800 CST
  • Martin Hope
    Marko Pacak Nano - 跳转到文件末尾 2018-02-01 01:53:03 +0800 CST
  • Martin Hope
    Kidburla 为什么真假这么大? 2018-01-26 12:14:47 +0800 CST
  • Martin Hope
    Christos Baziotis 在一个巨大的(70GB)、一行、文本文件中替换字符串 2017-12-30 06:58:33 +0800 CST

热门标签

linux bash debian shell-script text-processing ubuntu centos shell awk ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve