Whiskey and rants

Biased ideas about things

UFW - Redirect a port from one IP to another

12 April, 2018 | Linux

Redirect from source ( to destination ( on port 443 (HTTPS)


# Uncomment the next line to enable packet forwarding for IPv4


# Uncomment this to allow this host to route packets between interfaces


# add this before FILTER
*nat :PREROUTING ACCEPT [0:0] :POSTROUTING ACCEPT [0:0] -A PREROUTING -i eth0 -d -p tcp --dport 443 -j DNAT --to-destination -A POSTROUTING -p tcp -d --dport 443 -j SNAT --to-source COMMIT # end of NAT section
*filter :ufw-before-input - [0:0] ...

Flush the NAT table

iptables -t nat -L -v

Check the redirection

iptables -t nat -L