Hopefully after a year you have figured out your issue, however for the benefit of those that follow, the following is an explanation of at least 1 of your issues.
Based on the ipset
example you provided, your iptables
rules are invalid. The set type hash:mac
only stores a single field. However your iptables statement is testing the set as if it contains data pairs (i.e. two fields such as mac,IP or mac,net). As such you are matching entries within the set using the source MAC address of the packet and an undefined destination field from the packet:
ipset create throttled hash:mac -exist
ipset add throttled 00:11:22:33:44:55 -exist
iptables -A PREROUTING -t mangle -m set --match-set throttled src,dst -j MARK --set-mark 6
However due to the set type used, you can only match against a single field. The following iptables statement shows the correct method to match a source MAC address contained within the set:
ipset create throttled hash:mac -exist
ipset add throttled 00:11:22:33:44:55 -exist
iptables -A PREROUTING -t mangle -m set --match-set throttled src -j MARK --set-mark 6
To illustrate, consider if you had a set with the type of hash:net,port,net
on a firewall. The set would store triples (two networks and one port).
Let's assume the firewall has the following ipset entries and iptables rules:
# creates set
ipset create throttled hash:net,port,net
ipset add services 192.168.0.0/16,tcp:80,192.168.1.80/32
ipset add services 192.168.0.0/16,tcp:443,192.168.1.80/32
# clear all rules (to illustrate that conntrack is not being used)
iptables -F FORWARD
# allows traffic to web server
iptables -A FORWARD -m set --match-set services src,dst,dst -j ACCEPT
# allows traffic from web server
iptables -A FORWARD -m set --match-set services dst,src,src -j ACCEPT
# drop all other traffic
iptables -P DROP
The above rules are functionally equivalent to:
# clear all rules (to illustrate that conntrack is not being used)
iptables -F FORWARD
# allows traffic to web server
iptables -A FORWARD -s 192.168.0.0/16 -p tcp --dport 80 -d 192.168.1.80/32 -j ACCEPT
iptables -A FORWARD -s 192.168.0.0/16 -p tcp --dport 443 -d 192.168.1.80/32 -j ACCEPT
# allows traffic from web server
iptables -A FORWARD -d 192.168.0.0/16 -p tcp --sport 80 -s 192.168.1.80/32 -j ACCEPT
iptables -A FORWARD -d 192.168.0.0/16 -p tcp --sport 443 -s 192.168.1.80/32 -j ACCEPT
# drop all other traffic
iptables -P DROP
Though the two above methods are functionally equivalent, the ipset method will perform better with a large number of entries due to utilizing hash table lookups vs linear evaluations of the iptables rules.
When using sets, the set type dictates how many matching fields are used. The iptables statement specifies whether source or destination fields of the packets are used to match each field of the set.
The following are a few mappings to illustrate:
ipset type | iptables match-set | Packet fields
------------------+--------------------+---------------------------------
hash:net,port,net | src,dst,dst | src IP address, dst port, dst IP address
hash:net,port,net | dst,src,src | dst IP address, src port, src IP address
hash:ip,port,ip | src,dst,dst | src IP address, dst port, dst IP address
hash:ip,port,ip | dst,src,src | dst IP address, src port, src ip address
hash:mac | src | src mac address
hash:mac | dst | dst mac address
hash:ip,mac | src,src | src IP address, src mac address
hash:ip,mac | dst,dst | dst IP address, dst mac address
hash:ip,mac | dst,src | dst IP address, src mac address
You may have additional issues within your TC/iptables interaction, however this should at least resolve your ipset/iptables issue.