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-249264

Strangelovian's questions

Martin Hope
Strangelovian
Asked: 2018-11-05 14:36:10 +0800 CST

已应用数据包元类,但捕获的 VLAN 优先级错误

  • 2

我的 linux 家用路由器位于我的 ISP(橙色)和我的家庭网络之间。在 WAN 端,Orange 在标记为 832 的 VLAN 中提供互联网。

某些控制消息(ARP、DHCP、ICMPv6“路由器发现”类型、DHCPv6)需要通过以下方式回复 Orange: - VLAN 优先级 = 6 - IPv4 或 IPv6 DSCP =“CS6”(6 位 0x30,或十进制表示法的 48)

第一个问题,对于引导序列 DHCP v4 消息,isc-dhclient 需要使用原始以太网数据包套接字,它通过设计绕过 linux 内核 IP 堆栈。所以不能使用 netfilter 来分配 IPv4 DSCP 或 Meta Class,但我们暂时将其搁置一旁。

这是我的 nftables 配置的转储,与 IP DSCP 和元优先级的更改相关:me@debox:~$ sudo /usr/sbin/nft list ruleset

table inet fltr46 {
    chain assign-orange-prio {
        ip version 4 udp sport { bootps, bootpc} ip dscp set cs6 meta priority set 0:6 counter packets 0 bytes 0 comment "isc-dhclient LPF socket bypass netfilter"
        icmpv6 type { nd-neighbor-solicit, nd-router-solicit} ip6 dscp set cs6 meta priority set 0:6 counter packets 8 bytes 480
        udp sport { dhcpv6-client, dhcpv6-server} ip6 dscp set cs6 meta priority set 0:6 counter packets 4 bytes 1180
    }

    chain postrouting {
        type filter hook postrouting priority 0; policy accept;
        oifname vmap { "enp1s0.832" : goto assign-orange-prio}
    }

    chain output {
        type filter hook output priority 0; policy accept;
        oifname vmap { "enp1s0.832" : goto assign-orange-prio }
    }
}
table arp arp4 {
    chain output {
        type filter hook output priority 0; policy accept;
        oifname ! "enp1s0.832" accept
        meta priority set 0:6 counter packets 851 bytes 35742
    }
}

我的vlan 832配置如下:

me@debox:~$ sudo cat /proc/net/vlan/enp1s0.832 
enp1s0.832  VID: 832     REORDER_HDR: 1  dev->priv_flags: 1001
Device: enp1s0
INGRESS priority mappings: 0:0  1:0  2:0  3:0  4:0  5:0  6:0 7:0
 EGRESS priority mappings: 6:6

这意味着,对于出口,6 类数据包 -> VLAN prio 6。

DHCPv6、ICMPv6“路由器”和 ARP 的 nftables 计数器按预期递增。但是,我注意到 wire shark 捕获中的问题(通过 swich 端口镜像完成):

  • DHCPv6:好的。DSCP = CS6 和 VLAN 优先级 = 6
  • ICMPv6:不行。DSCP = CS6 但 VLAN 优先级 = 0
  • ARP:不行。VLAN 优先级 = 0
  • 通过常规 UDP 套接字发送的 IPv4 DHCP 租约更新数据包也可以(DSCP + VLAN prio)。

VLAN 优先级未正确应用于 ARP 和 ICMPv6 数据包。对于 Linux 内核生成的 ARP 和 ICMPv6 消息,有没有办法进一步调试为什么元类不能正确转换为 VLAN prio?

vlan netfilter
  • 1 个回答
  • 304 Views
Martin Hope
Strangelovian
Asked: 2018-10-29 14:40:17 +0800 CST

Stretch apt 更新失败,镜像上缺少 InRelease 文件

  • 3

两个小时前我尝试手动更新软件包。我的镜像http://ftp.fr.debian.org/debian/dists/stretch/InRelease确实缺少 InRelease ,但 CDN 中也缺少一个http://deb.debian.org/debian/dists/stretch/在释放。

是否预计此 InRelease 文件会因拉伸而丢失?

me@stretch:~$ LANG=C sudo apt update
Err:1 http://ftp.fr.debian.org/debian stretch InRelease
  Temporary failure resolving 'ftp.fr.debian.org'
Err:2 http://security.debian.org/debian-security stretch/updates InRelease
  Temporary failure resolving 'security.debian.org'
Err:3 http://ftp.fr.debian.org/debian stretch-updates InRelease
  Temporary failure resolving 'ftp.fr.debian.org'
Reading package lists... Done
Building dependency tree       
Reading state information... Done
All packages are up to date.
W: Failed to fetch http://ftp.fr.debian.org/debian/dists/stretch/InRelease  Temporary failure resolving 'ftp.fr.debian.org'
W: Failed to fetch http://security.debian.org/debian-security/dists/stretch/updates/InRelease  Temporary failure resolving 'security.debian.org'
W: Failed to fetch http://ftp.fr.debian.org/debian/dists/stretch-updates/InRelease  Temporary failure resolving 'ftp.fr.debian.org'
W: Some index files failed to download. They have been ignored, or old ones used instead.

手动尝试 wget InRelease 文件(网络连接正常,如您所见):

me@stretch:~$ LANG=C wget http://deb.debian.org/debian/dists/stretch/InRelease
--2018-10-28 23:29:52--  http://deb.debian.org/debian/dists/stretch/InRelease
Resolving deb.debian.org (deb.debian.org)... 2001:67c:2564:a119::148:14, 2001:4f8:1:c::15, 2001:41c8:1000:21::21:4, ...
Connecting to deb.debian.org (deb.debian.org)|2001:67c:2564:a119::148:14|:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://cdn-fastly.deb.debian.org/debian/dists/stretch/InRelease [following]
--2018-10-28 23:29:52--  http://cdn-fastly.deb.debian.org/debian/dists/stretch/InRelease
Resolving cdn-fastly.deb.debian.org (cdn-fastly.deb.debian.org)... 2a04:4e42:1d::204, 151.101.120.204
Connecting to cdn-fastly.deb.debian.org (cdn-fastly.deb.debian.org)|2a04:4e42:1d::204|:80... connected.
HTTP request sent, awaiting response... 404 Not Found
2018-10-28 23:29:52 ERROR 404: Not Found.
debian
  • 3 个回答
  • 11565 Views
Martin Hope
Strangelovian
Asked: 2018-04-09 06:40:16 +0800 CST

netfilter TCP/UDP conntrack 与 ICMP / ICMPv6 相关的状态

  • 8

Netfilter 连接跟踪旨在将某些数据包识别为与 conntrack 条目“相关”。

我正在寻找有关 ICMP 和 ICMPv6 错误数据包的 TCP 和 UDP conntrack 条目的完整详细信息。

针对 IPv6 防火墙,RFC 4890 清楚地描述了不应丢弃的 ICMPv6 数据包

http://www.ietf.org/rfc/rfc4890.txt

4.3.1。不得丢弃的流量

对建立和维护通信至关重要的错误消息:

Destination Unreachable (Type 1) - All codes

Packet Too Big (Type 2)

Time Exceeded (Type 3) - Code 0 only

Parameter Problem (Type 4) - Codes 1 and 2 only

Appendix A.4 suggests some more specific checks that could be performed on Parameter Problem messages if a firewall has the

必要的数据包检测能力。

Connectivity checking messages:

Echo Request (Type 128)

Echo Response (Type 129)

For Teredo tunneling [RFC4380] to IPv6 nodes on the site to be possible, it is essential that the connectivity checking messages are

允许通过防火墙。IPv4 网络中的常见做法是在防火墙中丢弃 Echo Request 消息,以最大程度地降低对受保护网络进行扫描攻击的风险。如第 3.2 节所述,IPv6 网络中端口扫描的风险要小得多,因此没有必要过滤 IPv6 Echo Request 消息。

4.3.2. 通常不应丢弃的流量

第 4.3.1 节中列出的错误消息以外的错误消息:

Time Exceeded (Type 3) - Code 1
    Parameter Problem (Type 4) - Code 0

对于 linux 家用路由器,以下规则是否足以保护 WAN 接口,同时允许 RFC 4890 ICMPv6 数据包通过?(ip6tables-保存格式)

*filter
-A INPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT

附录:当然,NDP 和 DHCP-PD 需要其他规则:

-A INPUT -s fe80::/10 -d fe80::/10 -i wanif -p ipv6-icmp -j ACCEPT
-A INPUT -s fe80::/10 -d fe80::/10 -i wanif -p udp -m state --state NEW -m udp --sport 547 --dport 546 -j ACCEPT

换句话说,我可以安全地摆脱以下规则以遵守 RFC 4980,只保留“相关”规则吗?

-A INPUT -i wanif -p icmpv6 --icmpv6-type destination-unreachable -j ACCEPT
-A INPUT -i wanif -p icmpv6 --icmpv6-type packet-too-big -j ACCEPT
-A INPUT -i wanif -p icmpv6 --icmpv6-type ttl-exceeded -j ACCEPT
-A INPUT -i wanif -p icmpv6 --icmpv6-type parameter-problem -j ACCEPT
linux networking
  • 1 个回答
  • 1631 Views
Martin Hope
Strangelovian
Asked: 2018-03-23 23:15:48 +0800 CST

使用debian通过dhcp为ipv4和ipv6自动配置接口的正确方法是什么?

  • 1

我有一个运行 debian 9 拉伸(截至今天当前稳定)的家庭 brew 类似 PC 的路由器。

几个月来,我设法让它自动配置 WAN ipv4 和 WAN ipv6,如下所示:

# WAN vlan 832 internet
auto enp1s0.832
iface enp1s0.832 inet dhcp
iface enp1s0.832 inet6 manual

inet6 部分使用两个脚本:

  • 第一个 /etc/network/if-up.d/99-ipv6 脚本,用于以 IPV6 前缀委托模式启动 ISC dhcp 客户端
  • 第二个 /etc/dhcp/dhclient-exit-hooks.d/dhclient-ipv6 脚本,用于将 IPV6“/64”子网分配给 LAN 接口

这几个月都运行良好。重新启动时,系统迅速启动,IPV4 和 IPV6 都具有完整的功能。

在对软件包进行例行更新后,debian systemd“networking.service”开始在启动时挂起,同时配置路由器 WAN 接口。它挂了 5 分钟,并被默认的“network.service”超时杀死。结果,WAN 接口已启动,但 IPV4 和 IPV6-PD 的 dhclient 实例也被杀死。这很糟糕,因为如果 DHCP 客户端没有运行,路由器不会刷新 DCHP 租约。

debian networking.service 一直在配置 IPV6 部分。当我尝试这样评论 IPV6 部分时:

# WAN vlan 832 internet
auto enp1s0.832
iface enp1s0.832 inet dhcp

系统正常重启,但没有 IPV6。

我也尝试使用这样的“缓存”方式:

auto enp1s0.832
iface enp1s0.832 inet dhcp
iface enp1s0.832 inet6 dhcp
  request_prefix 1
  accept_ra 2

使用上述内容,Debian "networking.service" 为 IPV4 和 IPV6 启动 ISC DHCP 客户端实例: https ://wiki.debian.org/IPv6PrefixDelegation

但是,使用此设置,debian systemd networking.service 仍会挂起 5 分钟。

所以,我不得不求助于一个非常肮脏的最后手段:

auto enp1s0.832
iface enp1s0.832 inet dhcp
  up /sbin/dhclient -6 -P -pf /run/dhclient6.enp1s0.832.pid -lf /var/lib/dhcp/dhclient6.enp1s0.832.leases -df /var/lib/dhcp/dhclient.enp1s0.832.leases enp1s0.832&

这样,debian networking.service 不会超时,并且 IPV4 和 IPV6 的 dhclient 实例都可以正常运行。

什么是让 debian 自动配置 IPV4 和 IPV6 而不会挂起的干净方法?

debian
  • 1 个回答
  • 4999 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