1 第二章 資料傳遞. 2 內容大綱 ip 位址 子網路 選擇路徑 路由表 位址解析...
Post on 19-Dec-2015
268 views
TRANSCRIPT
1
第二章
資料傳遞
2
內容大綱• IP 位址• 子網路• 選擇路徑• 路由表• 位址解析• 協定、埠、插座
• 以唯一的 IP 位址 決定傳送路徑。
• 封裝與傳送 IP 資料段。• 利用 header 中的協定號碼決定是
那一個協定。• 將萃取資料送給此傳輸層協定模
組。• 傳輸層協定以 port 號碼決定資
料屬於那一個應用行程。
介紹的方式
3
傳送資料之 IP 位址• 以唯一的 IP 位址 決定傳送路徑。• 封裝與傳送 IP 資料段。
• 利用 header 中的協定號碼決定是那一個協定。
• 將萃取資料送給此傳輸層協定模組。•傳輸層協定以 port 號碼決定資料屬於那一個應用行程。
4
IP 定址( addressing )方式• IP 為虛擬的網際網路定址
– 提供網際網路定址的方式,付予各主機的網路介面一個獨一無二的網際網路位址( IP 位址),使資料能跨越不同實體網路傳送給正確的主機。
5
IP 位址的十進位表示法範例
6
IP 定址原則• IP 位址並非被指定給特定的主機。• IP 位址是指定給主機(或此主機的網路介面)與網路間的連結。
• 若電腦主機有許多連線(例如路由器),則各個連線都需要一個 IP 位址。
7
IP 定址方式• IP 位址是一個 32-bit 二進位數值,由「網路位址」和「主機位址」所組成。
• IP 位址明確指出某特定的網路,與該網路的某特定主機。
• 由前導長度( prefix length )決定網路位址佔多少 bit 。– IP 位址等級( address class ) – CIDR ( Classless Inter-domain Routing ) 位址遮罩( CIDR addressing mask )
8
IP 位址階層• 雖然分配網路位址必須世界性的考量,但某一網路內的主機應如何編號則可有自主性 (AS-Autonomous System) 。
9
IP 位址等級
10
三大類 IP 定址模式• 單點傳播位址( Unicast address )
– Ex : 140.138.136.254
• 群播位址( Multicast address )– Ex : 224.0.0.9
• 廣播位址( Broadcast address )– Ex : 140.138.137.255
11
計算位址的等級
12
以十進位表示法區分 IP 等級
13
IP 位址等級• 等級 A 、 B 、 C 用於一般主機位址。• 等級 D (群播位址 , multicast address )用來指定一群主機。
• 等級 E 未使用。
14
各等級的位址空間
• IP 位址等級不符合目前 Internet 各組織使用的狀況。
15
不分級的 IP 位址: CIDR
• 利用 CIDR ( Classless Inter-domain Routing ) 位址遮罩( addressing mask )決定網路位址空間。– Network mask 是長度為 32 的位元串,開始連續的 1 與跟隨的 0 做為結束。
– 不再以 byte 為單位。• Example : mask=255.255.148.0
– 11111111,11111111,11111000,00000000– 在此網路中共有 211 個 IP addresses
16
IP address and Network Mask
• You have to set the computer A – IP address (ex: 140.138.137.201)– Network mask (ex: 255.255.255.0)– Default gateway (ex:140.138.136.202)
140.138.137.201=10001100 10001010 10001001 11001001 255.255.255.0 =11111111 11111111 11111111 00000000 140.138.137.0 =10001100 10001010 10001001 00000000
140.138.137.202=10001100 10001010 10001001 11001010 255.255.255.0 =11111111 11111111 11111111 00000000 140.138.137.0 =10001100 10001010 10001001 00000000
A and B has the same network address: in the same LAN
140.138.135.108=10001100 10001010 10000111 01101100 255.255.255.0 =11111111 11111111 11111111 00000000 140.138.135.0 =10001100 10001010 10000111 00000000
A and C don’t have the same network address: in different LAN
A
C
B
17
CIDR 由來的範例• Example :組合原本 8 個 C 級的位址空間成為一單一網路(共有 256×8 個 IP )– 網路位址為前 21 bits 。– 主機位址為後 11 bits 。– mask=255.255.148.0
– 結合 192.168.16.0 ~ 192.168.23.255
– One Host IP=192.168.16.122/21
– Gateway IP=192.168.23.254
18
CIDR 的代價• 必須修改 Routing protocol 及 router 。• 傳送 IP 同時必須送出 mask 。• 以 IP=192.168.16.122/21 的“ /21” 表示
mask 有 21 個連續的 1 。• RFC1878 Variable Length Subnet Table
For IPv4 列出 32 個可能的 network mask 。
19
Peanut 網路peanut walnut
172.16.12.2 172.16.12.4
172.16.12.3 172.16.12.1
172.16.1.5
Internet172.16.1.0 network
pecan almond10.104.0.19
172.16.12.0 Ethernet network
banana
172.16.1.203:70:5b:11:34:50
08:00:20:00:0e:c8
00:20:af:1e:7e:5f
04:39:0f:15:34:f0
00:c0:34:17:b2:20
08:00:20:22:fd:51
08:20:8a:6d:e4:38
20
指定 Router IP 範例
10.255.255.254
128.211.255.254
21
路由器之 IP 位址範例
22
特殊的 IP 位址• 預設路徑( Default Route ) 0.0.0.0• 繞回位址( Loopback Address ) 127.0.0.1• 對於所有的網路
– 主機位址全為 0 :代表此網路本身。– 主機位址全為 1 :代表此網路上所有主機,是所謂的 Directed Broadcast Address 。
• 區域網路上的廣播( Limited Broadcast Address ) 255.255.255.255
23
特殊 IP 位址表格
24
Private Network
• The following addresses are reserved for the private network :– Class A : 10.0.0.*– Class B : 172.16.*.* to 172.31.*.*– Class C : 192.68.0.* to 192.68.255.*
25
子網路( subnet )• 為了管理的因素,將大網路切割成子網路
( subnet )。• 子網路可以有不同的實體網路,再以路由器
( Router )相連。• 利用子網路遮罩( subnet mask )將大網路的 IP位址空間切割成子集。
• 切割子網路後的 IP 位址空間會減少。• 對 host 而言,只有一個 network mask ,而不理會是否是“子”網路。
26
Subnet Example
• 公司的網路: 172.16.0.0/16• 172.16.0.1 ~ 172.16.255.254
• 切成 16 個 subnets– Subnet 1 : 172.16.0.0/20
• 172.16.0.1 ~ 172.16.15.254
– Subnet 2 : 172.16.16.0/20• 172.16.16.1 ~ 172.16.31.254
– Subnet 3 : 172.16.32.0/20• 172.16.32.1 ~ 172.16.47.254
00000000.0000000000001111.1111111100010000.0000000000011111.1111111100100000.0000000000101111.11111111
11110000.0000000011111111.11111111
net 1
net 2
net 3
net 16
:
27
傳送資料之決定傳送路徑• 以唯一的 IP 位址決定傳送路徑。• 封裝與傳送 IP 資料段。
• 利用 header 中的協定號碼決定是那一個協定。
• 將萃取資料送給此傳輸層協定模組。•傳輸層協定以 port 號碼決定資料屬於那一個應用行程。
28
IP 網路下不同之實體網路
Ethernet
Token-ring
G2
X.25
A1
G1
C1
29
Logical View of Routing
• 各個系統只能傳遞資料給同一實體網路的其他裝置。
網際層網路存取層
網際層網路存取層
應用層 傳輸層 網際層網路存取層
應用層 傳輸層 網際層網路存取層
A1 主機 C1 主機
G1 路由器 G2 路由器
A 網路 B 網路 C 網路
30
路由方式( 1 )• 對所有網路設備(包括電腦主機及閘道器),當要傳送封包給某一目的地主機( destination )時,都必須自行決定封包傳送的路徑。– Destination 在同一網路上,封包直接傳給
destination 。– Destination 在不同一網路上,封包直接傳給
gateway 。• 對主機而言,選擇路徑就是選擇網路。
31
路由方式( 2 )• 主機上的 IP module 依據 network mask 濾出
destination IP 位址的網路部份。• 比對是否與自己在同一網路。
– No :主機到路由表( routing table )中查出該網路的 next hop 。換言之,轉送此封包的主機的 IP 位址。
• 主機以 ARP 查出 destination 或轉送主機的 MAC 位址放入 Ethernet 的 frame 。
• 將封包資料(不做修改)包裝成 Ethernet 的 frame 送出。
32
IP 封裝( Encapsulation )• 為了在實體網路上傳送,必須將 IP
datagram 封裝於 frame 內。• frame 上的目的地實體網路位址指向路徑上的下一個節點( next hop )。
33
Peanut Example
• Peanut has network prefix : 172.16.12.0
• Source = peanut , Destination = walnut– 255.255.255.0 & 172.16.12.4 = 172.16.12.0– Next hop = 172.16.12.4
• Source = peanut , Destination = banana– 255.255.255.0 & 172.16.1.2 = 172.16.1.0– Next hop = 172.16.12.3
34
IP module in peanut network
網路存取層 172.16.12.2
網路存取層172.16.12.3 172.16.1.5
網路存取層 172.16.1.2
Default 172.16.12.1
172.16.12.0 172.16.12.2
172.16.1.0 172.16.12.3
目的地 閘道器
Default 172.16.12.1
172.16.12.0 172.16.12.3
172.16.1.0 172.16.12.5
目的地 閘道器
Default 172.16.1.5
172.16.1.0 172.16.1.2
目的地 閘道器
傳輸層
應用層
傳輸層
應用層
來源主機 peanut
目的主機 banana
閘道器 pecan
35
Addresses in Routing Path
• peanut walnut
• peanut pecan bananaSource :IP:172.16.12.2 MAC:08:00:20:00:0e:c8 Destination :IP:172.16.1.2 MAC:00:20:af:1e:7e:5f
Source :IP:172.16.12.2 MAC:08:00:20:00:0e:c8 Destination :IP:172.16.12.4 MAC:00:c0:34:17:b2:20
Source :IP:172.16.12.2 MAC:04:39:0f:15:34:f0 Destination :IP:172.16.1.2 MAC:03:70:5b:11:34:50
36
路由表( Routing Table )
• 儲存到某一目的地主機( destination )封包傳送的路徑。– Routing table 可能是由 System manager 提供或由 Routing protocol 建立。
– Example : Peanut Routing Table
• UNIX 以 netstat -nr 顯示路由表
37
Peanut routing table• Destination Gateway Flags Ref Use Interface
• 127.0.0.1 127.0.0.1 UH 1 298 lo0
• default 172.16.12.1 UG 2 50360
• 172.16.12.0 172.16.12.2 U 40 111379 le0
• 172.16.2.0 172.16.12.3 UG 4 1179
• 172.16.1.0 172.16.12.3 UG 10 1113
• 172.16.3.0 172.16.12.3 UG 2 1379
• 172.16.4.0 172.16.12.3 UG 4 1119
38
netstat -nr (mis)
• mis:~$ netstat -r
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
localnet * 255.255.255.0 U 0 0 0 eth0
loopback * 255.0.0.0 U 0 0 0 lo
default 140.126.155.254 0.0.0.0 UG 0 0 0 eth0
• mis:~$ netstat -nr
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
140.126.155.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo
0.0.0.0 140.126.155.254 0.0.0.0 UG 0 0 0 eth0
39
netstat -nr (ms)• Destination Gateway Flags Refs Use Netif Expire• default 140.126.111.20 UGSc 48 1531 fxp0• 127.0.0.1 127.0.0.1 UH 1 54 lo0• 140.126.111/24 link#1 UC 0 0 fxp0• 140.126.111.1 0:90:27:76:a2:62 UHLW 1 1863 fxp0 1182• 140.126.111.3 0:a0:c9:8b:61:e3 UHLW 1 157 lo0• 140.126.111.4 0:80:c8:ef:7c:69 UHLW 0 178 fxp0 961• 140.126.111.19 link#1 UHLW 2 0 fxp0• 140.126.111.20 0:e0:63:3:df:80 UHLW 48 0 fxp0 1197• 140.126.111.153 0:80:c8:ef:46:5d UHLW 1 336 fxp0 683• 140.126.111.155 0:80:c8:ef:7f:f4 UHLW 0 223 fxp0 1012• 140.126.111.157 0:c0:26:ef:6:53 UHLW 1 2716 fxp0 618• 140.126.111.162 0:80:c8:ef:46:62 UHLW 0 27 fxp0 1178• 140.126.111.255 ff:ff:ff:ff:ff:ff UHLWb 1 3023 fxp0• 140.126.161.23 140.126.111.19 UGHD 0 3 fxp0• 140.126.161.31 140.126.111.19 UGHD 0 419 fxp0
40
netstat -in (ms)
$ netstat -in
Name Mtu Network Address Ipkts Ierrs Opkts Oerrs Coll
fxp0 1500 <Link> 00.a0.c9.8b.61.e3 2060401 1 2036174 0 0
fxp0 1500 140.126.111/2 140.126.111.3 2060401 1 2036174 0 0
lp0* 1500 <Link> 0 0 0 0 0
tun0* 1500 <Link> 0 0 0 0 0
sl0* 552 <Link> 0 0 0 0 0
ppp0* 1500 <Link> 0 0 0 0 0
lo0 16384 <Link> 361 0 361 0 0
lo0 16384 127 127.0.0.1 361 0 361 0 0
41
用 ifconfig 檢查介面$ ifconfig fxp0
fxp0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
inet 140.126.111.3 netmask 0xffffff00 broadcast 140.126.111.255
ether 00:a0:c9:8b:61:e3
media: autoselect (100baseTX <full-duplex>) status: active
supported media: autoselect 100baseTX <full-duplex> 100baseTX 10baseT/UP
$ ifconfig lp0
lp0: flags=8810<POINTOPOINT,SIMPLEX,MULTICAST> mtu 1500
• Note: “winipcfg” used in Windows
“ipconfig” used in MSDOS
42
Binding Protocol Addresses
• Protocol addresses are abstractions provided by software in the upper layer.– Example : IP address is protocol address
• Physical network hardware does not know how to locate a computer from its protocol address.
• The Protocol address of next hop must be translated to an equivalent hardware address before a packet can be sent.
43
Address Resolution
• Mapping between a protocol address and a hardware address is called address resolution.
• A host or router uses address resolution when it needs to send to another computer on the same physical network.
• A computer never resolves the address of a computer that attaches to a remote network
44
位址解析與協定位址
IP Addresses for TCP/IP
MAC Addresses for Ethernet
45
位址解析協定( Address Resolution Protocol , ARP )
• Network Access Layer 將 IP 位址轉換成 Ethernet 的 MAC 位址。
• ARP software 建立位址解析表格。• 當有轉換 IP 位址為 MAC 位址的要求時, ARP software 便查詢表格– exist :傳回 Ethernet 位址– Not exist : ARP 對 Ethernet 上所有 host 廣播,詢問此 IP 位址的 host 。如果有 host 確認為其 IP ,便會回傳。 ARP 就可將其記錄於表中。
46
位址解析表格• UNIX 以指令 arp 顯示位址解析表格• % arp peanut
peanut (172.16.12.2) at 8:0:20:0:e:c8
• 參考 ARP.ppt
47
arp for peanut network
Net to Media Table
Device IP Address Mask Flags Phys Addr
------- ---------------------------- ---------------------- ------ ----------------------
le0 peanut.nuts.com 255.255.255.255 08:00:20:00:0e:c8
le0 acorn.nuts.com 255.255.255.255 08:00:02:05:21:33
le0 almond.nuts.com 255.255.255.255 SP 08:00:20:22:fd:51
le0 pecan.nuts.com 255.255.255.255 00:20:af:1e:7e:5f
le0 base-address.mcast.net 240.0.0.0 SM 01:00:5e:00:00:00
48
傳送資料• 以唯一的 IP 位址決定傳送路徑。• 封裝與傳送 IP 資料段。
• 利用 header 中的協定號碼決定是那一個傳輸層協定。
• 將萃取資料送給此傳輸層協定模組。•傳輸層協定以 port 號碼決定資料屬於那一個應用行程。
49
IP Encapsulation • 為了在實體網路上傳送,必須將 IP
datagram 封裝於 frame 內。• 不同的實體網路能攜帶的資料大小有差異,因此必須執行資料段的分解( Fragmentation )與重組( Reassembly ),以便在不同實體網路上送 IP datagram 。
50
Maximum Transmission Unit
• 最大傳輸單元( Maximum Transmission Unit , MTU ):網路所能接受的最大封包大小。– Example : FDDI 4352 bytes 、 Ethernet 1500
bytes 、 x.25 576 bytes 、 PPP 296 bytes
• 利用 datagram 上的識別碼、段落偏移量與旗標來 執行分解與重組。
51
在 Internet 上傳送資料
MTU= 5000
MTU= 1500
MTU= 800
52
分解( Fragmentation )
53
重組( Reassembly )
54
分解與重組 IP Datagram
• IP 重組順序錯誤的片段( fragment )– 傳送端會將一個獨一無二的識別碼存在送出的
datagram 識別碼( IDENTIFICATION )欄位。
當路由器重新切割 datagram 時,路由器會複製識別碼給每一個片段( fragment )。
– 接收端使用識別碼及 IP 來源位址將片段組合成 datagram 。此外,利用段落偏移量( FRAGMENT OFFSET )欄位可將片段排續。
55
Detailed Fragmentation Example
Bytes 0000-3999
402014567 0000
Original Datagram
Bytes 0000-1399
142014567 0001
Fragment 1
Bytes 1400-2799
142014567 1751
Bytes 2800-3999
122014567 3500
Fragment 3
Bytes 1400-2199
82014567 1751
Bytes 2200-2799
62014567 2751
Fragment 2.1
Fragment 2.2
Fragment 2
network 1 MTU= 5000
network 2 MTU= 1500
network 3 MTU= 800
Note: length 要再加上 header 長度
56
傳送資料之協定號碼• 以唯一的 IP 位址決定傳送路徑。• 封裝與傳送 IP 資料段。
• 利用 header 中的協定號碼決定是那一個協定。
• 將萃取資料送給此傳輸層協定模組。•傳輸層協定以 port 號碼決定資料屬於那一個應用行程。
57
複合處理( Multiplexing )
• 系統整合各個應用程式的資料,塞入少數幾個傳輸層協定,再傳給 IP ,合成一 datagram ,稱為 multiplexing 。
• 相反的,從網路來的資料必須被分散( de-multiplexed )才能傳給各個 AP 。
• IP 利用協定號碼( protocol number )指定資料是屬於那一個傳輸層協定。
• 傳輸層協定利用埠號碼( port number )指定資料是屬於那一個 AP 。
58
Multiplexing and Demultiplexing
IP
TCP UDP
IP
TCP UDP
multiplexer demultiplexer
ICMP
protocol number
ICMP
port number
59
協定號碼• 存放於 IP datagram 的 8 bits 協定欄位。• Unix 協定號碼是定義在 /etc/protocols 檔案中,是一個協定名稱與協定號碼的對照表。– Well-known Protocol Numbers 記錄在 Assigned
Numbers RFC 中。– Example : 1 代表 ICMP , 6 代表 TCP , 17 代表
UDP 。• 每個系統只需要它真正用得到的號碼即可,不需要全部的 Protocol Number 。
60
cat /etc/protocols (mis)mis:~$ cat /etc/protocols## protocols This file describes the various protocols that are# available from the TCP/IP subsystem. It should be# consulted instead of using the numbers in the ARPA# include files, or, worse, just guessing them.#
ip 0 IP # internet protocol, pseudo protocol numbericmp 1 ICMP # internet control message protocoligmp 2 IGMP # internet group multicast protocolggp 3 GGP # gateway-gateway protocoltcp 6 TCP # transmission control protocolpup 12 PUP # PARC universal packet protocoludp 17 UDP # user datagram protocolidp 22 IDP # WhatsThis?raw 255 RAW # RAW IP interface
# End.
61
cat /etc/protocols (ms)#
# Internet protocols
#
# $FreeBSD: src/etc/protocols,v 1.10.2.3 1999/08/29 14:18:53 peter Exp $
# from: @(#)protocols 5.1 (Berkeley) 4/17/89
#
# See also http://www.isi.edu/in-notes/iana/assignments/protocol-numbers
#
ip 0 IP # internet protocol, pseudo protocol number
#hopopt 0 HOPOPT # hop-by-hop options for ipv6
icmp 1 ICMP # internet control message protocol
igmp 2 IGMP # internet group management protocol
ggp 3 GGP # gateway-gateway protocol
ipencap 4 IP-ENCAP # IP encapsulated in IP (officially ``IP'')
st2 5 ST2 # ST2 datagram mode (RFC 1819)
tcp 6 TCP # transmission control protocol
cbt 7 CBT # CBT, Tony Ballardie <[email protected]>
62
傳送資料之 port 號碼• 以唯一的 IP 位址決定傳送路徑。• 封裝與傳送 IP 資料段。
• 利用 header 中的協定號碼決定是那一個協定。
• 將萃取資料送給此傳輸層協定模組。•傳輸層協定以 port 號碼決定資料屬於那一個應用行程。
63
埠號碼( Port Number )• 傳輸層協定以埠號碼決定是那一個應用程式的資料。
• 在 TCP 或 UDP 中以 Source Port and Destination Port 記錄雙方的 Port Numbers 。– 每個 Port Number 各占 16 bits 。
• 一個 connection 兩端各有一 process ,故兩端各會有一個 port number 。
64
Port Number 的分配• 為了使每一條 connection 都是獨一無二,系統分配 port number 給與應用程式程序:– Source 採用動態分配( dynamically
allocated ) port number 。– Destination port 則採用 well-known port
number ( 0-1023 )。• Example : Source Port Number is 3044 ;
Destination Port Number is 23 for telnet 。
65
TCP handshaking• 建立 telnet 連線 TCP handshake 的例子:
Source: 172.16.12.2 Port Number: 3044
Destination: 092.168.16.2 Port Number: 23
3044,23
23,3044
3044,23
來源埠目的埠
66
Telnet ( Destination )範例
IP datagram
Telnet
TCP
Internet Protocol
092.168.16.2
6172.16.12.2
3044 23TCP segment
IP address 092.168.16.2
Protocol number 6
Port number 23
67
2 Telnet Connections
telnet servertelnet client
Destination: 092.168.16.2 Port Number: 23
Source: 172.16.12.2 Port Number: 3044
Source: 172.16.12.2 Port Number: 3555
• 即使同一 PC 上做 2 次 telnet 到同一主機,也不應會有相同的一對 port numbers 。
68
常用之 Port Numbers
• 不同的傳輸層協定會定義相對應的 Port Numbers 。– Port Number 必須搭配 Protocol Number 才有意義。
• UNIX 將 port number 存在檔案 /etc/services 中。– 256 以下號碼保留給特定常用的服務。– Example : ftp 21 、 telnet 23 、 smtp 25
69
cat /etc/services (ms)1• $ head -40 /etc/services
• # Network services, Internet style
• # Note that it is presently the policy of IANA to assign a single well-known
• # port number for both TCP and UDP; hence, most entries here have two entries
• # even if the protocol doesn't support UDP operations.
• # Updated from RFC 1700, ``Assigned Numbers'' (October 1994). All ports
• # are included.
• # The latest IANA port assignments can be gotten from
• # http://www.isi.edu/in-notes/iana/assignments/port-numbers
• # The Well Known Ports are those from 0 through 1023.
• # The Registered Ports are those from 1024 through 49151
• # The Dynamic and/or Private Ports are those from 49152 through 65535
• # Kerberos services are for Kerberos v4, and are unofficial. Sites running
• # v5 should uncomment v5 entries and comment v4 entries.
• # $FreeBSD: src/etc/services,v 1.55.2.6 1999/08/29 14:19:01 peter Exp $
• # From: @(#)services 5.8 (Berkeley) 5/9/91
• # WELL KNOWN PORT NUMBERS
70
cat /etc/services (ms)2• rtmp 1/ddp #Routing Table Maintenance Protocol
• tcpmux 1/tcp #TCP Port Service Multiplexer
• tcpmux 1/udp #TCP Port Service Multiplexer
• nbp 2/ddp #Name Binding Protocol
• compressnet 2/tcp #Management Utility
• compressnet 2/udp #Management Utility
• compressnet 3/tcp #Compression Process
• compressnet 3/udp #Compression Process
• echo 4/ddp #AppleTalk Echo Protocol
• rje 5/tcp #Remote Job Entry
• rje 5/udp #Remote Job Entry
• zip 6/ddp #Zone Information Protocol
• echo 7/tcp
• echo 7/udp
• discard 9/tcp sink null
• discard 9/udp sink null
• systat 11/tcp users #Active Users
71
cat /etc/services (mis)1
• mis:~$ head -20 /etc/services• #• # Network services, Internet style• #• # Note that it is presently the policy of IANA to assign a single well-known• # port number for both TCP and UDP; hence, most entries here have two entries• # even if the protocol doesn't support UDP operations.• # Updated from RFC 1340, ``Assigned Numbers'' (July 1992). Not all ports• # are included, only the more common ones.• #• # from: @(#)services 5.8 (Berkeley) 5/9/91• # $Id: services,v 1.9 1993/11/08 19:49:15 cgd Exp $
72
cat /etc/services (mis)2
• tcpmux 1/tcp # TCP port service multiplexer
• echo 7/tcp
• echo 7/udp
• discard 9/tcp sink null
• discard 9/udp sink null
• systat 11/tcp users
• daytime 13/tcp
• daytime 13/udp
73
Socket• IP address + Port number = Socket address• Socket pair(來源端與接收端)可以決定一條獨一無二的
Internet 兩端應用程式的連線。• Example : (172.16.12.2,3044) and (092.168.16.2,23) is a socket
pair for this telnet connection 。