snipt

Ctrl+h for KB shortcuts

Bash

Iptables map port 8080 to privileged port 80

sudo iptables -t nat -A PREROUTING -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 8080
sudo iptables -t nat -A OUTPUT -p tcp -m tcp -d $HOST --dport 80 -j REDIRECT --to-ports 8080
https://snippets.siftie.com/embed/d35d44e9e9b2cd48611ec5068f81015d/
/raw/d35d44e9e9b2cd48611ec5068f81015d/
d35d44e9e9b2cd48611ec5068f81015d
bash
Bash
2
2019-04-22T14:28:31
True
False
False
/api/public/snipt/17274/
map-port-8080-to-privileged-port-80
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>sudo iptables -t nat -A PREROUTING -p tcp -m tcp --dport <span class="m">80</span> -j REDIRECT --to-ports 8080 </span><span id="L-2"><a name="L-2"></a>sudo iptables -t nat -A OUTPUT -p tcp -m tcp -d <span class="nv">$HOST</span> --dport <span class="m">80</span> -j REDIRECT --to-ports 8080 </span></pre></div> </td></tr></table>
iptables, linux, nat