Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

For example, my HTTP port 80 is opened and mapped by the router to port 42300 facing outwards.

Is there a way to identify , let's say my port 150 that is open for connection is mapped into what external port without accessing the router?

I understand that I would be able to set how the router map certain internal ports manually to the external ports that I want.

share|improve this question

2 Answers 2

Not easily, though you should reconsider how you visualise this. It is more helpful to visualise it the other way around, as we are looking at incoming connections - this is why this is referred to as port-forwarding:

Ports are opened on the router's public IP address and forwarded to an address and port of an internal resource.

So your router has port 42300 open and is listening on this port on its public IP, and will forward any incoming connections to port 80 on the internal server.

Your question is therefore better phrased as "How can I determine which port on my router gets forwarded to port 150 on my internal server". Because of the way this works, the connection needs to be initiated from an external source, to the public IP address on the right port.

As you don't know the right port, and cannot access the router to see what it is, then your only option is to try them all and see which one connects through.

You can use the nmap tool to do this.

share|improve this answer

See Paul's answer for an explanation of the concept port forwarding.

Unless you have somehow previously talked someone administering the router (it's owner?) into forwarding something to port 150 on your computer, and they neglected to inform you of which port they chose, the answer is very likely surprisingly simple: None of the ports on the router are forwarded to your computer.

(If this is not the case, you can find the open ports with nmap, as Paul suggested and then simply test all the candidates with the application you wish to use.)

In (what has recently become, to the annoyance of many) a common client setup, there is no need for ports on most computers to be accessible from the greater part of the Internet, and in many cases it would be an invitation for malware and hacking for operating systems with weak security mechanisms. Thus, the firewall was invented, which has since been superseded in some settings by NAT devices (often called "home routers").

NAT devices in principle let many computers access the Internet through it from a local network, but do not generally let traffic through in the opposite direction, unless a port is explicitly forwarded to a specific computer on the local network.

There is a finite number (iirc 2^16-1) of {tcp,udp} ports for a given IP address, so even if the firewall part of the router was unwanted it could not possibly open up every port on every computer on the local network (which in principle could be 2^24-1 devices for the 10.0.0.0/8 network) unless there is only a single connected computer. The default setting is virtually always to not forward any ports.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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