Unanswered Question
Sep 14th, 2007

Hi all, I was reading up on tcp/ip, it says tcp is connection orientated and ip is connectionless, I thought that all packets that go over routers etc will always use tcp ? does this just mean that the initial connection over layer 3 (ip) is connectionless, then the packets are transferred by tcp which needs to set up the connection ?

I have this problem too.
0 votes
  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 3 (1 ratings)
paul.matthews Fri, 09/14/2007 - 02:18

IP Is L3 and connectionless, TCP Is L4 and connection oriented. Other L4 protocols are availabble (eg UDP) that are not connection oriented.

A router forwards packets at L3, and in its simplest form couldn't care less about connections, all it has is a packet to forward.

carl_townshend Fri, 09/14/2007 - 02:35

so do all packets have a tcp port value in them ? I thought that with tcp the connection has to be set up, I gather this happens after ip has got the packet to the destination, am i right ?


paul.matthews Fri, 09/14/2007 - 03:03

If using TCP, there will be a TCP Port, If using UDP there will be a UDP port. ICMP does not use ports.

To set up a conenction using TCP, three steps are involved.

I will assume a PC doing telnet.

First the PC sends a TCP sends a syn with a destination port of 23, and a source port of its choosing - typicallyy above 2048. I'll use 2069. I will also use "host" and "PC" instead of addresses.

So we get:

TCP-Syn DA - host, SA - PC , DP - 23, SP - 2069

(da - dest address, SA Source address, DP dest port, SP Source port)

Assuming the host is happy to accept the connection, it will respond:

TCP-SynAck DA - PC, SA - Host , DP - 2069, SP - 23

When the PC gets that, it acknowledges the SynAck to complete the three way handshake:

TCP-Ack DA - host, SA - PC , DP - 23, SP - 2069

At that point we have a connection. The router probably couldnt care less, normally all it is bothered about (assuming no access lists or QoS etc is:

IP DA - host, SA - PC

IP DA - PC, SA - Host

IP DA - host, SA - PC

so it will just forward them.

If the PC pings the host, all the router will care about is:

IP DA - host, SA - PC

IP DA - PC, SA - Host

Look familiar?

Where what is carried is:





This Discussion