我试图在DHCP数据包上设置DSCP位。尽管下面的内容对于udp很好,但是数据包总是用16的DSCP发送的。有什么想法吗?
iptables -t mangle -A FORWARD -p udp -j DSCP --set-dscp 1
iptables -t mangle -A OUTPUT -p udp -j DSCP --set-dscp 1
iptables -t mangle -A PREROUTING -p udp -j DSCP --set-dscp 1
iptables -t mangle -A POSTROUTING -p udp -j DSCP --set-dscp 1我正在使用dhclient -我也没有看到任何选项来设置它。
看起来像dhclient在这里硬编码,fyi:
void assemble_udp_ip_header (interface, buf, bufix,
from, to, port, data, len)
struct interface_info *interface;
unsigned char *buf;
unsigned *bufix;
u_int32_t from;
u_int32_t to;
u_int32_t port;
unsigned char *data;
unsigned len;
{
struct ip ip;
struct udphdr udp;
memset (&ip, 0, sizeof ip);
/* Fill out the IP header */
IP_V_SET (&ip, 4);
IP_HL_SET (&ip, 20);
ip.ip_tos = IPTOS_LOWDELAY;发布于 2016-03-31 18:51:59
我认为DHCP不能用iptables捕获,因为它使用绕过整个netfilter机制的原始套接字。有一些消息来源在这里报告了这一点:
http://louwrentius.com/why-filtering-dhcp-traffic-is-not-always-possible-with-iptables.html
https://serverfault.com/questions/297383/unable-to-block-dhcp-and-other-traffic-on-input-chain
https://stackoverflow.com/questions/36337793
复制相似问题