I am starting to get confused on how I can do this the more I look into this...
I prefer doing this with mac addresses, but I can't find a way online to make openwrt exclude multiple mac addresses
I don't mind doing this with ip addresses, but with ip tables it seems like you can only target the entire subnet.
I am so confused and I don't know where to start. I have so many tabs open rn
Edit: so, I took a step back and gave this another try, and I got it to work by just reading the link I provided above.
I am just not able to think when I feel overwhelmed and stuff, but I got it working now thankfully. Sorry for not getting it right away and asking for more help when the answer was right in front of my eyes.
(note to clarify: I would had preferred to use mac addresses, but ip addresses are fine)
iptables -t nat -A prerouting_lan_rule -p tcp --syn -m addrtype ! --dst-type LOCAL,BROADCAST -j test
iptables -t nat -N test
iptables -t nat -A test src_mac 00:11:22... ACCEPT
iptables -t nat -A test src_mac 00:AA:BB... ACCEPT
iptables -t nat -A test src_mac 00:BB:CC... ACCEPT
iptables -t nat -A test -j REDIRECT to port 9040
My syntax is not all correct, you'll need to verify it before deploying it.
I don't know if I need to install an iptables mod or which mod, or if I am supposed to replace src_mac with something else. I also don't know why would putting accept at the end prevent devices from going through the proxy
iptables -t nat -A PREROUTING -p tcp --syn -m addrtype --dst-type LOCAL,BROADCAST -j ACCEPT
iptables -t nat -N wdevs
iptables -t nat -A PREROUTING -m mac --mac-source 2c:f6:e8:f3:b6:ee -j ACCEPT
iptables -t nat -A PREROUTING -m mac --mac-source c4:cb:eb:29:32:c6 -j ACCEPT
iptables -t nat -A PREROUTING -m mac --mac-source e0:a5:d3:d4:37:9b -j ACCEPT
iptables -t nat -A PREROUTING -p tcp -j REDIRECT --to-ports 9040
I made this much progress but it doesn't seem to be working. All my traffic is going through tor now which is good, but the mac addresses are not being excluded. (also, "-a test" is invalid as you probably know, I wish it was valid but oh well). I wanted to try drop or reject just as a test to see if these commands are making an effect at all, but it was not compatible with the -t nat option. I guess I would have to try something different if I wanted to test it (if I need to)
I tried to remove -t nat from the lines that include the mac addresses, it made no effect
I also removed the exclamation point after addrtype, this was not letting me access luci.
I'll look at this again later or when I get a response
Note: These are not my mac addresses
Edit: I changed input to prerouting and it worked! let's go! My first two edits probably need to be deleted though, I don't mind that much if they aren't removed
Restore the default firewall tcp_int rule and remove everything else you've done so far.
I am guessing by this you mean to create a tcp_int rule that is just like the tor guide states
What is IFS? I don't understand this line. I am guessing this reads the file line, and.... I forgot the keyword. So basically it runs the same command until there's no more lines in the file
Is there an advantage for using this method instead of the one suggested by Trendy? Which one would you guess takes less power? Power usage is important for me since this is meant for a travel router that will rely on a powerbank.
The script is not working. I am not connected to tor on any of my devices now. All the outputs are below
# This file is interpreted as shell script.
# Put your custom iptables rules here, they will
# be executed with each firewall (re-)start.
# Internal uci firewall chains are flushed and recreated on reload, so
# put custom rules into the root chains e.g. INPUT or FORWARD or into the
# special user chains, e.g. input_wan_rule or postrouting_lan_rule.
while IFS= read -r macaddress
iptables -t nat -A prerouting_rule -m mac --mac-source "$macaddress" -p tcp --dport 9040 -j ACCEPT
done < "$maclist"