Self-Improvement

3) TCP/UDP와 Port 본문

네트워크/Essential

3) TCP/UDP와 Port

JoGeun 2018. 10. 20. 13:58

*TCP
 ex) telnet, FTP, ssh, SMTP, HTTP..

 연결형 기반 서비스
 상태 기반 서비스
 신뢰 기반 서비스

 ※3-way Handshake
 (connect)
 Server  <---------------------------  Client
                         Syn=M
             ---------------------------->
                ACK=M+1, SYN=N
            <-----------------------------
                        ACK=N+1

 ※4-way Handshake
 (disconnect)
 Server  <---------------------------  Client
                           FIN=M
               ---------------------------->
                  ACK=M+1, FIN=N 
               <---------------------------
                          ACK=N+1

*UDP
 ex) DNS, SNMP, NTP, DHCP, NFS..등
 
 비연결형 서비스
 비상태 서비스
 비신뢰 서비스

*TCP 패킷 확인 (Telnet)
 (linux)
 #wireshark &
 #telnet 192.168.92.201
 administrator
 soldesk1.
 dir
 exit

 ※3-way handshake과정

 
 ※TCP 헤더


*TCP 헤더
 1.Source Port (16bits)

 2.Destnation Port (16bits)

 3.Sequence Num (32bits)

 4.Ack Number (32bits)
 
 5.Header Length (4bits)

 6.TCP Control Flag (6bits)

 7.Window size (16bits)

 8.Checksum (16bits)

 9.Urgent Pointer (16bits)

 10.Options (최대 40bits)

*UDP 패킷 확인
 (linux200)
 #wireshark &
 #nslookup www.seoul.ac.kr
 
 ※UDP 헤더


*UDP 헤더
 1.Source Port (16bits)

 2.Destnation Port (16bits)

 3.Packet Total Length (16bits)

 4.Checksum (16bits)

*포트번호
 서비스를 구분하기위한 번호 2bytes

 (win2008)
 C:\Windows\system32\Drivers\etc\services


 (linux200)
 #cat /etc/services
 #netstat -antp
 #netstat -anup


*포트 종류
 1.Well-Known Ports
   =0 ~~ 1023
 
 2.Registered Ports
   =1024 ~~ 49151

 3.Dynamic, Priv (클라이언트 포트번호)
   =49152 ~~ 65535

#vi /etc/services의 주석으로 설명해놓은 부분


*대표적인 서비스 포트
 FTP date port     : TCP/20
 FTP control port : TCP/21
 SSH                     : TCP/22
 SCP                     : TCP/22
 SFTP                    : TCP/22
 telnet                  : TCP/23
 SMTP                   : TCP/25
 DNS name queries   : UDP/53
 DNS zone Transfers : TCP/53
 TFTP           : UDP/68
 HTTP          : TCP/80
 POP3          : TCP/110
 NetBIOS (TCP rarely used) : TCP/UDP/137
 NetBIOS      : UDP/138
 NetBIOS      : TCP/139
 IMAP4        : TCP/143
 HTTPS         : TCP/443
 RDP             : TCP/UDP/3389

*DB 리스너 포트
 MySQL         : TCP/3306
 MS-SQL        : TCP/1443
 Oracle          : TCP/1521
 PostgreSQL  : TCP/5432
 MariaDB       : TCP/3306
 DB2              : TCP/50090

'네트워크 > Essential' 카테고리의 다른 글

2) IPv4 Header, 주소체계, VLSM  (0) 2018.10.20
1) 네트워크 보안 및 기초 (wireshark 설치)  (0) 2018.10.20