0

What would be the analogue of this iptables commad in ufw?

iptables -A OUTPUT ! -d 5.5.5.5 -j DROP

What is the analogue of exclamation mark in ufw? In other words, how to match all IP addresses excluding the specified one? Thanks!

3
  • For the record, it can be put in the way of iptables -A OUTPUT -d 5.5.5.5 -j ACCEPT; iptables -A OUTPUT -j DROP...
    – Tom Yan
    Oct 7, 2022 at 17:14
  • The negation of "allow" is "deny" and vice versa. Two rules as in the above comment.
    – harrymc
    Oct 7, 2022 at 17:48
  • @harrymc, Then how do I restrict outgoing connections to only one ip address using ufw if I don't want to block all outgoing connections by default? I have many network interfaces and I only one of them is network interface connected to the Internet (eth0). I want to deny all outgoing packets that is directed to any ip excluding 5.5.5.5 (for example) through eth0 interface. It means that outgoing traffic to any interface except eth0 is allowed. I would do it iptables -A OUTPUT ! -o eth0 -j ACCEPT, but it also requires using exclamation mark in iptables.
    – g00dds
    Oct 7, 2022 at 18:18

0

You must log in to answer this question.

Browse other questions tagged .