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 / 问题

问题[raspberry-pi](unix)

Martin Hope
Vincent
Asked: 2025-02-16 21:27:57 +0800 CST

我的本地 DNS 服务器无法解析

  • 5

我有一台正在使用的笔记本电脑、一个基于 FreshTomato 的路由器和一个运行 NixOS 的 Raspberry Pi,我在其上安装了Blocky以尝试将其用作我的 DNS 服务器。

但是,我的笔记本电脑发出的请求无法解决:

$  curl https://0xerr0r.github.io/blocky
curl: (6) Could not resolve host: 0xerr0r.github.io

Firefox 中的请求似乎永远都无法完成。

这是从我的笔记本电脑上获取的,据我所知,它已获取 DNS 服务器的正确 IP:

网络设置将 192.168.1.4 列为 DNS 服务器

这也是来自我的笔记本电脑:

$ dig @192.168.1.4 https://0xerr0r.github.io
;; communications error to 192.168.1.4#53: timed out
;; communications error to 192.168.1.4#53: timed out
;; communications error to 192.168.1.4#53: timed out

; <<>> DiG 9.18.30 <<>> @192.168.1.4 https://0xerr0r.github.io
; (1 server found)
;; global options: +cmd
;; no servers could be reached

但是,从 Pi 本身运行相同程序(通过 SSH):

$ nix-shell --packages dig --run "dig @192.168.1.4 https://0xerr0r.github.io"
; <<>> DiG 9.18.28 <<>> @192.168.1.4 https://0xerr0r.github.io
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 31507
;; flags: qr rd ra; QUERY: 1, ANSWER: 4, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
;; QUESTION SECTION:
;https://0xerr0r.github.io. IN  A

;; ANSWER SECTION:
https://0xerr0r.github.io. 3600 IN  A   185.199.109.153
https://0xerr0r.github.io. 3600 IN  A   185.199.108.153
https://0xerr0r.github.io. 3600 IN  A   185.199.111.153
https://0xerr0r.github.io. 3600 IN  A   185.199.110.153

;; Query time: 335 msec
;; SERVER: 192.168.1.4#53(192.168.1.4) (UDP)
;; WHEN: Sun Feb 16 13:44:31 CET 2025
;; MSG SIZE  rcvd: 118

这些是我的 Blocky 设置:

    settings = {
      ports.dns = 53; # Port for incoming DNS Queries.
      ports.http = 4000;
      upstreams.groups.default = [
        "https://one.one.one.one/dns-query" # Using Cloudflare's DNS over HTTPS server for resolving queries.
      ];
      # For initially solving DoH/DoT Requests when no system Resolver is available.
      bootstrapDns = {
        upstream = "https://one.one.one.one/dns-query";
        ips = [ "1.1.1.1" "1.0.0.1" ];
      };
      #Enable Blocking of certain domains.
      blocking = {
        denylists = {
          #Adblocking
          ads = ["https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts"];
          #Another filter for blocking adult sites
          adult = ["https://blocklistproject.github.io/Lists/porn.txt"];
          #You can add additional categories
        };
        #Configure what block categories are used
        clientGroupsBlock = {
          default = [ "ads" ];
          kids-ipad = ["ads" "adult"];
        };
      };
    };

它似乎运行良好:

$  blocky blocking status
[2025-02-16 13:55:27]  INFO blocking enabled

以下是我的路由器的一些可能相关的设置。

路由器“DHCP 保留”设置,在我的 Pi 的 Mac 地址旁边列出 192.168.1.4。

将 DNS 服务器设置为该 IP 地址:

路由器设置:DNS 服务器“手动”,DNS 1“192.168.1.4”,DNS 2“0.0.0.0”(未设置后由 FreshTomato 自动填充)

我认为这已经足够了,但我还必须为我的笔记本电脑添加这个 dnsmasq 配置才能真正获取 DNS 服务器:

Dnsmasq自定义配置:dhcp-option=6,192.168.1.4

有人知道哪里出了问题吗?提前谢谢!

raspberry-pi
  • 1 个回答
  • 36 Views
Martin Hope
Darrion Ramos
Asked: 2024-06-28 11:30:35 +0800 CST

Pi 零交叉编译浮点规范

  • 6

我正在尝试交叉编译一个 go 项目 (syzkaller) 以针对 Pi Zero,以便它可以模拟 usb 设备。问题是我无法找到有关如何指定正确的浮点标志以确保与 Pi Zero 兼容的信息。我尝试过的所有方法都导致VMOV汇编指令出现在二进制文件中并抛出非法指令。我的主机正在x86_64运行go1.21.4,pi zero 正在arm6l运行go1.21.4。交叉编译时我正在使用GOOS=linux GOARCH=arm GOARM=5。我正在使用的 makefile 可以在这里找到:https://github.com/google/syzkaller/blob/master/Makefile(我正在编译 execprog 二进制文件)。根据我的研究,GOARM=5应该强制软件浮点运算,但信息来源非常过时。我也尝试过为 armv5 编译,但没有成功。由于我对 GO 不是很熟悉,我也可能错误地使用了标志。以下是二进制文件的确切编译参数。任何建议都值得赞赏,谢谢。

Must remake target 'execprog'.
GOOS=linux GOARCH=arm go build "-ldflags=-s -w -X github.com/google/syzkaller/prog.\
GitRevision=121701b62358a454bbfdccfadfcce9bb843602d6+ -X 'github.com/google/syzkaller\
/prog.gitRevisionDate=20240605-134717'" "-tags=syz_target syz_os_linux syz_arch_armv6\
 GOARM=5" -o ./bin/linux_arm/syz-execprog github.com/google/syzkaller/tools/syz-execprog
raspberry-pi
  • 1 个回答
  • 21 Views
Martin Hope
nammerkage
Asked: 2024-05-28 22:14:19 +0800 CST

Raspbery(Ubuntu 安装)运行服务器 UI 服务器 - 如何访问?

  • 8

我在 ubuntu 服务器上安装了树莓派,运行Prefect。当我使用我的个人电脑时,我可以让 Prefect 运行并启动 UI 服务器:

>>> prefect server start
Check out the dashboard at http://127.0.0.1:4200

当我的个人电脑运行此代码时,我可以访问此 UI 网站。

我已将此工作代码发送到我的 Raspberry Pie,我可以通过 SSH ( ) 访问它并启动代码。当我通过 SSH 运行代码时,我得到:SSH [email protected]

>>> prefect server start
Check out the dashboard at http://127.0.0.1:4200

但现在我不知道如何从我的个人电脑访问这个 UI 网站。有任何想法吗?我寻求帮助,但到目前为止,我对我读到的提示没有任何运气。

raspberry-pi
  • 5 个回答
  • 86 Views
Martin Hope
zahntheo
Asked: 2024-04-16 20:27:34 +0800 CST

将现场声音从树莓派传送到 macOS

  • 8

我想将树莓派上录制的声音通过管道传输到我的 MacBook 并进行现场播放。我尝试过以下方法:

在我的树莓派上:

我尝试在端口3333上建立数据流

arecord -D plughw:3,0 -f S16_LE 44100 -t raw | nc -l -p 3333

在我的 MacBook 上:

nc 10.10.1.1 3333 | play -t raw -b 16 -e signed-integer -r 44100 -c 1 -V1 -

有了这个,我在 Mac 上听不到任何声音,但在终端中得到以下输出:

-: (生的)

文件大小:0 编码:签名 PCM 通道:1 @ 16 位 采样率:44100Hz 重放增益:关闭 持续时间:未知

输入:0.00% 00:00:00.00 [00:00:00.00] 输出:0 [ | ] 剪辑:0 完成。

raspberry-pi
  • 1 个回答
  • 123 Views
Martin Hope
theking2
Asked: 2024-02-15 04:20:50 +0800 CST

仅运行 dnsmasq 的树莓派的最佳调度程序

  • 5

作为仅 DHCP/DNS 服务器 (dnsmasq) 运行的 RaspberryPi2 的最佳调度程序设置是什么。如何减少SD卡的磨损?

raspberry-pi
  • 1 个回答
  • 24 Views
Martin Hope
AngryHacker
Asked: 2023-11-03 02:05:35 +0800 CST

如何从命令行查看所有启动任务?

  • 5

我试图找出为什么某个应用程序在我的 Raspberry Pi 上运行,结果发现有六种方法可以在启动时执行应用程序。这是我找到的。

  • /etc/rc.local
  • /home/pi/.bashrc
  • 将脚本复制到 /etc/init.d/
  • 系统控制
  • 通过 crontab 进行安排

有没有办法从命令行识别启动时运行(或计划运行)的所有内容?

raspberry-pi
  • 1 个回答
  • 29 Views
Martin Hope
bomben
Asked: 2023-10-11 21:02:07 +0800 CST

我可以在不使用 MASQUERADING 的情况下使用 Wireguard 运行 PIVPN 吗?

  • 6

在 Raspberry Pi 上安装时,pivpn它将创建一条 iptables 规则:

pi@RPi64:~ $ sudo iptables -L -t nat                                                                                                      
Chain PREROUTING (policy ACCEPT)                                                                                                                                                                                                             
target     prot opt source               destination                                                                                                                                                                                                                                                                                                                                                                                                                                      

Chain INPUT (policy ACCEPT)                                                                                                                                                                                                                  
target     prot opt source               destination                                                                                                                                                                                                                                                                                                                                                                                                                                      

Chain OUTPUT (policy ACCEPT)                                                                                                                                                                                                                 
target     prot opt source               destination                                                                                                                                                                                                                                                                                                                                                                                                                                      

Chain POSTROUTING (policy ACCEPT)                                                                                                                                                                                                            
target     prot opt source               destination                                                                                                                                                                                         
MASQUERADE  all  --  10.122.242.0/24      anywhere             /* wireguard-nat-rule */    

我认为它是通过以下方式插入规则来做到这一点的iptables-persistant:

pi@RPi64:~ $ cat /etc/iptables/rules.v4                                                                                                                                                                                                      
# Generated by iptables-save v1.8.7 on Fri Aug 12 08:07:21 2022                                                                                                                                                                              
*nat                                                                                                                                                                                                                                         
:PREROUTING ACCEPT [0:0]                                                                                                                                                                                                                     
:INPUT ACCEPT [0:0]                                                                                                                                                                                                                          
:OUTPUT ACCEPT [0:0]                                                                                                                                                                                                                         
:POSTROUTING ACCEPT [0:0]                                                                                                                                                                                                                    
-A POSTROUTING -s 10.122.242.0/24 -o eth0 -m comment --comment wireguard-nat-rule -j MASQUERADE                                                                                                                                              
COMMIT                                                                                                                                                                                                                                       
# Completed on Fri Aug 12 08:07:21 2022 

当然,这是在服务器端。如果我想从客户端完全连接到该服务器,我需要通过在客户端上插入类似的规则来在客户端上添加伪装:

pi@schwarz:~ $ sudo iptables -L -t nat
Chain PREROUTING (policy ACCEPT)
target     prot opt source               destination

Chain INPUT (policy ACCEPT)
target     prot opt source               destination

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

Chain POSTROUTING (policy ACCEPT)
target     prot opt source               destination
MASQUERADE  all  --  anywhere             anywhere

我这样做:

pi@schwarz:~ $ sudo cat /etc/wireguard/schwarz.conf                                                                         
[Interface]                                                                                                             
PrivateKey = 
Address = 10.122.242.4/24                                                                                                
PostUp = iptables -t nat -A POSTROUTING -o schwarz -j MASQUERADE                                                        
PreDown = iptables -t nat -D POSTROUTING -o schwarz -j MASQUERADE                                                      
DNS = 9.9.9.9, 149.112.112.112                                                                                                                                                                                                                  
[Peer]                                                                                                                    
...

然后,我在两个路由器上添加静态路由,以便将到相应 LAN 的流量从这些 LAN 中的其他客户端路由到wireguard 服务器或客户端。

这样我就可以从两个 LAN 中的任何客户端完全连接到两个 LAN 中的所有设备。

这种方法的问题是,客户端会丢失其原始 LAN 中的原始 IP,而是会使用 Wireguard 客户端的 IP(加上端口)出现在其他网络中。这当然是由于NATing(伪装)造成的。

这样一切工作都很好。

除了一项服务:Logitechmediaserver。该服务器无法处理来自远程 LAN 的所有客户端,因为它们现在具有相同的 IP。更具体地说,问题只是部分罗技客户端(Radio)。客户端在服务器上连接正常,但看不到服务器响应。其他客户端(Boom)连接良好。他们使用不同的协议。

这让我想知道为什么pivpn还要伪装 IP。难道仅仅拥有从 LAN 到客户端/服务器以及在这些客户端/服务器上到它们创建的隧道的静态路由还不够吗?

为何要伪装?是否针对 Wireguard 服务器同时充当 Internet 的 ISP 路由器的情况进行了此操作?这里的情况并非如此。路由器始终位于不同的机器上。

长话短说,我想知道是否一般可以删除pivpn. 另外,也许有人可以指出我的设置中存在的错误。

raspberry-pi
  • 1 个回答
  • 37 Views
Martin Hope
Steve Cohen
Asked: 2023-10-01 01:55:59 +0800 CST

.local 域的问题

  • 5

我从研究中得知,.local 域被认为是一个非常糟糕的主意。

然而,我正在尝试使用两种不同的天文学应用程序,设计为在 Raspberry Pi 上运行,其中所述说明表明应通过 .local 地址连接到在 Pi 上运行的系统。这些应用程序的目的是远程控制望远镜和相关设备,最终无需通过目镜观察所指向的天文物体。我不知道为什么这些系统的开发人员会选择这种连接方法。我只是想办法处理它。

两者的说明均表示,您应该将计算机指向 Pi 上运行的系统的 WiFi 热点(两个系统都有热点),然后通过. 。。.本地地址。这适用于两个系统(我可以通过更换 microSD 卡在系统之间切换)。有趣的是,在一个系统上,我发现无论我是否将计算机指向 Pi 热点,我都可以连接到它。另一方面,只有当我将计算机指向热点时才能连接。

我只是想了解这一切是如何工作的,特别是在一种情况下,我如何能够在不连接到热点的情况下访问 .local 地址,而在其他系统中,这是不可能的。

对于理解这一切的任何帮助,我将不胜感激。

raspberry-pi
  • 1 个回答
  • 29 Views
Martin Hope
Mark
Asked: 2023-09-06 01:49:34 +0800 CST

保持屏幕开启

  • 6

不带 X 服务器的 RPi3 B+ 的 Buildroot(仅限控制台)。连接到 HDMI 的显示器。我想让显示器保持打开状态。

如果 10 分钟没有键盘活动(如果我没记错的话),屏幕就会关闭。根据我的旧笔记,我做了以下事情:

echo -ne "\033[9;0]" >> /etc/issue

但它不起作用。我找到了很多建议,但仅限于 X。

raspberry-pi
  • 2 个回答
  • 19 Views
Martin Hope
Marius
Asked: 2023-08-02 19:46:35 +0800 CST

当 eth0 启动时 Wireguard 不工作

  • 5

设置

  • 路由器作为我网络上的 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 个回答
  • 21 Views

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