Ir para o conteúdo
  • Revista PROGRAMAR: Já está disponível a edição #60 da revista programar. Faz já o download aqui!


TCP/IP Basics

Mensagens Recomendadas


os créditos não são meus, apesar de obviamente postar por endender o assunto e achar que está fixe e não seria preciso criar um ou traduzir (não busco créditos, apenas que a info seja passada  :D )

The TCP/IP Basics

Chapter 1 -- A glance at TCP/IP or (Uh, what's a packet?)

In this series we will explore the wonders of the protocol that made the internet what it is today. It will start from the basics and theory and lead to practical applications of this knowledge. Some of the things discussed later may *NOT* be legal in your locale, please check your local computer crime laws. (Or do them at home.)

Starting at the beginning we can understand TCP/IP by understanding the parts that make it up. The following Diagram will show the building blocks of networking and how they fit together.

--------- --------- ---------

| SNMP | | Telnet| | FTP | <--- Application Layer

--------- --------- ---------

--------- ---------

| UDP | | TCP | <--- Transport Layer

--------- ---------

--------- ---------

| ICMP | | IP | <--- Network Layer

--------- ---------

--------- --------- --------- ---------

| ARP | | RARP | | Ether | | PPP | <--- Link Layer

--------- --------- --------- ---------

As you can see, with one block on top of another, there is more than just TCP/IP networking. As our focus is on TCP/IP though the following explanation will focus solely on the anatomy of a TCP/IP packet. The link layer adds the source and destination mac addresses to the packet. The network layer adds the source and destination IP addresses. The transport layer adds the source and destination port numbers. At this point there is a pseudo layer called the session layer that adds the data to the packet, although one might argue this is also a function of the transport layer as well. The application layer is exactly that, the application that is passing the packets. The following diagram may help pull this together.



*(Link Layer) *

* =============================================================*

* =(Network Layer) =*

* = ++++++++++++++++++++++++++++++++++++++++++++++++++++=*

* = +(Transport Layer) +=*

*Source =Source + Source ----------------------------------------- +=*

*Mac =IP + Port - Data - +=*

*Dest =Dest + Dest - - +=*

*Mac =IP + Port ----------------------------------------- +=*

* = + +=*

* = ++++++++++++++++++++++++++++++++++++++++++++++++++++=*

* = =*

* =============================================================*

* *


Tearing this down further brings us to the TCP portion of this text. The TCP header is broken down into ten sections, they are as follows: source port number, destination port number, sequence number, acknowledgement number, header length, reserved, flags, windows size, TCP checksum and urgent pointer. Let's look first at flags. Flags are set based on what the packet is trying to accomplish. The six flags are as follows:

URG <-- Urgent Flag

ACK <-- Acknowledgment number is valid

PSH <-- Push this data on as soon as possible

RST <-- Reset the connection

SYN <-- Synchronize sequence numbers to establish a connection

FIN <-- Sender is finished sending data

This brings us to the TCP three way handshake for making connections. This is the way all TCP connections are made.

--------- ---------

|HOST A | 1. Syn |HOST B |

| | ---------------------> | |

| | | |

| | 2. Syn/Ack | |

| | <-------------------- | |

| | | |

| | 3. Ack | |

| | ---------------------> | |

| | | |

--------- ---------

1. Host A initiates a connection to Host B and says, (SYN)chronize your TCP sequence with me.

2. Host B responds back and says, I've (ACK)nowleged your request, (SYN)chronize your TCP sequence with me.

3. Host A responds, I (ACK)nowledge your request, let's start talking.

With this basic understanding you can learn why some denial of service attacks work, what use they might have, the TCP sequence prediction vulnerabilities, and port scanning.


Partilhar esta mensagem

Ligação para a mensagem
Partilhar noutros sites

Crie uma conta ou ligue-se para comentar

Só membros podem comentar

Criar nova conta

Registe para ter uma conta na nossa comunidade. É fácil!

Registar nova conta


Já tem conta? Inicie sessão aqui.

Entrar Agora


Aviso Sobre Cookies

Ao usar este site você aceita os nossos Termos de Uso e Política de Privacidade. Este site usa cookies para disponibilizar funcionalidades personalizadas. Para mais informações visite esta página.