0

I could enable NAT using UFW with following configuration.

*nat
:POSTROUTING ACCEPT [0:0]
-A POSTROUTING -s 192.168.141.0/24 -o ens192 -j MASQUERADE
COMMIT

If I want to enable TCPMSS, I have to run the following command manually.

 iptables -I FORWARD -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu 

How can I set this in UFW configuration?

1 Answer 1

0

It worked as expected with the following configuration.

Add the following line in /etc/ufw/after.rules just before the final COMMIT line.

-A ufw-after-forward -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu

example:

# Don't delete these required lines, otherwise there will be errors
*filter
:ufw-after-input - [0:0]
:ufw-after-output - [0:0]
:ufw-after-forward - [0:0]
# End required lines

# don't log noisy services by default
-A ufw-after-input -p udp --dport 137 -j ufw-skip-to-policy-input
-A ufw-after-input -p udp --dport 138 -j ufw-skip-to-policy-input
-A ufw-after-input -p tcp --dport 139 -j ufw-skip-to-policy-input
-A ufw-after-input -p tcp --dport 445 -j ufw-skip-to-policy-input
-A ufw-after-input -p udp --dport 67 -j ufw-skip-to-policy-input
-A ufw-after-input -p udp --dport 68 -j ufw-skip-to-policy-input

# don't log noisy broadcast
-A ufw-after-input -m addrtype --dst-type BROADCAST -j ufw-skip-to-policy-input

# TCPMSS rule
-A ufw-after-forward -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu

# don't delete the 'COMMIT' line or these rules won't be processed
COMMIT

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .