2

what can I use as automatic port forwarding on a Linux server ?

I am ONLY interested in something like upnp (so, stations with things like uTorrent can open a port automatically), this days any small router (like 10$ one) have this option and working, but I don't seem to find a solution on linux

I already tried miniupnpd, but unfortunately seems that is not fully configured under Ubuntu, installing and automatic configuration (dpkg-reconfigure minupnpd) don't work - the /etc/miniupnpd/miniupnpd.conf is not only NOT configured, but is ignored at all from the service start, and service refuse to start with errors that /etc/default/miniupnpd have missings

and even after ... hacking some (I edited /etc/init.d/miniupnpd and "guess" the proper syntax and the options for /etc/default/miniupnpd) I manage to start the service and got some rules (from the start) in firewall ... but rules never change when a station try to add something

starting it manual (with direct options or config file) don't do any kind of changes in firewall

that miniupnpd package is to such of undeveloped level that man/info miniupnpd don't cover all switches presented in miniupnpd -h

when I used a small router uTorrent had no problems to open ports via upnp (so, station side is working)

In conclusion (I already wrote a lot, you got the picture), I'm not fixed on miniupnpd but open to any suggestion as long as it would work generically with any kind of upnp applications (not just uTorrent)

Later Edit:

Strange, the only answer I get is for Linux based stations and NOT about uPnP, so, let me underline 2 points

  1. don't care what os station have, don't want to go on every station and implement "personal" programing, out there is something called uPnP which is doing just that ... OFFICIALLY ! (officially means that applications know about it, so, why reinventing wheel and do all by hand)
  2. every single litle (little means something the size of a 5 ports switch and with the cost of about 10-20$) router I put my hands on in the last years have uPnP in it , and what makes this lack of answer REALLY STRANGE is the fact that most of this routers (if not all of them) work on Linux, so WHY THERE IS NO SOLUTION ON A "NORMAL" LINUX SERVER ?
Pablo Bianchi
  • 14,308
  • 4
  • 74
  • 117
user40404
  • 306
  • 1
  • 3
  • 8
  • "port forwarding on a Linux server" -- that doesn't make sense. You forward ports on a router, not on the server. Please clarify what you're trying to do. – o9000 Oct 02 '15 at 21:08
  • The reason you get answers for Linux clients, and not windows clients, it because asking windows questions is considered off topic here. Windows questions should be asked on Super User http://superuser.com – Daniel Oct 05 '15 at 15:06

1 Answers1

0

You can use ssh for port forwarding. read the ssh man page by executing man ssh in Terminal.

Example:

ssh -f servername -L [bind_address:]port:host:hostport

-L [bind_address:]port:host:hostport

Specifies that the given port on the local (client) host is to be forwarded to the given host and port on the remote side. This works by allocating a socket to listen to port on the local side, optionally bound to the specified bind_address. Whenever a connection is made to this port, the connection is forwarded over the secure channel, and a connection is made to host port hostport from the remote machine. Port forwardings can also be specified in the configuration file. IPv6 addresses can be specified by enclosing the address in square brackets. Only the superuser can forward privileged ports. By default, the local port is bound in accordance with the GatewayPorts setting. However, an explicit bind_address may be used to bind the connection to a specific address. The bind_address of ``localhost'' indicates that the listening port be bound for local use only, while an empty address or `*' indicates that the port should be available from all interfaces.

Daniel
  • 3,400
  • 2
  • 22
  • 43
  • REALLY ?!? ... uTorrent and other apps from stations with windows, mac, android, etc. can AUTOMATICALLY OPEN ports via ssh ? I REALLY DOUBT THAT be cause, for example uTorrent DON'T KNOW SSH, and btw, can you POINT EXACTLY ON THE AUTOMATIC PART OF YOUR "SOLUTION" ? ... if is not automatic I can forward ports (REALLY FORWARD, not SSH CLIENTS ONLY) with iptables, don't you think ? ... thanks for interest ... anyway – user40404 Oct 02 '15 at 09:07
  • You can set up a script that runs both ssh and µTorrent at the same time, and run that script. Then in that same script, you can have it close the ssh tunnel when µTorrent closes. That way the ports are only open when you have µTorrent open. – Daniel Oct 02 '15 at 14:48
  • And just about every **nix based machine comes with ssh in the command line. – Daniel Oct 02 '15 at 14:48