1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

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

    TIA

    KimZ
     
  2. sune

    sune Network Guru Member

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

    Code:
    usr/sbin/iptables -t nat -I PREROUTING -p tcp --dport 81 -j DNAT --to-destination 192.168.1.50:80
    usr/sbin/iptables -I FORWARD -d 192.168.1.50 -p tcp --dport 80 -j ACCEPT
     
    (here 192.168.1.50 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.

    Cheers

    /Sune
     
  3. puffer

    puffer Network Guru Member

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

    https://www.dyndns.org/services/mywebhop/
     
  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.
     

Share This Page