I'm trying to redirect a host to a specific link on my network when they try to browse through HTTP.
The IP address of the host I'm trying to redirect is 192.168.2.19
and my web-server is on 192.168.2.15:6969/test.js
. When I redirect the user I can only get him to 192.168.2.15:6969
and not the relative path. I tried specifying in the iptables
command but it did not work.
Here's what I did:
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 3000
iptables -t nat -A POSTROUTING -j MASQUERADE
iptables -t nat -A PREROUTING -s 192.168.2.19 -p tcp --dport 80 -j DNAT
--to-destination 192.168.2.15:3000/test.js