0

As testing I want to redirect traffic from port 80 at a simply webserver with nc

If I run the follow command:

# iptables -t nat -A PREROUTING -p tcp --destination-port 80 -j REDIRECT --to-port 8081

# nc -l -p 8081

# echo  1 > /proc/sys/net/ipv4/ip_forward

I attend that all request http are shown in output in nc, right?

but the nc output is nothing, empty....

the version of iptables is v1.4.14 something wrong?

Stackuser
  • 140
  • 1
  • 12
  • From nc(1): "It is an error to use this option (-l) in conjunction with the -p, -s, or -z options." If I try to run nc as you show it, it refuses to run. What exactly are you trying to accomplish? – Dan Lowe Oct 16 '15 at 23:56
  • Now I'm using nc only for testing-purpose.... the objective is redirect the http request at another tool that I'm writing..... anyway, the help nc: # nc -h [v1.10-40] connect to somewhere: nc [-options] hostname port[s] [ports] ... listen for inbound: nc -l -p port [-options] [hostname] [port] the -l accepts also the -p...... as proof of this with nc localhost 8081 the client establishes the connection with server (nc -l -p 8081)..... – Stackuser Oct 17 '15 at 10:39

0 Answers0