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

斯特兰格洛夫

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

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

第一个问题是,对于引导序列DHCP v4消息,isc-dhclient需要使用原始的以太网数据包套接字,该套接字在设计上绕过了Linux内核IP堆栈。因此,不能使用netfilter来分配IPv4 DSCP或元类,但现在暂时将其搁置一旁。

这是我的nftables配置的转储,与IP DSCP和元优先级的更改有关:me @ debox:〜$ sudo / usr / sbin / nft列表规则集

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计数器增加。但是,我注意到在捕获鲨鱼时遇到了问题(通过swich端口镜像完成):

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

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

斯特兰格洛夫

源问题是有关vlan接口的简单排序问题。我的网络接口持久性文件最初配置错误:

# WAN vlan 832 internet
auto enp1s0.832
iface enp1s0.832 inet dhcp
  up ip link set enp1s0.832 type vlan egress 0:0 1:0 2:0 3:0 4:0 5:0 6:6 7:0
iface enp1s0.832 inet6 dhcp
  up ip link set enp1s0.832 type vlan egress 0:0 1:0 2:0 3:0 4:0 5:0 6:6 7:0
  request_prefix 1
  accept_ra 2

不好的部分是“ up”指令。当初始ARP / DHCP / NDP已经发生时,出口映射为时已晚。修复非常简单,只需使用pre-up就足够了:

# WAN vlan 832 internet
auto enp1s0.832
iface enp1s0.832 inet dhcp
  pre-up ip link set enp1s0.832 type vlan egress 0:0 1:0 2:0 3:0 4:0 5:0 6:6 7:0
iface enp1s0.832 inet6 dhcp
  pre-up ip link set enp1s0.832 type vlan egress 0:0 1:0 2:0 3:0 4:0 5:0 6:6 7:0
  request_prefix 1
  accept_ra 2

这样,初始的ARP / DHCP / NDP握手就以正确的QoS优先级完成了。

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章