View unanswered posts    View active topics

All times are UTC - 6 hours





Post new topic Reply to topic  [ 6 posts ] 
Print view Previous topic   Next topic  
Author Message
Search for:
PostPosted: Fri May 09, 2008 6:14 am 
Offline
Joined: Sat May 26, 2007 9:51 pm
Posts: 130
Ok so I understand the general concept of NATs, ports, and port forwarding. I normally don't have a problem when I need to forward certain ports to my mythbox to enable communications to certain applications.

But I am a bit stuck on a general concept of port forwarding. Lets say I am surfing the web on a home computer, that is connected to my home network, via a router/modem. With that, no ports need to be set up manually port forwarding table. So which ports am I running on when doing general 'surfing'?

When I make a webpage request to a webserver (outgoing), it's likely port 80. But what about the incoming response? How does my router know which computer to forward the web response to? In other words, is there a way I can find out my "source port" the router uses for responses?


Top
 Profile  
 
PostPosted: Fri May 09, 2008 6:45 am 
Offline
Joined: Sun Aug 28, 2005 7:07 pm
Posts: 821
Location: Melbourne, Australia
tzoom84 wrote:
When I make a webpage request to a webserver (outgoing), it's likely port 80. But what about the incoming response? How does my router know which computer to forward the web response to? In other words, is there a way I can find out my "source port" the router uses for responses?


Well this *is* general. You should read a book on networking, but here's the gist. Outgoing packets of data (each clump of data is a packet) contains headers. Headers are information that isn't the actual stuff you're transmitting/receiving, but network equipment and computers use them. They contain information about the hardware, the ip addresses (incl any translations done). When, for example, a web get packet is transmitted through a router, the router adds its own info to the packet. The receiving packet also contains this information, which is used by the router to send the data to the originating machine.

NAT is exactly the same, except it usually changes the port number as well.

The port the data is received on is not port 80. Usually something high (34123, for example).

Install ethereal (its name changed recently and I can't remember it - ah! It's wireshark) and run it on eth0 for a while (less than a minute is usually enough: if you're on a big network, a second or two will probably give you a heap of data), and analyse the results.

Mike

_________________
*********************
LinHES 7.4
Australian Dragon
*********************


Top
 Profile  
 
PostPosted: Fri May 09, 2008 7:14 am 
Offline
Joined: Mon Jun 21, 2004 5:28 am
Posts: 700
Location: Germany
tzoom84 wrote:
When I make a webpage request to a webserver (outgoing), it's likely port 80. But what about the incoming response? How does my router know which computer to forward the web response to? In other words, is there a way I can find out my "source port" the router uses for responses?
When your computer sends a packet out through the NAT, the NAT will allocate an external port and create a dynamic "port forward" for the session so that return packets will get back to your computer. If two computers are both browsing, they will be allocated different external ports with different "port forwards". Actually, in practice, both computers will typically have several port forwards active.

There are lot's of tools to find out what the external port is on the NAT. For example http://www.ipchicken.com/ Note that the external port on the NAT will usually be different than the port your computer uses to receive return packets.

_________________
ASUS AT3N7A-I (Atom 330)
TBS 8922 PCI (DVB-S2)


Top
 Profile  
 
PostPosted: Fri May 09, 2008 8:29 am 
Offline
Joined: Thu Mar 02, 2006 5:42 pm
Posts: 410
Location: middleton wi usa atsc
tzoom84 wrote:
When I make a webpage request to a webserver (outgoing), it's likely port 80. But what about the incoming response? How does my router know which computer to forward the web response to?
That's the beauty of a firewall. It monitors the outgoing requests and allows responses to that request back in to your network to the requesting computer. All unsolicited incoming stuff is blocked. This behaviour makes a firewall fairly transparent to a user on the inside for most applications (there are some apps that are not firewall friendly, like FTP sometimes).

Even if you knew what port your surfing request was coming back on, you couldn't use that port to come in with other things because that would be blocked by the firewall. It only allows responses to individual requests.

So if you are outside of the network and want to get in, you either need to be invited by a direct request or have a port opened manually in the firewall setup. So if you are running a webserver on the inside that you want to access from the outside, you need to open port 80 on your firewall (and direct it to your web server if you are using NAT). Be advised that some ISPs block port 80 (and other popular ports) so you can't run a webserver on port 80 no mater what you do. My ISP is like that, so I have set Mythweb to listen on port 2200. I then open port 2200 in the firewall. As a result, when I want to surf to my myth box from the outside I have to use Http://mymythboxaddress.com:2200 as the web address. Actually I have to use the colon 2200 when accessing it from the inside as well.


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 09, 2008 8:01 pm 
Offline
Joined: Sat May 26, 2007 9:51 pm
Posts: 130
Once again, thanks everyone!

I was just a bit confused on where the port numbers actually get allocated. I was looking in my router logs and settings for any signs of the port mapping (other than the custom port forwarding). But I didn't find much.

Great idea on Ethereal. Been a while since I played with that but makes perfect sense for this type of stuff.


Top
 Profile  
 
PostPosted: Sat May 18, 2013 3:47 am 
Offline
Joined: Wed Dec 10, 2003 8:31 pm
Posts: 1996
Location: /dev/null
Dude, you've bumped a 5-year-old thread. These forums are not for general help about home security systems and cameras; they are for discussion about LinHES and its operation. None of your five posts to date are about this. If you continue to pollute these forums with this noise, your account will be revoked.

_________________
Retired KM user (R4 - R6.04); friend to LH users.


Top
 Profile  
 

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 


All times are UTC - 6 hours




Who is online

Users browsing this forum: No registered users and 20 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group

Theme Created By ceyhansuyu