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
    • 最新
    • 标签
主页 / user-63801

PhilBot's questions

Martin Hope
PhilBot
Asked: 2024-08-13 00:42:48 +0800 CST

systemd-networkd DHCP 服务器无法为 DHCPv4 服务器实例配置地址池:数值结果超出范围

  • 5

我使用的是 systemd 网络版本 253.1。我的 Linux 5.15 机器上有 2 个以太网端口,我想在第二个端口上设置一个 DHCP 服务器。我已成功完成此操作,并为 eth1 进行了以下配置。

工作 DHCP 服务器配置:

[Match]
Name=eth1
Type=ether

[DHCPV4]
DUIDType=link-layer
ClientIdentifier=mac

[Network]
Address=172.1.17.1/24
DHCPServer=yes
#IPMasquerade=ipv4

[DHCPServer]
PoolOffset=1
PoolSize=8

现在,我想要将范围更改为以下内容:

[Match]
Name=eth1
Type=ether

[DHCPV4]
DUIDType=link-layer
ClientIdentifier=mac

[Network]
#
# 10.1.193.24/29
#
#  Network Address: 10.1.193.24
#  Usable IP Range: 10.1.193.25 - 10.1.193.30
#  Broadcast Address: 10.1.193.31
#
Address= 10.1.193.24/29
DHCPServer=yes
#IPMasquerade=ipv4

[DHCPServer]
PoolOffset=2
PoolSize=5

但是,我收到如下所示的错误:

[root@machine ~]$  networkctl status eth1 -l
* 3: eth1
                     Link File: n/a
                  Network File: /etc/systemd/network/eth1.network
                         State: routable (failed)
                  Online state: online
                          Type: ether
                          Path: platform-30bf0000.ethernet
              Hardware Address: 00:01:c0:37:6d:56 (Company, Ltd.)
                           MTU: 1500 (min: 46, max: 9000)
                         QDisc: mq
  IPv6 Address Generation Mode: eui64
      Number of Queues (Tx/Rx): 8/8
              Auto negotiation: yes
                         Speed: 1Gbps
                        Duplex: full
                          Port: tp
                       Address: 10.1.193.24
                                fe80::201:c0ff:fe37:6d56
             Activation Policy: up
           Required For Online: yes
             DHCP6 Client DUID: DUID-EN/Vendor:0000ab1180dd9f24e9435b570000
           Offered DHCP leases: none

Aug 12 14:33:07 machine systemd-networkd[654]: eth1: Received new foreign route (configured): dst: 10.1.193.24/29, src: n/a, gw: n/a, prefsrc: 10.1.193.24, scope: link, table: main(254), proto: kernel, type: unicast, nexthop: 0, priority: 0, flags: n/a
Aug 12 14:33:07 machine systemd-networkd[654]: eth1: Addresses set
Aug 12 14:33:07 machine systemd-networkd[654]: eth1: link_check_ready(): dynamic addresses or routes are not configured.
Aug 12 14:33:07 machine systemd-networkd[654]: eth1: Configuring DHCP Server.
Aug 12 14:33:07 machine systemd-networkd[654]: eth1: Failed to configure address pool for DHCPv4 server instance: Numerical result out of range
Aug 12 14:33:07 machine systemd-networkd[654]: eth1: Failed to configure DHCP server: Numerical result out of range
Aug 12 14:33:07 machine systemd-networkd[654]: eth1: Failed
Aug 12 14:33:07 machine systemd-networkd[654]: eth1: State changed: configuring -> failed
Aug 12 14:33:07 machine systemd-networkd[654]: eth1: LLDP Rx: Stopping LLDP client
Aug 12 14:33:07 machine systemd-networkd[654]: eth1: NDISC: Stopping IPv6 Router Solicitation client

我检查了各种 CIDR 计算器,我相信我的配置文件参数是有效的。

在此处输入图片描述

为什么 networkd 不接受我的配置文件?

linux
  • 1 个回答
  • 20 Views
Martin Hope
PhilBot
Asked: 2023-12-01 04:32:23 +0800 CST

systemd-networkd DHCPServer 在客户端直接连接但不能通过非托管交换机连接时工作

  • 5

我有一台运行内核版本 5.15 的 Linux 机器。我安装了 systemd 版本 250.5+,并将其配置为在物理以太网端口上运行 DHCP 服务器。我有一个树莓派,运行今天的最新版本。如果我将树莓派直接连接到以太网端口,那么树莓派就会获得一个 IP 地址,并且两个设备可以正常通信。如果我将非托管交换机直接放在 2 之间,则 DHCP 不起作用,并且树莓派无法获取 IP 地址。我知道该交换机可以工作,因为我可以在家庭路由器和另一台机器之间使用它。既然它可以在没有交换机的情况下工作,并且交换机可以与其他设备一起工作,那么为什么 systemd networkd 的 DHCP 服务器在使用交换机时会失败?

我在 systemd-networkd DHCP 服务器功能的文档中没有看到任何明显遗漏的内容: https://www.freedesktop.org/software/systemd/man/latest/systemd.network.html

这是我用于 DHCP 服务器的 systemd 网络配置文件:

cat /etc/systemd/network/eth0.network
[Match]
Name=eth0
Type=ether

[DHCPV4]
DUIDType=link-layer
ClientIdentifier=mac

[Network]
Address=172.1.16.1/24
DHCPServer=yes
#IPMasquerade=ipv4

[DHCPServer]
PoolOffset=1
PoolSize=4

在此输入图像描述

linux
  • 1 个回答
  • 21 Views
Martin Hope
PhilBot
Asked: 2023-08-20 10:55:38 +0800 CST

使用busctl和dbus读取systemd-networkd租赁信息

  • 5

我想使用busctl 读取Linux 中特定链接的systemd netowrkd 租用信息。

在我的系统上busctl tree,我可以看到网络接口:

Service org.freedesktop.resolve1:
└─/org
  └─/org/freedesktop
    ├─/org/freedesktop/LogControl1
    └─/org/freedesktop/resolve1
      ├─/org/freedesktop/resolve1/dnssd
      └─/org/freedesktop/resolve1/link
        ├─/org/freedesktop/resolve1/link/_31
        ├─/org/freedesktop/resolve1/link/_32
        ├─/org/freedesktop/resolve1/link/_33
        ├─/org/freedesktop/resolve1/link/_34
        ├─/org/freedesktop/resolve1/link/_35
        ├─/org/freedesktop/resolve1/link/_36
        ├─/org/freedesktop/resolve1/link/_37
        ├─/org/freedesktop/resolve1/link/_38
        └─/org/freedesktop/resolve1/link/_39

当我检查链接接口时,我看到了我想要读取的 DHCP 服务器名称:

busctl introspect org.freedesktop.network1 /org/freedesktop/network1/link/_35
NAME                                TYPE      SIGNATURE     RESULT/VALUE                             FLAGS
org.freedesktop.DBus.Introspectable interface -             -                                        -
.Introspect                         method    -             s                                        -
org.freedesktop.DBus.Peer           interface -             -                                        -
.GetMachineId                       method    -             s                                        -
.Ping                               method    -             -                                        -
org.freedesktop.DBus.Properties     interface -             -                                        -
.Get                                method    ss            v                                        -
.GetAll                             method    s             a{sv}                                    -
.Set                                method    ssv           -                                        -
.PropertiesChanged                  signal    sa{sv}as      -                                        -
org.freedesktop.network1.DHCPServer interface -             -                                        -
.Leases                             property  a(uayayayayt) 2 2 7 1 174 229 169 184 21 41 4 10 10 1… emits-change
org.freedesktop.network1.Link       interface -             -                                        -
.Describe                           method    -             s                                        -
.ForceRenew                         method    -             -                                        -
.Reconfigure                        method    -             -                                        -
.Renew                              method    -             -                                        -
.RevertDNS                          method    -             -                                        -
.RevertNTP                          method    -             -                                        -
.SetDNS                             method    a(iay)        -                                        -
.SetDNSEx                           method    a(iayqs)      -                                        -
.SetDNSOverTLS                      method    s             -                                        -
.SetDNSSEC                          method    s             -                                        -
.SetDNSSECNegativeTrustAnchors      method    as            -                                        -
.SetDefaultRoute                    method    b             -                                        -
.SetDomains                         method    a(sb)         -                                        -
.SetLLMNR                           method    s             -                                        -
.SetMulticastDNS                    method    s             -                                        -
.SetNTP                             method    as            -                                        -
.AddressState                       property  s             "routable"                               emits-change
.AdministrativeState                property  s             "configured"                             emits-change
.BitRates                           property  (tt)          18446744073709551615 184467440737095516… -
.CarrierState                       property  s             "carrier"                                emits-change
.IPv4AddressState                   property  s             "routable"                               emits-change
.IPv6AddressState                   property  s             "degraded"                               emits-change
.OnlineState                        property  s             "online"                                 emits-change
.OperationalState                   property  s             "routable"                               emits-change

我似乎无法调用 Leases 方法:

busctl call org.freedesktop.network1 /org/freedesktop/network1/link/_35 org.freedesktop.network1.DHCPServer Leases
Call failed: Unknown method Leases or interface org.freedesktop.network1.DHCPServer.

我在这里做错了什么以及如何阅读租赁信息?谢谢。

linux
  • 1 个回答
  • 16 Views
Martin Hope
PhilBot
Asked: 2023-08-18 21:53:51 +0800 CST

UFW 无法确定 iptables 版本

  • 6
赏金将在 6 天后到期。此问题的答案有资格获得+150声誉奖励。 PhilBot希望引起更多关注这个问题:
请帮我解决这个问题。

我正在使用 Yocto 构建基于 NXP i.MX8 的定制嵌入式 Linux 平台。我想使用 UFW 设置防火墙。当我启动系统并尝试使用 UFW 时,它返回错误

无法确定 iptables 版本。

我安装了 iptables 和 nftables 软件包。我尝试手动更改 itpables 符号链接以指向 iptables-legacy 二进制文件。它仍然失败。我怎样才能解决这个问题?请参阅下面的版本。

    root@iot-gate-imx8plus:~# iptables -v
    iptables v1.8.7 (legacy): no command specified
    Try `iptables -h' or 'iptables --help' for more information.
    root@iot-gate-imx8plus:~# nft -v
    nftables v1.0.2 (Lester Gooch)
    root@iot-gate-imx8plus:~# ufw version
    ufw 0.36.2
    Copyright 2008-2023 Canonical Ltd.
    root@iot-gate-imx8plus:~# ufw status
    ERROR: Couldn't determine iptables version
    root@iot-gate-imx8plus:~# uname -r
    5.15.32+g07c574e56d60
    root@iot-gate-imx8plus:~#

iptables:

    root@iot-gate-imx8plus:/usr/sbin# ls -lrt *iptables*

>    lrwxrwxrwx 1 root root 20 Mar  9  2018 iptables-save -> xtables-legacy-multi\
    lrwxrwxrwx 1 root root 20 Mar  9  2018 iptables-restore -> xtables-legacy-multi\
    lrwxrwxrwx 1 root root 20 Mar  9  2018 iptables-legacy-save -> xtables-legacy-multi\
    lrwxrwxrwx 1 root root 20 Mar  9  2018 iptables-legacy-restore -> xtables-legacy-multi\
    lrwxrwxrwx 1 root root 20 Mar  9  2018 iptables-legacy -> xtables-legacy-multi\
    lrwxrwxrwx 1 root root 20 Mar  9  2018 iptables -> xtables-legacy-multi
    
UPDATE:

Strace pointed out the problem. UFW makes an assumption of where the iptables binary is and Yocto installed it somewhere else:

strace: Process 700 attached
[pid   700] openat(AT_FDCWD, "/proc/self/fd", O_RDONLY|O_CLOEXEC) = 3
[pid   700] execve("/sbin/iptables", ["/sbin/iptables", "-V"], 0xffffec437b88 /* 21 vars */) = -1 ENOENT (No such file or directory)
[pid   700] +++ exited with 255 +++
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=700, si_uid=0, si_status=255, si_utime=0, si_stime=0} ---
ERROR: Couldn't determine iptables version
+++ exited with 1 +++
root@iot-gate-imx8plus:~# which iptables
/usr/sbin/iptables
root@iot-gate-imx8plus:~# ln -sf /usr/sbin/iptables /sbin/iptables
root@iot-gate-imx8plus:~# ufw status
Status: inactive
linux
  • 1 个回答
  • 36 Views
Martin Hope
PhilBot
Asked: 2022-03-31 09:26:41 +0800 CST

SystemD JournalD 无法禁用子进程输出

  • 0

我在带有内核 5.10.50 的自定义嵌入式 Linux 设备上运行 SystemD 版本 249.7+。我正在使用 Podman 4.0.2 和 Docker-Compose 来运行一些容器。我遇到的问题是 podman 系统服务中的“conmon”子进程复制了 docker-compose 进程生成的每个日志日志条目。我想删除日志条目的普通版本,只保留 docker-compose 生成的日志条目。

Journalctl 显示重复的条目,如下所示:

-- Journal begins at Sun 2012-01-01 00:02:21 UTC. --
Mar 30 17:06:15 device conmon[1625]: {"products":["Linux","Windows","Mac"]}
Mar 30 17:06:16 device sh[16648]: app1  | App1 endpoint hit ...
Mar 30 17:06:16 device sh[16648]: app3  | {"products":["Linux","Windows","Mac"]}
Mar 30 17:06:16 device sh[16648]: app2  | App2 endpoint hit ...
Mar 30 17:06:16 device sh[16648]: app1  | 10.89.0.3 - - [30/Mar/2022 17:06:15] "GET / HTTP/1.1" 200 -
Mar 30 17:06:16 device sh[16648]: app2  | Getting http://app1 ...
Mar 30 17:06:16 device sh[16648]: app2  | Status of GET: 200
Mar 30 17:06:16 device sh[16648]: app2  | Results of GET: {"products":["Linux","Windows","Mac"]}
Mar 30 17:06:16 device sh[16648]: app2  |
Mar 30 17:06:16 device sh[16648]: app2  | 10.89.0.4 - - [30/Mar/2022 17:06:15] "GET / HTTP/1.1" 200 -
Mar 30 17:06:21 device conmon[1558]: App2 endpoint hit ...
Mar 30 17:06:21 device conmon[1558]: Getting http://app1 ...
Mar 30 17:06:22 device sh[16648]: app1  | App1 endpoint hit ...
Mar 30 17:06:22 device sh[16648]: app2  | App2 endpoint hit ...
Mar 30 17:06:22 device sh[16648]: app1  | 10.89.0.3 - - [30/Mar/2022 17:06:22] "GET / HTTP/1.1" 200 -
Mar 30 17:06:22 device sh[16648]: app3  | {"products":["Linux","Windows","Mac"]}
Mar 30 17:06:22 device sh[16648]: app2  | Getting http://app1 ...
Mar 30 17:06:22 device sh[16648]: app2  | Status of GET: 200
Mar 30 17:06:22 device sh[16648]: app2  | Results of GET: {"products":["Linux","Windows","Mac"]}
Mar 30 17:06:22 device sh[16648]: app2  |
Mar 30 17:06:22 device sh[16648]: app2  | 10.89.0.4 - - [30/Mar/2022 17:06:22] "GET / HTTP/1.1" 200 -
Mar 30 17:06:22 device conmon[1393]: App1 endpoint hit ...
Mar 30 17:06:22 device conmon[1393]: 
Mar 30 17:06:22 device conmon[1393]: 10.89.0.3 - - [30/Mar/2022 17:06:22] "GET / HTTP/1.1" 200 -
Mar 30 17:06:22 device conmon[1558]: Status of GET: 200
Mar 30 17:06:22 device conmon[1558]: 
Mar 30 17:06:22 device conmon[1558]: Results of GET: {"products":["Linux","Windows","Mac"]}
Mar 30 17:06:22 device conmon[1558]: 
Mar 30 17:06:22 device conmon[1558]: 10.89.0.4 - - [30/Mar/2022 17:06:22] "GET / HTTP/1.1" 200 -
Mar 30 17:06:22 device conmon[1625]: {"products":["Linux","Windows","Mac"]}

conmon 日志由 podman.service 的“conmon”子进程生成。

root@device:~# systemctl status podman
● podman.service - Podman API Service
     Loaded: loaded (8;;file://device/lib/systemd/system/podman.service^G/lib/systemd/system/podman.service8;;^G; enabled; vendor preset: enabled)
     Active: active (running) since Wed 2022-03-30 15:48:55 UTC; 1h 18min ago
TriggeredBy: ● podman.socket
       Docs: 8;;man:podman-system-service(1)^Gman:podman-system-service(1)8;;^G
   Main PID: 515 (podman)
      Tasks: 17 (limit: 495)
     Memory: 11.8M
        CPU: 2min 11.029s
     CGroup: /system.slice/podman.service
             ├─ 515 /usr/bin/podman --log-level=error system service --time=0
             ├─1391 /usr/bin/dnsmasq -u root --conf-file=/run/containers/cni/dnsname/docker-compose_host_internal_net/dnsmasq.conf
             ├─1393 /usr/bin/conmon --api-version 1 -c 6739cff6019d2f7e8f123d6fb02f163ec99ee73d322672c41d81f85d6218c66f -u 6739cff6019d2f7e8f123d6fb02f163ec99ee73d322672c41d81f85d6218c66f -r /usr/bin/crun -b /con>
             ├─1558 /usr/bin/conmon --api-version 1 -c ae34f69196a5d1b332f2f137942d3728c24bb41d06392b13dcfc7296f39b7936 -u ae34f69196a5d1b332f2f137942d3728c24bb41d06392b13dcfc7296f39b7936 -r /usr/bin/crun -b /con>
             └─1625 /usr/bin/conmon --api-version 1 -c b94e032b37a8690f847442ab9cdcf7b78aefab45231098d02c60b5f79e5c3474 -u b94e032b37a8690f847442ab9cdcf7b78aefab45231098d02c60b5f79e5c3474 -r /usr/bin/crun -b /con>

Mar 30 17:07:19 device conmon[1558]: App2 endpoint hit ...
Mar 30 17:07:19 device conmon[1558]: Getting http://app1 ...
Mar 30 17:07:20 device conmon[1393]: App1 endpoint hit ...
Mar 30 17:07:20 device conmon[1393]: 10.89.0.3 - - [30/Mar/2022 17:07:20] "GET / HTTP/1.1" 200 -
Mar 30 17:07:20 device conmon[1558]: Status of GET: 200
Mar 30 17:07:20 device conmon[1558]: 
Mar 30 17:07:20 device conmon[1558]: Results of GET: {"products":["Linux","Windows","Mac"]}
Mar 30 17:07:20 device conmon[1558]: 
Mar 30 17:07:20 device conmon[1558]: 10.89.0.4 - - [30/Mar/2022 17:07:20] "GET / HTTP/1.1" 200 -
Mar 30 17:07:20 device conmon[1625]: {"products":["Linux","Windows","Mac"]}

我尝试将 SystemD 服务文件中的 podman.service StandardOutput 和 StandardErr 重定向为 null - 但 conmon 日志仍然显示为 journalctl。

root@device:~# cat /lib/systemd/system/podman.service 
[Unit]
Description=Podman API Service
Requires=podman.socket
After=podman.socket
Documentation=man:podman-system-service(1)
StartLimitIntervalSec=0

[Service]
Environment=XDG_RUNTIME_DIR=
CPUWeight=1000
Type=exec
KillMode=process
StandardOutput=null
StandardError=null
Environment=LOGGING="--log-level=error"
#ExecStart=/bin/sh -c "/usr/bin/podman $LOGGING system service --time=0 1>/dev/null 2>/dev/null"
ExecStart=/usr/bin/podman $LOGGING system service --time=0

如何摆脱 conmon 日志条目?谢谢。

systemd systemctl
  • 1 个回答
  • 140 Views
Martin Hope
PhilBot
Asked: 2018-08-10 04:59:08 +0800 CST

Linux 从 InitramFS "UserSpace" 修改/添加内核命令行

  • 2

我正在开发嵌入式 Linux 设备。我已经成功创建了一个启动后快速运行的 InitramFS CPIO 存档。现在,我想更改初始内核命令行以包含“quiet”参数,这样我可以更快地启动。

但是,一旦初始屏幕显示在 InitramFS 中,我想删除内核的安静选项,以便引导的其余部分不是安静的。

我怎样才能做到这一点?到达 InitramFS 后,如何反转初始的“安静”内核命令行选项?

谢谢。

linux kernel
  • 1 个回答
  • 1657 Views
Martin Hope
PhilBot
Asked: 2018-05-09 11:41:06 +0800 CST

Linux 自定义 CRDA WiFiregulation.bin 和 40MHz BW 5GHz 通道

  • 3

我正在为 Linux 上的 CRDA 创建自己的regulation.bin。使用我的自定义监管.bin,我希望能够使用 hostapd 为任何 5GHz、20MHz 或 40MHz BW 通道创建自己的热点。

我关心 5GHz(不是 2.4 GHz),目前所有 20MHz BW 通道都在工作。现在我想让 40 MHz 频道工作。

到目前为止,对于 40 MHz BW 频道,我只能让 hostapd 使用频道 38 和 46 创建热点。如果我尝试高于此(54,62,102,110,118,126,134,142,151 或 159),则 hostapd 抱怨频道不在基于 CRDA 允许的频道的支持列表。

这是正确的,因为 hostapd 打印的允许通道不包括这些 40 MHz 的较高通道。

但是,我认为它应该可以工作,因为我的自定义 CRDA 包括我认为 k 是正确的频率和 BW 参数以包括 40 MHz 通道:

country FK:
    (2402 - 2472 @ 40), (30)
    (2474 - 2494 @ 20), (20), NO-OFDM
    (5170 - 5250 @ 80), (17)
    (5170 - 5210 @ 40), (20) 
    (5210 - 5250 @ 40), (20)
    (5250 - 5290 @ 40), (20)
    (5290 - 5330 @ 40), (20)
    (5250 - 5330 @ 80), (23) 
    (5250 - 5350 @ 80), (100 mW) 
    (5470 - 5725 @ 80), (1000 mW)
    (5735 - 5835 @ 80), (30)

当我启动 hostapd 以创建我的 WiFi 热点时,调试打印显示以下内容为基于我的自定义 CRDA 条目的可选通道:

Allowed channel: mode=1 chan=1 freq=2412 MHz max_tx_power=30 dBm
Allowed channel: mode=1 chan=2 freq=2417 MHz max_tx_power=30 dBm
Allowed channel: mode=1 chan=3 freq=2422 MHz max_tx_power=30 dBm
Allowed channel: mode=1 chan=4 freq=2427 MHz max_tx_power=30 dBm
Allowed channel: mode=1 chan=5 freq=2432 MHz max_tx_power=30 dBm
Allowed channel: mode=1 chan=6 freq=2437 MHz max_tx_power=30 dBm
Allowed channel: mode=1 chan=7 freq=2442 MHz max_tx_power=30 dBm
Allowed channel: mode=1 chan=8 freq=2447 MHz max_tx_power=30 dBm
Allowed channel: mode=1 chan=9 freq=2452 MHz max_tx_power=30 dBm
Allowed channel: mode=1 chan=10 freq=2457 MHz max_tx_power=30 dBm
Allowed channel: mode=1 chan=11 freq=2462 MHz max_tx_power=30 dBm
Allowed channel: mode=1 chan=14 freq=2484 MHz max_tx_power=20 dBm
Allowed channel: mode=2 chan=36 freq=5180 MHz max_tx_power=17 dBm
Allowed channel: mode=2 chan=38 freq=5190 MHz max_tx_power=17 dBm
Allowed channel: mode=2 chan=40 freq=5200 MHz max_tx_power=17 dBm
Allowed channel: mode=2 chan=42 freq=5210 MHz max_tx_power=17 dBm
Allowed channel: mode=2 chan=44 freq=5220 MHz max_tx_power=20 dBm
Allowed channel: mode=2 chan=46 freq=5230 MHz max_tx_power=20 dBm
Allowed channel: mode=2 chan=48 freq=5240 MHz max_tx_power=20 dBm
Allowed channel: mode=2 chan=52 freq=5260 MHz max_tx_power=20 dBm
Allowed channel: mode=2 chan=56 freq=5280 MHz max_tx_power=20 dBm
Allowed channel: mode=2 chan=60 freq=5300 MHz max_tx_power=20 dBm
Allowed channel: mode=2 chan=64 freq=5320 MHz max_tx_power=20 dBm
Allowed channel: mode=2 chan=100 freq=5500 MHz max_tx_power=30 dBm
Allowed channel: mode=2 chan=104 freq=5520 MHz max_tx_power=30 dBm
Allowed channel: mode=2 chan=108 freq=5540 MHz max_tx_power=30 dBm
Allowed channel: mode=2 chan=112 freq=5560 MHz max_tx_power=30 dBm
Allowed channel: mode=2 chan=116 freq=5580 MHz max_tx_power=30 dBm
Allowed channel: mode=2 chan=120 freq=5600 MHz max_tx_power=30 dBm
Allowed channel: mode=2 chan=124 freq=5620 MHz max_tx_power=30 dBm
Allowed channel: mode=2 chan=128 freq=5640 MHz max_tx_power=30 dBm
Allowed channel: mode=2 chan=132 freq=5660 MHz max_tx_power=30 dBm
Allowed channel: mode=2 chan=136 freq=5680 MHz max_tx_power=30 dBm
Allowed channel: mode=2 chan=140 freq=5700 MHz max_tx_power=30 dBm
Allowed channel: mode=2 chan=149 freq=5745 MHz max_tx_power=30 dBm
Allowed channel: mode=2 chan=153 freq=5765 MHz max_tx_power=30 dBm
Allowed channel: mode=2 chan=157 freq=5785 MHz max_tx_power=30 dBm
Allowed channel: mode=2 chan=161 freq=5805 MHz max_tx_power=30 dBm
Allowed channel: mode=2 chan=165 freq=5825 MHz max_tx_power=30 dBm
Allowed channel: mode=0 chan=1 freq=2412 MHz max_tx_power=30 dBm
Allowed channel: mode=0 chan=2 freq=2417 MHz max_tx_power=30 dBm
Allowed channel: mode=0 chan=3 freq=2422 MHz max_tx_power=30 dBm
Allowed channel: mode=0 chan=4 freq=2427 MHz max_tx_power=30 dBm
Allowed channel: mode=0 chan=5 freq=2432 MHz max_tx_power=30 dBm
Allowed channel: mode=0 chan=6 freq=2437 MHz max_tx_power=30 dBm
Allowed channel: mode=0 chan=7 freq=2442 MHz max_tx_power=30 dBm
Allowed channel: mode=0 chan=8 freq=2447 MHz max_tx_power=30 dBm
Allowed channel: mode=0 chan=9 freq=2452 MHz max_tx_power=30 dBm
Allowed channel: mode=0 chan=10 freq=2457 MHz max_tx_power=30 dBm
Allowed channel: mode=0 chan=11 freq=2462 MHz max_tx_power=30 dBm
Allowed channel: mode=0 chan=14 freq=2484 MHz max_tx_power=20 dBm

我的 hostapd 配置文件如下所示:

# This is the name of the WiFi interface we configured above
interface=wlan1

# This is the name of the network
ssid=asdfasfd

# The network passphrase
wpa_passphrase=asdfasdf

# Use Settings that work for iOS / Android / Windows
driver=nl80211
logger_syslog=-1
logger_syslog_level=2
logger_stdout=-1
logger_stdout_level=2
country_code=FK

hw_mode=a
channel=54

#ieee80211n=1
#ht_capab=[HT40+]

beacon_int=100
dtim_period=2
max_num_sta=20
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wmm_enabled=1
wmm_ac_bk_cwmin=4
wmm_ac_bk_cwmax=10
wmm_ac_bk_aifs=7
wmm_ac_bk_txop_limit=0
wmm_ac_bk_acm=0
wmm_ac_be_aifs=3
wmm_ac_be_cwmin=4
wmm_ac_be_cwmax=10
wmm_ac_be_txop_limit=0
wmm_ac_be_acm=0
wmm_ac_vi_aifs=2
wmm_ac_vi_cwmin=3
wmm_ac_vi_cwmax=4
wmm_ac_vi_txop_limit=94
wmm_ac_vi_acm=0
wmm_ac_vo_aifs=2
wmm_ac_vo_cwmin=2
wmm_ac_vo_cwmax=3
wmm_ac_vo_txop_limit=47
wmm_ac_vo_acm=0
eapol_key_index_workaround=0
own_ip_addr=127.0.0.1

wpa=3
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP CCMP
rsn_pairwise=CCMP

我必须对我的 CRDA 配置做些什么才能通过 hostapd 获得剩余的 40 MHz BW 通道?谢谢。

linux networking
  • 1 个回答
  • 408 Views
Martin Hope
PhilBot
Asked: 2018-02-18 17:28:58 +0800 CST

Udev 规则可在 Linux 上识别 2 个相同的网络摄像头

  • 2

我的 Raspberry Pi 中插入了 2 个相同的网络摄像头。我想根据插入的 USB 端口辨别哪个相机是哪个相机。

这就是udev的目的,所以我写了如下规则:

SUBSYSTEM=="usb", KERNEL=="1-1.3", ATTR{idVendor}=="05a3", ATTR{idProduct}=="9422", SYMLINK+="klastle/vlvid"
SUBSYSTEM=="usb", KERNEL=="1-1.5", ATTR{idVendor}=="05a3", ATTR{idProduct}=="9422", SYMLINK+="klastle/irvid"

重新启动时会显示这些设备:

root@raspberrypi:~# ls -rlt /dev/klastle/
total 0
lrwxrwxrwx 1 root root 18 Feb 18 01:24 irvid -> ../bus/usb/001/007
lrwxrwxrwx 1 root root 18 Feb 18 01:24 vlvid -> ../bus/usb/001/005

问题是这些不是 linux ( V4L2 ) 设备的视频,我的应用程序无法打开它们。

如何正确编写规则以将实际的 /dev/video0 和 /dev/video1 符号链接到 /dev/klastle/irvid 和 /dev/klastle/vlvid?

谢谢。

更新:这是两个设备的 udevadm 查询输出:

root@raspberrypi:~# udevadm info --query=all --name=/dev/video3
P: /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.5/1-1.5:1.0/video4linux/video3
N: video3
S: v4l/by-id/usb-Sonix_Technology_Co.__Ltd._USB_2.0_Camera_SN0001-video-index1
S: v4l/by-path/platform-3f980000.usb-usb-0:1.5:1.0-video-index1
E: DEVLINKS=/dev/v4l/by-path/platform-3f980000.usb-usb-0:1.5:1.0-video-index1 /dev/v4l/by-id/usb-Sonix_Technology_Co.__Ltd._USB_2.0_Camera_SN0001-video-index1
E: DEVNAME=/dev/video3
E: DEVPATH=/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.5/1-1.5:1.0/video4linux/video3
E: ID_BUS=usb
E: ID_FOR_SEAT=video4linux-platform-3f980000_usb-usb-0_1_5_1_0
E: ID_MODEL=USB_2.0_Camera
E: ID_MODEL_ENC=USB\x202.0\x20Camera
E: ID_MODEL_ID=9422
E: ID_PATH=platform-3f980000.usb-usb-0:1.5:1.0
E: ID_PATH_TAG=platform-3f980000_usb-usb-0_1_5_1_0
E: ID_REVISION=0100
E: ID_SERIAL=Sonix_Technology_Co.__Ltd._USB_2.0_Camera_SN0001
E: ID_SERIAL_SHORT=SN0001
E: ID_TYPE=video
E: ID_USB_DRIVER=uvcvideo
E: ID_USB_INTERFACES=:0e0100:0e0200:010100:010200:
E: ID_USB_INTERFACE_NUM=00
E: ID_V4L_CAPABILITIES=:capture:
E: ID_V4L_PRODUCT=USB 2.0 Camera: H264 USB Camera
E: ID_V4L_VERSION=2
E: ID_VENDOR=Sonix_Technology_Co.__Ltd.
E: ID_VENDOR_ENC=Sonix\x20Technology\x20Co.\x2c\x20Ltd.
E: ID_VENDOR_ID=05a3
E: MAJOR=81
E: MINOR=3
E: SUBSYSTEM=video4linux
E: TAGS=:uaccess:seat:
E: USEC_INITIALIZED=3298533

root@raspberrypi:~# udevadm info --query=all --name=/dev/video0
P: /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.3/1-1.3:1.0/video4linux/video0
N: video0
S: v4l/by-id/usb-Sonix_Technology_Co.__Ltd._USB_2.0_Camera_SN0001-video-index0
S: v4l/by-path/platform-3f980000.usb-usb-0:1.3:1.0-video-index0
E: DEVLINKS=/dev/v4l/by-path/platform-3f980000.usb-usb-0:1.3:1.0-video-index0 /dev/v4l/by-id/usb-Sonix_Technology_Co.__Ltd._USB_2.0_Camera_SN0001-video-index0
E: DEVNAME=/dev/video0
E: DEVPATH=/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.3/1-1.3:1.0/video4linux/video0
E: ID_BUS=usb
E: ID_FOR_SEAT=video4linux-platform-3f980000_usb-usb-0_1_3_1_0
E: ID_MODEL=USB_2.0_Camera
E: ID_MODEL_ENC=USB\x202.0\x20Camera
E: ID_MODEL_ID=9422
E: ID_PATH=platform-3f980000.usb-usb-0:1.3:1.0
E: ID_PATH_TAG=platform-3f980000_usb-usb-0_1_3_1_0
E: ID_REVISION=0100
E: ID_SERIAL=Sonix_Technology_Co.__Ltd._USB_2.0_Camera_SN0001
E: ID_SERIAL_SHORT=SN0001
E: ID_TYPE=video
E: ID_USB_DRIVER=uvcvideo
E: ID_USB_INTERFACES=:0e0100:0e0200:010100:010200:
E: ID_USB_INTERFACE_NUM=00
E: ID_V4L_CAPABILITIES=:capture:
E: ID_V4L_PRODUCT=USB 2.0 Camera: H264 USB Camera
E: ID_V4L_VERSION=2
E: ID_VENDOR=Sonix_Technology_Co.__Ltd.
E: ID_VENDOR_ENC=Sonix\x20Technology\x20Co.\x2c\x20Ltd.
E: ID_VENDOR_ID=05a3
E: MAJOR=81
E: MINOR=0
E: SUBSYSTEM=video4linux
E: TAGS=:seat:uaccess:
E: USEC_INITIALIZED=3289947
linux udev
  • 2 个回答
  • 3801 Views
Martin Hope
PhilBot
Asked: 2018-01-05 16:31:27 +0800 CST

如何终止 Linux tee 命令而不杀死它正在接收的应用程序

  • 20

我有一个 bash 脚本,只要 Linux 机器开机就可以运行。我启动它如下所示:

( /mnt/apps/start.sh 2>&1 | tee /tmp/nginx/debug_log.log ) &

启动后,我可以在ps输出中看到 tee 命令,如下所示:

$ ps | grep tee
  418 root       0:02 tee /tmp/nginx/debug_log.log
3557 root       0:00 grep tee

我有一个函数可以监视tee生成的日志的大小,并在日志达到一定大小时终止tee命令:

monitor_debug_log_size() {
                ## Monitor the file size of the debug log to make sure it does not get too big
                while true; do
                                cecho r "CHECKING DEBUG LOG SIZE... "
                                debugLogSizeBytes=$(stat -c%s "/tmp/nginx/debug_log.log")
                                cecho r "DEBUG LOG SIZE: $debugLogSizeBytes"
                                if [ $((debugLogSizeBytes)) -gt 100000 ]; then
                                                cecho r "DEBUG LOG HAS GROWN TO LARGE... "
                                                sleep 3
                                                #rm -rf /tmp/nginx/debug_log.log 1>/dev/null 2>/dev/null
                                                kill -9 `pgrep -f tee`
                                fi
                                sleep 30
                done
}

令我惊讶的是,杀死tee命令也会被 start.sh 实例杀死。为什么是这样?如何结束tee命令但让我的 start.sh 继续运行?谢谢。

linux scripting
  • 2 个回答
  • 6192 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