0

I'm trying to find out what port is used when my computer communicates with my router. Is it the same port as is used for the service I am using, e.g. 80 when I'm using HTTP, or is there a specific port for computer-router communication?

donotturnoff
  • 39
  • 1
  • 3
  • 3
    This question really doesn't make sense. If you try to specify precisely what you mean by "port", you'll see that there's no meaning of "port" that causes the question to make sense. At least, not that I could figure out. – David Schwartz Oct 02 '15 at 11:32
  • if you are looking at a webpage on the router (like the administative interface), then yes, you are likely creating a circuit between TCP\80 on the router to a TCP port > 1024 on the computer. That said, this is not guarenteed, as its entirely determined by the webserver implemented on the router. Many routers use SSH or Serial line protocols (SLPs) for administrative access. SSH usually uses TCP\22, though this may vary from router to router. The key point is that routers use lots of protocols, and their associated ports. it depends entirely on what client you are using to connect. – Frank Thomas Oct 02 '15 at 11:50
  • Sorry for the bad question; I'm new to networking. Thanks anyway – donotturnoff Oct 02 '15 at 13:29
  • 2
    I dunno, noob questions aren't _bad_ questions – u1686_grawity Oct 02 '15 at 15:55

2 Answers2

3

There isn't any.

Ports belong to transport layer protocols such as TCP and UDP, but normal routers don't interpret those – they work on Internet layer and carry IP packets based only on their IP address, regardless of their contents. (Just like the post office, which uses only what's written on the envelope, and doesn't look for addresses inside.)

For example, your computer wants to send a DNS query packet to 192.0.1.2, over UDP.

IPv4: source=1.0.0.1, dest=192.0.1.2,
 └ UDP: source_port=79846, dest_port=53,
    └ DNS: ...

It adds the corresponding link-layer header (Ethernet, 802.3, Wi-Fi):

Ethernet: source=[computer's MAC], dest=[your router's MAC], type=IPv4, ├ liiink layerrr
 └ IPv4: source=1.0.0.1, dest=192.0.1.2,                                ├ internet layer
    └ UDP: source_port=79846, dest_port=53,                             ├ transport l-r.
       └ DNS: ...                                                       ├ application l.

Your router then forwards the IP packet unchanged to the next router:

Ethernet: source=[this router's MAC], dest=[next router's MAC], type=IPv4,
 └ IPv4: source=1.0.0.1, dest=192.0.1.2,
    └ UDP: source_port=79846, dest_port=53,
       └ DNS: ...

And so on. There are no special ports – the only thing that changes between hops is the link-layer address (the MAC address for Ethernet and Wi-Fi).


This applies even to routers performing NAT (such as your home gateway). Although they do peek inside TCP/UDP and rewrite certain port numbers (usually the source port, not the destination port), they still don't change anything about the TCP ports being end-to-end. As far as your computer is concerned, this NAT process is invisible, therefore irrelevant to this question.


(Aside: Routers do understand TCP and UDP, and can accept & initiate TCP connections. If you send packets to the router's own IP address, then it will speak regular HTTP over TCP:80, SSH over TCP:22, and so on. They just don't do it when forwarding someone else's packets.)

u1686_grawity
  • 426,297
  • 64
  • 894
  • 966
  • While the answer is accurate in some ways, it's rather misleading. Most routers DO interpret TCP and UDP port numbers, both home routers and enterprise ones, though not always purely for routing purposes. NAT by definition requires it, as do most forms of ACLs. Not to mention most home routers act as a DNS server in and of itself, so you are practically always sending packets to the router's own IP. – qasdfdsaq Oct 02 '15 at 17:43
1

By the usual definition of "port" in this case, it refers specifically to the TCP destination port of the traffic, regardless of where in the path it is. This is 80. If you define "port" some other way, you may get some other answer for the computer-to-router communication. People use the word "port" to mean all sorts of things.

There isn't traffic from your computer to the router and also traffic from your computer to the web site. The very same packets your computer sends directly to the router are the ones that result in packets being sent to the web site. Whether you consider them the same packets or not is a matter of definition.

David Schwartz
  • 61,528
  • 7
  • 100
  • 149