port forwarding and translation in shell

Discussion in 'HyperWRT Firmware' started by kimz, Aug 13, 2004.

  1. kimz

    kimz Network Guru Member

    how can i forward and translate port 80 external to port 81 internal using iptables and the shell???

    please help me out on this one I really have to get this to work


  2. sune

    sune Network Guru Member

    In theory, I belive you could get away with something like this:

    usr/sbin/iptables -t nat -I PREROUTING -p tcp --dport 81 -j DNAT --to-destination
    usr/sbin/iptables -I FORWARD -d -p tcp --dport 80 -j ACCEPT
    (here is where your internal port 80 server is running)

    However it is probably a much better idea to make a standard port 80 forward using the webconfig and then replace the resulting PREROUTING rule with the modified port 81 translation above.


  3. puffer

    puffer Network Guru Member

    try this service and redirect before the request even gets to your router!

  4. kimz

    kimz Network Guru Member

    w000t! it works, I am so happy. Thanks a lot Sune!
  5. kimz

    kimz Network Guru Member

    i used the wrong example, for http this might work but i want the remote desktop port of my home pc (3389) be available on port 22 so I can reach it from my work (where port 3389 is blocked).

    with the help of Sune i solved it.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice