This document explains how to manage Host ACL rules through /dev/hostacl_ctl and how to verify rule hits through urllogger. It covers rule query/add/clear operations, optional IPSET integration, log field definitions, timestamp conversion, and a practical troubleshooting workflow.
Host ACL applies actions to connections based on hostname (host) matching.
- Control interface:
/dev/hostacl_ctl - URL logger switch:
/proc/sys/urllogger_store/enable - URL logger queue:
/dev/urllogger_queue
If URL logger is disabled, ACL-related observations are limited. Enable logger first when troubleshooting.
Each rule is represented as: <id>,<act>,<host>
id: Rule slot index, range0~31act: Action type, range0~30=record1=drop2=reset3=redirect
host: Hostname to match (for example:baidu.com)
You can append multiple hosts under the same id.
cat /dev/hostacl_ctl# Usage:
# clear -- clear all existing acl rule(s)
# add acl=<id>,<act>,<host> --add one rule
# IPSET format: host_acl_rule<id>_<fml>
# <fml>=ipv4/ipv6/mac
#
ACL0=
ACL1=
...
ACL31=
If ACLx= is empty, that slot currently has no rule.
echo add acl=<id>,<act>,<host> >/dev/hostacl_ctlAdd baidu.com into ACL slot 0 with action reset(2):
echo add acl=0,2,baidu.com >/dev/hostacl_ctlAppend additional hosts to ACL0:
echo add acl=0,2,qq.com >/dev/hostacl_ctl
echo add acl=0,2,sina.com >/dev/hostacl_ctlecho clear >/dev/hostacl_ctlThis removes all ACL rules. Confirm before running in production.
If an IPSET with the expected naming convention exists, ACL checks that IPSET before applying the configured action after host match.
Naming convention:
host_acl_rule<id>_<fml>
Where:
<id>: ACL rule ID (0~31)<fml>:ipv4/ipv6/mac
ipset create host_acl_rule0_ipv4 hash:net family inet
ipset add host_acl_rule0_ipv4 192.168.15.100
ipset add host_acl_rule0_ipv4 192.168.15.101ipset create host_acl_rule0_ipv6 hash:net family inet6
ipset add host_acl_rule0_ipv6 2400::123ipset create host_acl_rule0_mac hash:mac
ipset add host_acl_rule0_mac 11:22:33:aa:bb:ccURL logging should be enabled for ACL verification and debugging:
echo 1 >/proc/sys/urllogger_store/enableVerify current status:
cat /proc/sys/urllogger_store/enablecat /dev/urllogger_queuetimestamp,mac,sip,sport,dip,dport,hits,method,type,acl_idx,acl_action,url
timestamp: Uptime-based seconds (not Unix epoch)mac: Source MAC addresssip/sport: Source IP / source portdip/dport: Destination IP / destination porthits: Hit countmethod: HTTP method (NONEfor non-HTTP traffic)type: Traffic type (for exampleHTTP,SSL)acl_idx: Matched ACL rule IDacl_action: Executed ACL action codeurl: Parsed URL / host
acl_idx=64means no ACL rule matched.
15682,74:8F:AA:BB:BE:CD,192.168.16.101,61938,129.226.103.123,443,1,NONE,SSL,64,0,otheve.beacon.qq.com
15684,74:8F:AA:BB:BE:CD,fd57:538a:7ca5:0000:18c5:8212:7bc2:086f,61940,240e:097c:002f:0002:0000:0000:0000:005c,443,1,NONE,SSL,64,0,tpstelemetry.tencent.com
15693,74:8F:AA:BB:BE:CD,192.168.16.101,61957,8.8.8.8,443,4,NONE,SSL,64,0,dns.google
15694,74:8F:AA:BB:BE:CD,fd57:538a:7ca5:0000:18c5:8212:7bc2:086f,61963,2402:4e00:0036:2fff:0000:0000:0000:008a,443,1,NONE,SSL,64,0,cube.weixinbridge.com
15694,74:8F:AA:BB:BE:CD,fd57:538a:7ca5:0000:18c5:8212:7bc2:086f,61964,2402:4e00:1020:262a:0000:9966:18c7:41fe,443,1,NONE,SSL,64,0,doc.weixin.qq.com
15694,74:8F:AA:BB:BE:CD,fd57:538a:7ca5:0000:18c5:8212:7bc2:086f,61965,240e:097c:002f:0001:0000:0000:0000:006e,443,1,NONE,SSL,64,0,aegis.qq.com
15698,74:8F:AA:BB:BE:CD,192.168.16.101,61968,18.182.251.125,443,1,NONE,SSL,64,0,fx-webws.gateio.live
15701,74:8F:AA:BB:BE:CD,192.168.16.101,61970,113.240.75.249,443,1,NONE,SSL,64,0,tpstelemetry.tencent.com
15720,24:0A:AA:CC:8D:4E,192.168.16.224,53230,185.125.190.96,80,1,GET,HTTP,64,0,connectivity-check.ubuntu.com/
timestamp is based on system uptime seconds. Use the following shell snippet to convert it into wall-clock time:
# Example: time=timestamp from log
time=15682
UP=$(cat /proc/uptime | cut -d. -f1)
UP=$((UP & 0xffffffff))
NOW=$(date +%s)
T=$((NOW + time - UP))
date "+%Y-%m-%d %H:%M:%S" -d "@$T"- Run
cat /proc/sys/urllogger_store/enableand confirm it is1. - Run
cat /dev/hostacl_ctland verifyid/act/hostvalues are expected. - If using IPSET, verify exact set naming:
host_acl_rule<id>_<fml>. - Run
cat /dev/urllogger_queueand check whether target host appears. - If
acl_idxremains64, focus on host spelling, traffic type, and slot/action configuration.