Score:0

ufw - how can i add custom rules in iptables-save syntax correctly?

cd flag

So when i do

iptables -A ufw-user-forward -s 172.0.0.0/8 -d 10.0.0.0/24 -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A ufw-user-forward -s 172.0.0.0/8 -d 10.0.0.0/24 -j DROP

one by one in terminal, it works but when i add it to after.rules like so:

*filter
-A ufw-user-forward -s 172.0.0.0/8 -d 10.0.0.0/24 -m state --state RELATED,ESTABLISHED -j ACCEPT
-A ufw-user-forward -s 172.0.0.0/8 -d 10.0.0.0/24 -j DROP
COMMIT

it doesnt

I already tried starting the rule including chain like so:

*filter
:ufw-user-forward - [0:0]
....

but no luck, any idea on how can i get this to work? i dont think those rules are added to iptables at all either when i add them to after.rules file

cn flag
After adding those rules to the `after.rules`, do you re-run `ufw` to load those rules?
Roki avatar
cd flag
Yes, i tried both `ufw reload` and `sudo systemctl restart ufw`, tried rebooting aswell, but for some reason it just doesn't work
cn flag
Anything in the logs? Also may be in the journal (`journalctl -u ufw` and go to the end)
Roki avatar
cd flag
Besides start/stop logs, nothing
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.