网络运维之计算机端口

Posted jks212454

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了网络运维之计算机端口相关的知识,希望对你有一定的参考价值。

一、计算机端口介绍

1.定义

端口定义:软件领域的端口一般指网络中面向连接服务和无连接服务的通信协议端口,是一种抽象的软件结构,包括一些数据结构和I/O(基本输入输出)缓冲区。

2.端口理解

计算机“端口”是英文port的义译,可以认为是计算机与外界通讯交流的出口.分软件端口和硬件端口。

3.端口分类

①第一类
公认端口(Well Known Ports):从0到1023,它们紧密绑定(binding)于一些服务。通常这些端口的通讯明确表明了某种服务的协议,例如:80端口实际上总是HTTP通讯。
②第二类
注册端口(Registered Ports):从1024到49151。它们松散地绑定于一些服务。也就是说有许多服务绑定于这些端口,这些端口同样用于许多其它目的。例如:许多系统处理动态端口从1024左右开始。
③第三类
动态和/或私有端口(Dynamic and/or Private Ports):从49152到65535。理论上,不应为服务分配这些端口。实际上,机器通常从1024起分配动态端口。但也有例外:SUN的RPC端口从32768开始。

二、传输层TCP/UDP

1.TCP/UDP解释

TCP:TCP协议全称是传输控制协议是一种面向连接的、可靠的、基于字节流的传输层通信协议。
UDP:UDP协议全称是用户数据报协议,在网络中它与TCP协议一样用于处理数据包,是一种无连接的协议。

2.TCP连接的三次握手

第一次握手:客户端向服务端发送连接请求报文段。该报文段中包含自身的数据通讯初始序号。请求发送后,客户端便进入 SYN-SENT 状态。
第二次握手:服务端收到连接请求报文段后,如果同意连接,则会发送一个应答,该应答中也会包含自身的数据通讯初始序号,发送完成后便进入 SYN-RECEIVED 状态。
第三次握手:当客户端收到连接同意的应答后,还要向服务端发送一个确认报文。客户端发完这个报文段后便进入 ESTABLISHED 状态,服务端收到这个应答后也进入 ESTABLISHED 状态,此时连接建立成功。

3.TCP/UDP应用

TCP:
①FTP:文件传输协议;
②SSH:安全登录、文件传送(SCP)和端口重定向;
③Telnet:不安全的文本传送;
④SMTP:简单邮件传输协议Simple Mail Transfer Protocol (E-mail);
⑤HTTP:超文本传送协议 (WWW);

UDP:
①流媒体
②TFTP
③QQ 文件传输、QQ语音、QQ视频

三、常用的默认端口合集

在这里插入图片描述

四、Linux全部端口查询

[root@tianyi ~]# cat -n /etc/services
 23	tcpmux          1/tcp                           # TCP port service multiplexer
    24	tcpmux          1/udp                           # TCP port service multiplexer
    25	rje             5/tcp                           # Remote Job Entry
    26	rje             5/udp                           # Remote Job Entry
    27	echo            7/tcp
    28	echo            7/udp
    29	discard         9/tcp           sink null
    30	discard         9/udp           sink null
    31	systat          11/tcp          users
    32	systat          11/udp          users
    33	daytime         13/tcp
    34	daytime         13/udp
    35	qotd            17/tcp          quote
    36	qotd            17/udp          quote
    37	chargen         19/tcp          ttytst source
    38	chargen         19/udp          ttytst source
    39	ftp-data        20/tcp
    40	ftp-data        20/udp
    41	# 21 is registered to ftp, but also used by fsp
    42	ftp             21/tcp
    43	ftp             21/udp          fsp fspd
    44	ssh             22/tcp                          # The Secure Shell (SSH) Protocol
    45	ssh             22/udp                          # The Secure Shell (SSH) Protocol
    46	telnet          23/tcp
    47	telnet          23/udp
    48	# 24 - private mail system
    49	lmtp            24/tcp                          # LMTP Mail Delivery
    50	lmtp            24/udp                          # LMTP Mail Delivery
    51	smtp            25/tcp          mail
    52	smtp            25/udp          mail
    53	time            37/tcp          timserver
    54	time            37/udp          timserver
    55	rlp             39/tcp          resource        # resource location
    56	rlp             39/udp          resource        # resource location
    57	nameserver      42/tcp          name            # IEN 116
    58	nameserver      42/udp          name            # IEN 116
    59	nicname         43/tcp          whois
    60	nicname         43/udp          whois
    61	tacacs          49/tcp                          # Login Host Protocol (TACACS)
    62	tacacs          49/udp                          # Login Host Protocol (TACACS)
    63	re-mail-ck      50/tcp                          # Remote Mail Checking Protocol
    64	re-mail-ck      50/udp                          # Remote Mail Checking Protocol
    65	domain          53/tcp                          # name-domain server
    66	domain          53/udp
    67	whois++         63/tcp          whoispp
    68	whois++         63/udp          whoispp
    69	bootps          67/tcp                          # BOOTP server
    70	bootps          67/udp
    71	bootpc          68/tcp          dhcpc           # BOOTP client
    72	bootpc          68/udp          dhcpc
    73	tftp            69/tcp
    74	tftp            69/udp
    75	gopher          70/tcp                          # Internet Gopher
    76	gopher          70/udp
    77	netrjs-1        71/tcp                          # Remote Job Service
    78	netrjs-1        71/udp                          # Remote Job Service
    79	netrjs-2        72/tcp                          # Remote Job Service
    80	netrjs-2        72/udp                          # Remote Job Service
    81	netrjs-3        73/tcp                          # Remote Job Service
    82	netrjs-3        73/udp                          # Remote Job Service
    83	netrjs-4        74/tcp                          # Remote Job Service
    84	netrjs-4        74/udp                          # Remote Job Service
 85	finger          79/tcp
    86	finger          79/udp
    87	http            80/tcp          www www-http    # WorldWideWeb HTTP
    88	http            80/udp          www www-http    # HyperText Transfer Protocol
    89	http            80/sctp                         # HyperText Transfer Protocol
    90	kerberos        88/tcp          kerberos5 krb5  # Kerberos v5
    91	kerberos        88/udp          kerberos5 krb5  # Kerberos v5
    92	supdup          95/tcp
    93	supdup          95/udp
    94	hostname        101/tcp         hostnames       # usually from sri-nic
    95	hostname        101/udp         hostnames       # usually from sri-nic
    96	iso-tsap        102/tcp         tsap            # part of ISODE.
    97	csnet-ns        105/tcp         cso             # also used by CSO name server
    98	csnet-ns        105/udp         cso
    99	# unfortunately the poppassd (Eudora) uses a port which has already
   100	# been assigned to a different service. We list the poppassd as an
   101	# alias here. This should work for programs asking for this service.
   102	# (due to a bug in inetd the 3com-tsmux line is disabled)
   103	#3com-tsmux     106/tcp         poppassd
   104	#3com-tsmux     106/udp         poppassd
   105	rtelnet         107/tcp                         # Remote Telnet
   106	rtelnet         107/udp
   107	pop2            109/tcp         pop-2 postoffice        # POP version 2
   108	pop2            109/udp         pop-2
   109	pop3            110/tcp         pop-3           # POP version 3
   110	pop3            110/udp         pop-3
   111	sunrpc          111/tcp         portmapper rpcbind      # RPC 4.0 portmapper TCP
   112	sunrpc          111/udp         portmapper rpcbind      # RPC 4.0 portmapper UDP
   113	auth            113/tcp         authentication tap ident
   114	auth            113/udp         authentication tap ident
   115	sftp            115/tcp
   116	sftp            115/udp
   117	uucp-path       117/tcp
   118	uucp-path       117/udp
   119	nntp            119/tcp         readnews untp   # USENET News Transfer Protocol
   120	nntp            119/udp         readnews untp   # USENET News Transfer Protocol
   121	ntp             123/tcp
   122	ntp             123/udp                         # Network Time Protocol
   123	netbios-ns      137/tcp                         # NETBIOS Name Service
   124	netbios-ns      137/udp
   125	netbios-dgm     138/tcp                         # NETBIOS Datagram Service
   126	netbios-dgm     138/udp
   127	netbios-ssn     139/tcp                         # NETBIOS session service
   128	netbios-ssn     139/udp
   129	imap            143/tcp         imap2           # Interim Mail Access Proto v2
   130	imap            143/udp         imap2
   131	snmp            161/tcp                         # Simple Net Mgmt Proto
   132	snmp            161/udp                         # Simple Net Mgmt Proto
   133	snmptrap        162/tcp                         # SNMPTRAP
   134	snmptrap        162/udp         snmp-trap       # Traps for SNMP
   135	cmip-man        163/tcp                         # ISO mgmt over IP (CMOT)
   136	cmip-man        163/udp
   137	cmip-agent      164/tcp
   138	cmip-agent      164/udp
   139	mailq           174/tcp                         # MAILQ
   140	mailq           174/udp                         # MAILQ
   141	xdmcp           177/tcp                         # X Display Mgr. Control Proto
   142	xdmcp           177/udp
   143	nextstep        178/tcp         NeXTStep NextStep       # NeXTStep window
   144	nextstep        178/udp         NeXTStep NextStep       # server
   145	bgp             179/tcp                         # Border Gateway Proto.
   146	bgp             179/udp
   147	bgp             179/sctp
   148	prospero        191/tcp                         # Cliff Neuman's Prospero
   149	prospero        191/udp
   150	irc             194/tcp                         # Internet Relay Chat
   151	irc             194/udp
   152	smux            199/tcp                         # SNMP Unix Multiplexer
   153	smux            199/udp
   154	at-rtmp         201/tcp                         # AppleTalk routing
   155	at-rtmp         201/udp
   156	at-nbp          202/tcp                         # AppleTalk name binding
   157	at-nbp          202/udp
   158	at-echo         204/tcp                         # AppleTalk echo
   159	at-echo         204/udp
   160	at-zis          206/tcp                         # AppleTalk zone information
   161	at-zis          206/udp
   162	qmtp            209/tcp                         # Quick Mail Transfer Protocol
   163	qmtp            209/udp                         # Quick Mail Transfer Protocol
   164	z39.50          210/tcp         z3950 z39-50 wais      # NISO Z39.50 database
   165	z39.50          210/udp         z3950 z39-50 wais
   166	ipx             213/tcp                         # IPX
   167	ipx             213/udp
   168	imap3           220/tcp                         # Interactive Mail Access
   169	imap3           220/udp                         # Protocol v3
   170	link            245/tcp         ttylink
   171	link            245/udp         ttylink
   172	gist            270/udp                         # Q-mode encapsulation for GIST messages
   173	fatserv         347/tcp                         # Fatmen Server
   174	fatserv         347/udp                         # Fatmen Server
   175	rsvp_tunnel     363/tcp         rsvp-tunnel
   176	rsvp_tunnel     363/udp         rsvp-tunnel
   177	odmr            366/tcp                         # odmr required by fetchmail
   178	odmr            366/udp                         # odmr required by fetchmail
   179	rpc2portmap     369/tcp
   180	rpc2portmap     369/udp                         # Coda portmapper
   181	codaauth2       370/tcp
   182	codaauth2       370/udp                         # Coda authentication server
   183	ulistproc       372/tcp         ulistserv       # UNIX Listserv
   184	ulistproc       372/udp         ulistserv
   185	ldap            389/tcp
   186	ldap            389/udp
   187	osb-sd          400/tcp                         # Oracle Secure Backup
   188	osb-sd          400/udp                         # Oracle Secure Backup
   189	svrloc          427/tcp                         # Server Location
   190	svrloc          427/udp                         # Server Location
   191	mobileip-agent  434/tcp
   192	mobileip-agent  434/udp
   193	mobilip-mn      435/tcp
   194	mobilip-mn      435/udp
   195	https           443/tcp                         # http protocol over TLS/SSL
196	https           443/udp                         # http protocol over TLS/SSL
   197	https           443/sctp                        # http protocol over TLS/SSL
   198	snpp            444/tcp                         # Simple Network Paging Protocol
   199	snpp            444/udp                         # Simple Network Paging Protocol
   200	microsoft-ds    445/tcp
   201	microsoft-ds    445/udp
   202	kpasswd         464/tcp         kpwd            # Kerberos "passwd"
   203	kpasswd         464/udp         kpwd            # Kerberos "passwd"
   204	photuris        468/tcp
   205	photuris        468/udp
   206	saft            487/tcp                         # Simple Asynchronous File Transfer
   207	saft            487/udp                         # Simple Asynchronous File Transfer
   208	gss-http        488/tcp
   209	gss-http        488/udp
   210	pim-rp-disc     496/tcp
   211	pim-rp-disc     496/udp
   212	isakmp          500/tcp
   213	isakmp          500/udp
   214	gdomap          538/tcp                         # GNUstep distributed objects
   215	gdomap          538/udp                         # GNUstep distributed objects
   216	iiop            535/tcp
   217	iiop            535/udp
   218	dhcpv6-client   546/tcp
   219	dhcpv6-client   546/udp
   220	dhcpv6-server   547/tcp
   221	dhcpv6-server   547/udp
   222	rtsp            554/tcp                         # Real Time Stream Control Protocol
   223	rtsp            554/udp                         # Real Time Stream Control Protocol
   224	nntps           563/tcp                         # NNTP over SSL
   225	nntps           563/udp                         # NNTP over SSL
   226	whoami          565/tcp
   227	whoami          565/udp
   228	submission      587/tcp         msa             # mail message submission
   229	submission      587/udp         msa             # mail message submission
   230	npmp-local      610/tcp         dqs313_qmaster  # npmp-local / DQS
   231	npmp-local      610/udp         dqs313_qmaster  # npmp-local / DQS
   232	npmp-gui        611/tcp         dqs313_execd    # npmp-gui / DQS
   233	npmp-gui        611/udp         dqs313_execd    # npmp-gui / DQS
   234	hmmp-ind        612/tcp         dqs313_intercell # HMMP Indication / DQS
   235	hmmp-ind        612/udp         dqs313_intercell # HMMP Indication / DQS
   236	ipp             631/tcp                         # Internet Printing Protocol
   237	ipp             631/udp                         # Internet Printing Protocol
   238	ldaps           636/tcp                         # LDAP over SSL
   239	ldaps           636/udp                         # LDAP over SSL
   240	acap            674/tcp
   241	acap            674/udp
   242	ha-cluster      694/tcp                         # Heartbeat HA-cluster
   243	ha-cluster      694/udp                         # Heartbeat HA-cluster
   244	kerberos-adm    749/tcp                         # Kerberos `kadmin' (v5)
   245	kerberos-adm    749/udp                         # kerberos administration
   246	kerberos-iv     750/udp         kerberos4 kerberos-sec kdc loadav
   247	kerberos-iv     750/tcp         kerberos4 kerberos-sec kdc rfile
   248	webster         765/tcp                         # Network dictionary
   249	webster         765/udp
   250	phonebook       767/tcp                         # Network phonebook
   251	phonebook       767/udp
   252	rsync           873/tcp                         # rsync
   253	rsync           873/udp                         # rsync
   254	#rquotad unreserved in IANA!
   255	rquotad         875/tcp                         # rquota daemon
   256	#rquotad unreserved in IANA!
   257	rquotad         875/udp                         # rquota daemon
   258	telnets         992/tcp
   259	telnets         992/udp
   260	imaps           993/tcp                         # IMAP over SSL
   261	imaps           993/udp                         # IMAP over SSL
   262	pop3s           995/tcp                         # POP-3 over SSL
   263	pop3s           995/udp                         # POP-3 over SSL
   264	
   265	#
   266	# UNIX specific services
   267	#
   268	exec            512/tcp
   269	biff            512/udp         comsat
   270	login           513/tcp
   271	who             513/udp         whod
   272	shell           514/tcp         cmd             # no passwords used
   273	syslog          514/udp
   274	printer         515/tcp         spooler         # line printer spooler
   275	printer         515/udp         spooler         # line printer spooler
   276	talk            517/udp
 277	ntalk           518/udp
   278	utime           519/tcp         unixtime
   279	utime           519/udp         unixtime
   280	efs             520/tcp
   281	router          520/udp         route routed    # RIP
   282	ripng           521/tcp
   283	ripng           521/udp
   284	timed           525/tcp         timeserver
   285	timed           525/udp         timeserver
   286	tempo           526/tcp         newdate
   287	courier         530/tcp         rpc
   288	conference      531/tcp         chat
   289	netnews         532/tcp
   290	netwall         533/udp                         # -for emergency broadcasts
   291	uucp            540/tcp         uucpd           # uucp daemon
   292	klogin          543/tcp                         # Kerberized `rlogin' (v5)
   293	kshell          544/tcp         krcmd           # Kerberized `rsh' (v5)
   294	afpovertcp      548/tcp                         # AFP over TCP
   295	afpovertcp      548/udp                         # AFP over TCP
   296	remotefs        556/tcp         rfs_server rfs  # Brunhoff remote filesystem
   297	
   298	#
   299	# From ``PORT NUMBERS'':
   300	#
   301	#>REGISTERED PORT NUMBERS
   302	#>
   303	#>The Registered Ports are listed by the IANA and on most systems can be
   304	#>used by ordinary user processes or programs executed by ordinary
   305	#>users.
   306	#>
   307	#>Ports are used in the TCP [RFC793] to name the ends of logical
   308	#>connections which carry long term conversations.  For the purpose of
   309	#>providing services to unknown callers, a service contact port is
   310	#>defined.  This list specifies the port used by the server process as
   311	#>its contact port.
   312	#>
   313	#>The IANA registers uses of these ports as a convienence to the
   314	#>community.
   315	#
   316	socks           1080/tcp                        # socks proxy server
   317	socks           1080/udp                        # socks proxy server
   318	
   319	# Port 1236 is registered as `bvcontrol', but is also used by the
   320	# Gracilis Packeten remote config server.  The official name is listed as
   321	# the primary name, with the unregistered name as an alias.
   322	bvcontrol       1236/tcp        rmtcfg          # Daniel J. Walsh, Gracilis Packeten remote config server
   323	bvcontrol       1236/udp                        # Daniel J. Walsh
   324	
   325	h323hostcallsc  1300/tcp                        # H.323 Secure Call Control
   326	h323hostcallsc  1300/udp                        # H.323 Secure Call Control
   327	ms-sql-s        1433/tcp                        # Microsoft-SQL-Server
   328	ms-sql-s        1433/udp                        # Microsoft-SQL-Server
   329	ms-sql-m        1434/tcp                        # Microsoft-SQL-Monitor
   330	ms-sql-m        1434/udp                        # Microsoft-SQL-Monitor
   331	ica             1494/tcp                        # Citrix ICA Client
   332	ica             1494/udp                        # Citrix ICA Client
   333	wins            1512/tcp                        # Microsoft's Windows Internet Name Service
   334	wins            1512/udp                        # Microsoft's Windows Internet Name Service
   335	ingreslock      1524/tcp
   336	ingreslock      1524/udp
   337	prospero-np     1525/tcp        orasrv          # Prospero non-privileged/oracle
   338	prospero-np     1525/udp        orasrv
   339	datametrics     1645/tcp        old-radius sightline    # datametrics / old radius entry
   340	datametrics     1645/udp        old-radius sightline    # datametrics / old radius entry
   341	sa-msg-port     1646/tcp        old-radacct     # sa-msg-port / old radacct entry
   342	sa-msg-port     1646/udp        old-radacct     # sa-msg-port / old radacct entry
   343	kermit          1649/tcp
   344	kermit          python自动化运维之Socket网络编程

linux运维之LVS(一)

linux运维之iptables的一些操作(参考大神的)

企业运维之 openstack 的私有网络以及图形化配置

企业运维之 openstack 的私有网络以及图形化配置

企业运维之 openstack 的介绍以及组件搭建