I've set up a port triggering rule to listen for activity on port 5016 (arbitrary choice) and forward port 80 to port 80. As far as I'm aware, this has been set up correctly.

How can I activate the trigger with a terminal command? Do I really have to connect to something on that port? I feel like there must be a simpler method.

Everything I've read either glosses over this aspect of port forwarding, or suggests you use an IRC client and the associated ports to trigger the forward. It seems very silly to have to use an IRC client to do this though.


If you just need some activity to start the forward, you can simply "telnet <hostname> 5106" - that should have enough activity to trigger the rule. If you need the forwarding in place even without activity, you're better off using iptables or it's equivalent to set up the forwarding without the need for activity on 5106.

EDIT: Assuming your router is running a Red Hat based linux and you have a root terminal on it, you can do the following:

  1. edit /etc/sysctl.conf and change the line that says "net.ipv4.ip_forward = 0" to "net.ipv4.ip_forward = 1"
  2. run "sysctl -p" to activate that change
  3. To forward port 80 to ${otherhost} (port80), run the following commands:

    /sbin/iptables -t nat -A PREROUTING -p tcp -i eth0 -d ${localhost ip} --dport 80 -j DNAT --to ${otherhost}:80

    /sbin/iptables -A FORWARD -p tcp -i eth0 -d --dport 80 -j ACCEPT

  4. run "service iptables save" to make the forwarding persist across reboots

  • no luck! user~$ telnet 5016 Trying telnet: Unable to connect to remote host: Invalid argument – nona urbiz Feb 21 '11 at 20:12
  • missing the host: telnet hostnameOrIP 5106 – shellholic Feb 21 '11 at 20:18
  • I guess I didn't make my question clear enough. I don't want to have to actually telnet a server just to forward my port... it seems silly to have to communicate with a server just so that I can tell my router on to do something. – nona urbiz Feb 21 '11 at 21:40
  • Edited to make the hostname portion visible - I keep forgetting HTML does strange things with bare angle brackets. – John Feb 22 '11 at 19:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.