CHAP 5. The Network Layer (Part 2) & The Upper Layers

강의내용 - Stalling책

• Chap 20. 혼잡제어 (Congestion Control)

• Chap 14. 인터넷 프로토콜 (IP)

• Chap 15. 수송(트랜스포트) 프로토콜

• 강의 내용

- Network layer의 기능               - Transport layer의 기능

② Congestion Control	① process 간의 데이터 전송/수송

③ Internetworking	(Stallings 10th ed.) p.485

⇒ Network layer protocol: IP	⇒ Transport layer protocol: TCP/UDP

Congestion Control

• How Congestion Occurs?

- 도로망

용량 초과 ⇒ 속도 감소

⇒ Throughput (처리율 = 통과대수/min) 감소

⇒ 혼잡 (congestion) 확산

① When a router becomes "heavily loaded", it begins to "discard" old packets from its buffer.

② The discarded packets will be "resent" by their sources (ARQ protocol).

③ After a while, the buffer in the heavily loaded router is "full" of mostly "retransmitted" packets, and the throughput (= the total no. of packets actually delivered) is decreased.

④ Since this router is "unavailable" most of the time, its adjacent routers can NOT pass "new" packets to it when needed.

When the no. of new requests to this area is slightly increased, the net service rate (throughput) from the area is further reduced.

⑤ Eventually, the "effective" service rate of several routers in this area will be "drastically" reduced.

⇒ ‘Congestion’ occurs

⑥ End-to-end observation: When the offered load "exceeds" a threshold, the throughput begins to "drop" and the delay begins to "increase" sharply.

(Stallings 10th ed.) p.653 Fig.20.1, Fig.20.2, Fig.20.4

(Stallings 7th ed.) p.473 Fig.13.4

• How traffic can be controlled? (트래픽 관리)

1. Preallocation of Buffers

- Idea

․ A virtual circuit is established bet. the source and dest. "before" its use, and buffer space is "reserved" on routers during set-up.

․ Transmission to end hosts is

Buffer

A

Buffer

Buffer

B

⇒ "Guaranteed" IF resource is available.

"Rejected"   IF NO resource is available.

․ When a packet arrives in each router, the ACK is NOT sent back to the sending router 'UNTIL' the packet has been ‘forwarded'.

- Adv.

․ Congestion is "impossible".

⇒ Virtual circuit에 buffer가 “모두” 예약되어야만 packet들이 network에 진입할 수 있으므로.

․ Predictable delay.

⇒ Virtual circuit을 따라 모든 packet들이 전송되므로.

- Disadv.

․ May waste buffer space.

⇒ 예약된 buffer는 다른 packet들이 사용할 수 없음.

⇒ Especially because a "whole" window space must be reserved when the sliding window protocol allows for multiple outbound packets.

(Stallings 10th ed.) p.661

2. Token Bucket

- Idea

․ Congestion is caused by "too many" packets.

⇒ Keeps the total no. of packets in the subnet "constant".

- Method

․ A "fixed" no. of 'tokens, OR permits' is initially generated in the subnet.

50 packets

200 tokens

300 tokens

100 tokens

․ A router can transmit packets only when it has the same no. of "tokens".

⇒ A router generates a new token AFTER it passes a packet to a 'destination' host.

- Problems

․ Difficult to let "bursty" interactive traffic (여러 번의 짧은 traffic - 한 번에 적은 token이 필요) share the subnet with "long" file transfer (한 번의 긴 traffic - 한 번에 많은 token이 필요).

⇒ "Unfair"

(ex) file transfer는 많은 token이 필요하므로 telnet은 token 얻기가 어려움.

⇒ "Starvation" may occur

․ A 'lost' token implies 'forever reduced' subnet capacity.

(ex) Frame Relay Network에 제안된 기법

- 전송 중인 최대 frame의 개수는 네트워크에 정해진 허가(permit) 숫자를 넣음으로써 고정됨.

- Frame handler는 host의 frame을 중계하려고 할 때, 먼저 허가를 잡고 파기해야함.

- 프레임이 host에게 인도될 때  Frame handler는 허가를 재발급함.

3. Traffic Shaping

- Idea

․ "Bursty" traffic often causes congestion.

⇒ IF hosts could be made to transmit at a "uniform" rate, congestion would be "less" common.

(즉, network에 들어오는 packet의 수를 균일하게 유지)

⇒ Forcing the packets to be transmitted at a more "predictable" rate.

․ When a virtual circuit is set up, the ‘host’ and the ‘subnet’ agree on a certain traffic pattern (shape) for that circuit.

- The Leaky Bucket algorithm

․ Each host is connected to the network by an "interface" containing a leaky bucket (a finite "internal" queue).

․ If one or more processes in the host try to send a packet when the max. no. of packets are already queued, the new packet is "discarded".

․ This algorithm can be built into the network interface card or simulated by the host OS.

(ex) In ATM network,

① The leaky bucket consists of a "finite" queue.

② When a packet arrives,

IF there is a room on the queue, it is appended to the queue.

OTHERWISE it is discarded.

③ At every clock tic, "one" packet is transmitted.

(Stallings 10th ed.) p.664 Fig.20.7

Internetworking

• Internetworking: Connection Devices

1. Repeater: Amplify or regenerate "weak" signals.

⇒ Copy individual bits bet. cable segments inside a LAN. (NO "storage")

⇒ 하나의 LAN을 단순히 연장시킴.

⇒ Physical layer device (Layer 1 Device)

R

R

⇒ The transceiver chips can

only provide enough power     to drive 500m.

500m

1500m

2. Bridge: Store-and-forward frames bet. 'same' LANs.

⇒ 같은 종류의 LAN과 LAN을 연결

⇒ Data link layer device (Layer 2 Device)

Bridge

Ethernet

Ethernet

LLC

MAC Physical

Physical

Physical

LLC

MAC Physical

MAC

① A bridge "accepts" an entire frame and 'passes' it up to the data link layer where the checksum is verified.

② Then, the frame is sent "down" to the physical layer for forwarding on the other network.

⇒ Store-and-forward (Buffer가 필요)

(c.f.) Ethernet switches (Layer 2 Device)

3. (Multiprotocol) Router: Store-and-forward packets bet. 'different' networks.

⇒ 다른 종류의 network과 network을 연결

Ethernet

Network

LLC/MAC Physical

Router

Physical

Physical

LLC/MAC

Data Link

Network

WAN

Router

Ethernet

Physical

Physical

Network

LLC/MAC Physical

Data Link

LLC/MAC

Network

① A router take incoming packets from one line and 'forward' them on another.

② The lines may belong to 'different' networks and use different "protocols".

⇒ Network layer device (Layer 3 Device)

(Stallings 10th ed.) p.443 Fig.14.1, p.445 Fig.14.2, p.449 Fig.14.3

• Gateway: SW적 개념

① TCP/IP network에서 subnet/network의 외부 '관문' 역할: Router가 담당.

S

G

G

G

G

G

S

S

S

충북대

KREN

(KT/

Dacom)

NSFNet

U. C. at

Berkeley

U. C. at

L. A.

S

G

S

KNUE

210.93.99.64

211.34.193.6

ex) OSPF(Interior routing)/BGP(Exterior routing)

(Stallings 10th ed.) p.628 Fig.19.9	(Stallings 7th ed.) p.743 Fig.19.5

4. Firewalls (방화벽)

- Provides "security" inside the organization.

⇒ 'All' traffic to or from the organization is forced through a firewall.

- Structure

⇒ two 'packet filtering' routers + one 'application' gateway

S

R

S

KNUE

Firewall

G

R

․ Packet filtering routers:

① Inspect every "incoming" packets - routers 'outside' LAN

"outgoing" packets - routers 'inside' LAN

② Packets meeting some "criterion" are forwarded normally.

Those that fail the test are dropped.

⇒ Have tables which list

sources and dest.'s that are "acceptable",

sources and dest.'s that are "blocked", and

'default rules' with packets from/to other machines.

․ Application gateway:

Operates at the application level, rather than just looking at raw packets.	(ex) A mail gateway examines each mail going in or coming out.

⇒ For each mail, it makes a decision to transmit or discard it based on header fields, message size, or even the content (e.g. "bomb" or "nuclear" etc.)

IP (Internet Protocol)

• The Network Layer in the Internet: Internet layer

TCP

UDP

H/W

interface

IP

process

host

H/W

interface

H/W

interface

IP

router(gateway)

H/W

interface

H/W

interface

IP

router(gateway)

TCP

UDP

H/W

interface

IP

process

host

X.25

Ethernet

Token Ring

Network

Layer

• TCP/IP protocol suite (or just TCP/IP)

- A "family" of protocols was specified as the standard for the ARPANet and associated DoD network in the early 1980s.

- Characteristics.

․ It is NOT vendor-specific.

(ex) SNA(IBM), DECNet(DEC), IPX/SPX(Novell Netware)

․ It has been implemented on everything from PC to the supercomputers.

․ It is used for both LANs and WANs.

․ It is used by many different government agencies and commercial sites, NOT just DARPA-funded networks.

- TCP/IP protocol suite:

① TCP: a connection-oriented protocol

② UDP: a connectionless protocol

③ ICMP(Internet Control Msg. Protocol): handles error and control info. bet. gateways and host

⇒ generated by the "TCP/IP networking" S/W, NOT user processes.

④ IP(Internet Protocol): provides the packet delivery service for TCP, UDP and ICMP

⇒ user processes normally do NOT need to be involved with the IP layer.

⑤ ARP(Addr. Resolution Protocol): the protocol that maps an IP addr. into a H/W addr. (such as "Ethernet addr.")

⑥ RARP("Reverse" ARP): the protocol that maps a H/W addr. into an IP addr.

(Stallings 10th ed.) p.42 Fig.2.8

(Stallings 7th ed.) p.51 Fig.2.15

• IP

- IP is the protocol that provides the "packet delivery" service for TCP and UDP.

⇒ "Routing"

- Every IP packet contains the "source" addr. and the "dest." addr. so that each packet can be routed and delivered "independently."

⇒ Reassembling packets must be provided by the upper layer. (TCP & UDP)

- IP header format:

	0		8	16		24 31
	version	head. len.	type of service	total length
	identification			flags	fragmentation offset
	time to live		protocol	header checksum
	"source addr."
	"destination addr."
	options					padding

(Stallings 10th ed.) p.456 Fig.14.5, p.455-457

(Stallings 6th ed.) p.627 Fig. 15.6, p.627

• Computer Network Delivery: Router에 있는 "routing table"을 참조.

⇒ 각 Router에서 dest. addr.(IP 주소)를 보고 “다음 해당” Router로 넘김.

S

S

S

G

G

G

G

G

G

S

S

S

KNUE

충북대

KREN

(서울대)

NSFNet

U. C. at

Berkeley

U. C. at

L. A.

210.93.99.64

211.34.193.6

• An IP addr. on the Internet are assigned by the NIC (Network Information Center) located at SRI (Stanford Research Institute) International.

KISA

(한국인터넷 진흥원)

(http://krnic.or.kr/)

ex) telephone no.:	국가식별번호 - 지역번호 - 지역전화국 - 가입자번호

82 - 43 - 230 - 3786

IP addr.:	network addr. - (subnet addr.) - host addr.

• Four formats

① Class A: 00000000. ～ 01111111. (0. ～ 127.)

for networks that have a lot of hosts on a single network.

② Class B: 10000000. ～ 10111111. (128. ～ 191.)

③ Class C: 11000000. ～ 11011111. (192. ～ 223.)

for more networks but fewer hosts per network.

④ Class D: for multicast

- a msg. is sent to a specified "group" of hosts on the network.

(broadcast - a msg. is sent to "all" hosts on the network.

unicast - a msg. is sent to "one" specific host on the network.)

(Stallings 10th ed.) p.458 Fig.14.6

(Stallings 7th ed.) p.706 Fig.18.7

• The NIC assigns the "type" of addr. and the "network" ID to the requesting organization.

⇒ Then, the req. org. assigns individual host addr.s on that network.

ex)	공공망	KREONet (연구전산망)	- 134.75.0.0

KREN (교육망)	- 147.47.0.0

상용망	KORNet (한국통신)	- 147.6.0.0

ex)	1.2.255.4	→ 01.02.FF.04

→ 00000001 00000010 ～

class A, net. ID=1 (1.0.0.0)

128.3.0.5	→ 80.03.00.05

→ 10000000 00000011 ～

class B,  net. ID=3 (128.3.0.0)

134.75.204.2	→ 86.4B.CC.02

→ 10000110 01001011 ～

class B,  net. ID=1611 (134.75.0.0)

• Subnet addr.

- Subnetwork: Any organization can "subdivide" the available host addr. space in anyway it desires.

ex) An org. has a class B addr. and 150 hosts.

Case 1: Allocate host IDs of 1 through 150 using all 16-bits.

⇒ All the gateway in the org. must know where each "individual" host is located for routing.

⇒ Adding a "new" host requires that each gateway's routing table be "updated".

10       net ID             host ID

Case 2: Allocate "some" of the high-order bits, say 8 bits, for the subnetwork and the remaining 8 bits for the individual hosts on each subnetwork.

⇒ Gateways in the org. only need to know the subnetwork ID.

(ex) network/subnetwork gateways

- network/subnetwork ID를 사용하여 routing.

⇒ Adding a new “host” on an existing subnetwork does NOT require any changes. (Adding a new “subnetwork” requires the change of routing tables)

10       net ID       subnet ID   host ID

(Stallings 10th ed.) p.459-460 Tab.14.2

(Stallings 7th ed.) p.708 Tab.18.3

- A subnet is defined by applying the "subnet mask" to the IP addr.

⇒	If a bit is on, that bit is interpreted as a "network" bit.

If a bit is off, that bit belongs to the "host" part of the addr.

0		15	16 31
1	0	network ID	host ID

ex) class B addr.

255.     255.        255.        0.       ; subnet mask

network ID    subnet ID    host ID

ex)

① IP addr.  (class B)	128. 66. 12.  1

subnet mask	255.255.255.  0

⇒ host 1 on the subnet 128.66.12.0

② IP addr.  (class B)	130. 97. 16.132

10000100

subnet mask	255.255.255.192

11000000

⇒ host 4 on the subnet 130.97.16.128

③ IP addr.  (class C)	192.178. 16. 66

01000010

subnet mask	255.255.255.192

11000000

⇒ host 2 on the subnet 192.178. 16. 64

⇒ max. subnet 개수 = 4 (00, 01, 10, 11)

ex) IP Network에의 연결

• 관련 system file들 (Unix의 경우)

- /etc/networks: network들과 subnetwork들이 define되어 있음.

ex)	134.75.91.0 ～ 134.75.109.0	; for SERI subnet in KREONet

134.75.110.0 ～ 134.75.119.0	; for KIST subnet in KREONet

134.75.204.0	; for KNUE subnet in KREONet

147.47.0.0	; KREN

- /etc/netmasks: subnet mask가 define되어 있음.

ex)	134.75	255.255.255.0

- /etc/hosts: Domain name들이 저장되어 있음.

ex)	127.0.0.1	localhost

134.75.204.1	router.knue.ac.kr	router

134.75.204.2	cc.knue.ac.kr	cc

203.247.208.60	comedu.knue.ac.kr	comedu

• IPv6: IPv4의 문제점들을 해결

․ Support "billions" of hosts, even with inefficient addr. space allocation.

⇒ address space: 128 bits

․ Reduce the size of the routing tables.

․ Simplify the protocol, to allow routers to process packets faster.

․ Provide better security (authentication and privacy) than current IP (IPv4).

․ Pay more attention to type of service, particularly for real-time data.

⇒ 방송을 위한 audio/video streaming service.

․ Aid multicasting by allowing scopes to be specified.

․ Make it possible for a host to roam without changing its addr.

⇒ Addr.를 바꾸지 않고도 이동 가능.

․ Allow the protocol to evolve in the future.

․ Permit the old and new protocols to coexist for years.

․ IPv6 header(40 octets)가 IPv4 header(20 octets)보다 더 길다

⇒ 그러나 더 작은 개수의 필드를 가지고 있다 (8개 ⇔ 12개)

⇒ 라우터는 헤더에 대하여 처리할 일이 적어지고, 경로배정의 속도를 높일 수 있다.

(Stallings 10th ed.) p.464-466, p.456 Fig.14.5, p.467 Fig.14.9

(Stallings 7th ed.) p.713-714, p.716 Fig.18.10, p.717 Fig.18.11

• Routing in the IP network

- Total network consists of "co-equal" collections of routing domains.

⇒ (sub)networks

Network Gateway

Subnet.

Gateway

H1

H2

Hn

…

Subnet.

Gateway

H1

H2

Hn

…

……

Network Gateway

Subnet.

Gateway

H1

H2

Hn

…

Subnet.

Gateway

H1

H2

Hn

…

……

Network Gateway

Subnet.

Gateway

H1

H2

Hn

…

Subnet.

Gateway

H1

H2

Hn

…

……

Case 1: To the host on the same subnetwork

Case 2: To the host on the same nework

Case 3: To the host on the other network

⇒ No central controller.

- Gateways extract the network ID field and route packets based solely on the "network" ID.

⇒ Gateways need only to know the location of other "networks" NOT individual hosts.	(Stallings 10th ed.) p.460 Fig.14.7

subnet 1 (subnet ID=128.66.12.0)

subnet 2

(subnet ID=

128.66.1.0)

G1-1

G1-2

128.66.12.3

128.66.1.5

H3

128.66.1.2

H1

128.66.12.2

H2

128.66.12.4

G1

128.66.12.1

G2

26.104.0.19

network ID = 128.66.0.0 (subnet mask=255.255.255.0)

network ID = 26.0.0.0

ex)

H1's routing table

"인접한 routing domain들만 specify"

* display the routing table in Unix

# netstat -nr

* localhost

/usr/include/netinet/in.h에 다음과 같이 define되어 있음.

# define INADDR_LOOPBACK (u_long) 0x7F000001

Destination	Gateway
127.0.0.1 128.66.1.0 128.66.12.0 default	127.0.0.1 128.66.12.3 128.66.12.2 128.66.12.1	localhost로 (자기 자신) subnet 2로 subnet 1로 (자신의 subnet⇒자신이 deliver) other network으로

- Routing decision for a host

① If the dest. host is on the "local" network, the packet is delivered to the dest. host directly.

② If the dest. host is on the "remote" network, the packet is forwarded to a local "gateway".

⇒ Because routing is network-oriented, IP makes routing decisions based on the "network portion" of the IP addr.

ex) packet delivery: H1 → H3 (128. 66.  1.  2),

s.m.=255.255.255.  0

H3 (128.66.1.2)			G1-2 (128.66.1.5)
Destination	Gateway		Destination	Gateway
128.66.1.0 default	128.66.1.2 128.66.1.5		128.66.1.0 default	128.66.1.2 128.66.12.3

H1 (128.66.12.2)			G1-1 (128.66.12.3)
Destination	Gateway		Destination	Gateway
128.66.1.0 128.66.12.0 default	128.66.12.3 128.66.12.2 128.66.12.1		128.66.1.0 128.66.12.0 default	128.66.1.5 128.66.12.3 128.66.12.1

If H1 sends packets to H3 (128.66.1.2)

① H1 determines 128.66.1.2 is the local network's class B addr. and applies a subnet mask (255.255.255.0).

⇒ IP knows that the dest. network addr. is 128.66.1.0

⇒ The routing table shows that data bound for 128.66.1.0 should be sent to gateway 128.66.12.3

② Gateway 128.66.12.3 deliver data to gateway 128.66.1.5

③ Gateway 128.66.1.5 makes direct delivery to H3.

⇒ The routing tables in all systems list only gateways they are "directly connected" to.

⇒ A route only points to the "next" gateway, called the next hop.

• Routing table

ex)	comedu# netstat -nr

Routing Table:

Destination           Gateway      Flags  Ref   Use   Interface

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

127.0.0.1	127.0.0.1             UH	0   25246	lo0

203.247.208.0	203.247.208.60        U	3   17329	le0

224.0.0.0	203.247.208.60        U	3       0	le0

default	203.247.208.2         UG   0  177829

Flags:	U - The route is Up and operational.

H - This is a route to a specific "host". (NOT "networks")

G - The route uses a "gateway".

Refcnt:	The current number  of  routes  that “share” the same data link layer addr. (현재, "같은" data link layer addr. - 예: Ethernet addr. - 를 공유하고 있는 route 개수)

Use:	No. of "packets" transmitted via this route.

Interface:	The name of the "network interface" used by this route.

⇒ the network access H/W and S/W that IP uses to communicate with the physical network.

⇒ lo0  : loopback route for local host

le0  : 10BaseT

hme0: 10/100Mbps Fast Ethernet

lane0: ATM

• Data link layer addr.	(Stallings 10th ed.) p.463

․ Physical networks have their "own" addressing schems.

⇒ One task of data link layer (network access layer in TCP/IP) is to map IP addr.'s to physical network addr.'s

IP addr.

D.L. addr.

TCP

UDP

H/W

interface

IP

process

host

H/W

interface

H/W

interface

IP

gateway/router

PSDN

Ethernet

ARP

RARP

․ ARP: The translation of IP addr.s to Ethernet addr.s

․ The ARP S/W maintains a table of translations bet. IP addr.s and Ethernet addr.s

ex) Displaying the contents of the ARP table

comedu# /usr/sbin/arp -a

Net to Media Table

Device   IP Address               Mask	Flags   Phys Addr

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

le0    203.247.208.153	255.255.255.255	00:00:e8:d3:8d:37

le0    203.247.208.155	255.255.255.255	00:00:e8:d2:38:d6

le0    203.247.208.156	255.255.255.255	00:00:e8:d3:7e:40

le0    comedudb.knue.ac.kr	255.255.255.255	08:00:20:8c:a8:97

…	…	…	…

le0    203.247.208.45	255.255.255.255	00:50:4d:00:a6:73

le0    comedu.knue.ac.kr	255.255.255.255 SP	08:00:20:74:e6:c5

le0    mathoff.knue.ac.kr	255.255.255.255	00:e0:1a:00:03:a6

le0    BASE-ADDRESS.MCAST.NET 240.0.0.0     SM	01:00:5e:00:00:00

• How to build a routing table?

- 세가지 routing 구성 방법

① Minimal routing

․ A network completely "isolated" from all other TCP/IP networks.

ex) A TCP/IP LAN NOT to have access to the outside world.

⇒ Built by the "ifconfig" command.

② Static routing

․ A network with a "limited" no. of gateways to other TCP/IP networks.

⇒ Constructed "manually" by the "route" command.

․ "Static" routing tables do NOT "adjust" to network changes.

⇒ They should be used only where routes do NOT change.

․ When remote dest.s can only be reached through "one" route, a static route is the "best" choice. (한가지 길 밖에 없을 경우)

③ Dynamic routing

․ A network with "more than one" possible route to the "same" dest.

․ A dynamic routing table is built from the info. exchanged by routing protocols. ("methods" + "programs" that exchange the info. on the network.)

⇒ dynamically adjusts routes to "reflect" changing network conditions.

․ Routing protocols are designed,

to switch to a "backup route" when the primary	route becomes           "inoperable"

to decide which is the "best" route to a dest.

(ex) OSPF (Open Shortest Path First)

- Building a static routing table

① minimal routing 작성

ex) H1's routing table

H1# netstat -nr

Routing Table:

Destination           Gateway      Flags  Ref   Use   Interface

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

127.0.0.1	127.0.0.1             UH	0   25246	lo0

128.66.12.0	128.66.12.2	U	3   17329	le0

② "Manually" add or delete entries in the routing table.

⇒ use the "route" command

ex)	H1# route -n add  26.0.0.0  128.66.12.1  1

Display numeric addr.s

in its info. msgs.

(or delete) (directly  (gateway) (metric

connected	0: 자기자신을 gateway로 설정.

network)	⇒ G flag is NOT set.

add net 26.0.0.0 128.66.12.1	1: 다른 host를 gateway로 설정.

⇒ G flag is set.)

ex) Configuring static routing for "H1" on the subnet 128.66.12.0

subnet

128.66.12.0

H1

128.66.12.2

G1-1

128.66.12.3

Other local subnets

128.66.1.0

128.66.3.0

128.66.6.0

128.66.9.0

G1-2

128.66.12.1

Other network

26.0.0.0

H1#	route  -n  add  default  128.66.12.1  1

add net default: gateway 128.66.12.1	; output msg.

H1# netstat -nr

Routing Table:

Destination           Gateway      Flags  Ref   Use   Interface

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

127.0.0.1	127.0.0.1             UH	0   25246	lo0

128.66.12.0	128.66.12.2	U	3   17329	le0

default	128.66.12.1	UG	0	0	le0

H1# ping 26.40.0.17

～ successful comm. with the remote host ～

H1# ping 128.66.1.2

～ ping failed (the ICMP redirect msg.) ～

H1#	route  -n  add  128.66.1.0  128.66.12.3  1

H1#	route  -n  add  128.66.3.0  128.66.12.3  1

H1#	route  -n  add  128.66.6.0  128.66.12.3  1

H1#	route  -n  add  128.66.9.0  128.66.12.3  1

⇒ Finishing the routing table.

③ If any subnets are added to the network, the routes to these new subnets must be "manually added" to the routing table.

⇒ If the system is "rebooted", all static routing table entries are "lost".

Thus, the routes are "re-installed" each time your system boots.

④ Installing static routes at "start-up".

․ 2 modifications to start-up files

⇒ Add the desired "route" commands to a start-up file.

Remove any commands from the start-up file that run a "dynamic"     routing protocol.

ex) In BSD Unix,

․ Edit the "rc.local" file

route -n	add	default	128.66.12.1 1 > /dev/console

route -n	add	128.66.1.0	128.66.12.3 1 > /dev/console

route -n	add  128.66.3.0 128.66.12.3 1 > /dev/console

route -n	add  128.66.6.0 128.66.12.3 1 > /dev/console

route -n	add  128.66.9.0 128.66.12.3 1 > /dev/console

․ Comment out the lines that start the "dynamic" routing protocol.

⇒ Often, start-up procedures run routing protocols by "default".

⇒	Routing protocols are "flexible" enough to handle simple and complex routing environments.

ex)	find	sometimes routed instead of in.routed

# if [-f /usr/etc/in.routed ]; then

#   in.routed;

#   echo -n 'routed' > /dev/console

# fi

⇒ The routing daemon (routed) dynamically builds the routing table based on network info.

Host Layer - The Transport/Application Layer

Appendix 1. The Transport Layer

Port No.

▪ How a client process contacts to a server process?

⇒ 16-bit port no. (Application service no.)

⇒ client process가 요청하는 'service'를 담당하는 server process에 연결할 때 사용함.

ex) On Unix, port no.'s are defined in /etc/services.

# more /etc/services

ftp	21/tcp

telnet	23/tcp

smtp	25/tcp

……

talk	517/udp

ex) httpd (Apache Web Server)의 default port no.: 80 (httpd.conf)

▪Two kinds

- well-known port no.: 특정 system application에 assign됨.

1 ～ 255: reserved for well-known processes.

ex) ftp:21, telnet:23, smtp:25, pop:110 등.

256 ～ 1023: reserved for superuser processes in 4.3 BSD.

ex) talk:517, uucp:540 등.

⇒ System service

- ephemeral port no.: short-lived for user processes.	1024 ～

⇒ User service

▪The TCP ports are independent of the UDP ports.

ex) TCP port 1035 ≠ UDP port 1035

▪The 5-tuple is needed for the Internet communication.

{the protocol,

the client's IP addr., the client's port no.,   /* a socket for the sender*/

the server's IP addr., the server's port no.} /* a socket for the receiver*/

⇒ "unique" within the entire Internet.	the combination of an IP addr.	and a port no. is called a	"socket"

ex)	For a ftp service from a client to a server,

client

{ tcp, 203.247.208.60, 1350, 134.75.204.2, 21 }

server

⇔	{ tcp, 203.247.208.60, 1350, 134.75.204.2, 21 }

; this info. is needed for both the sender and the receiver.

For another ftp connection,

{ tcp, 203.247.208.60, 1351, 134.75.204.2, 21 }

⇒ this 5-tuple is different from the above.

ex) How a ftp service is performed?

PID=2001

PID=2031

PID=126

Ex) How a HTTP service is performed?

① URL을 사용하여 service를 request함.

Web browser	Web server

http://server:port/***.html

② TCP connection 설정.

Web browser	Web server

A TCP connection is established

③ Web Server로부터 해당 ***.html 파일 전송 후 connection 끊어짐.

▪ Protocol no.s are defined in /etc/protocols.

ex) # more /etc/protocols

ip	0	IP

……

tcp	6	TCP

udp	17	UDP

	6		protocol
203.247.208.60			source IP addr.
134.75.204.2			dest. IP addr.
1350		21	source port no.
			dest. port no.

ex) How the server knows what to do, if data arrived?

IP

IP

address 203.247.208.60

address 134.75.204.2

TCP

UDP

protocol 6

port 21

TCP header

fork& exec

IP header

inetd

ftpd

Protocols: TCP and UDP

▪ Connection-oriented transfer: TCP

- First, the server (process) is started, then, sometime later a client (process) is started and establish a "connection" with a server by using a three-way handshake.

ex) 전화.

- TCP 제공 service: "Reliable" data delivery service with end-to-end error detection and correction.

ex) smtp, ftp, telnet, pop(post office protocol) 등의 application들이 이용. (in /etc/services)

(Stallings 10th ed.) p.490 Fig.15.1, p.491 Fig.15.2

▪ Connectionless transfer: UDP

- The client does NOT establish a connection with the server and the server does NOT have to accept a connection from a client.

ex) 편지, 전보

- UDP 제공 service: The client just sends a "datagram" to the server on which the address of the server is written.

- NO error detection and correction.

⇒ "Unreliable" datagram delivery service.

- 짧고 간단한 message를 보내는데 사용.

ex) ping, echo, talk 등의 application들이 이용함. (in /etc/services)

(Stallings 10th ed.) p.512

▪Why UDP?

- 특징:	① No three-way handshake for establishing a connection.

② No error detection and correction for each packet exchanged.

⇒ Low communication overhead.

0 15	16 31
source port no.	destination port no.
length	checksum(CRC)-opt.
～ data ～

- UDP header: simple

- If the amount of data is "small", the overhead of ①(creating a connection) and ②(ensuring reliable delivery) may be greater than the work of "retransmitting" the entire data set.

⇒ UDP의 경우, ACK를 수행하지 않음.

(Stallings 10th ed.) p.512 Fig.15.11

- Small data의 경우

transmit  time-out  retransmit

UDP:

connection transmit ack.

TCP:

Big data의 경우

connection    transmit    ack.

transmit  time-out  retransmit

UDP:

TCP:

▪Why TCP?

- 특징

① Three-way handshake for establishing a connection.

② Error detection and correction for each packet exchanged.

⇒ High communication overhead for reliable data transfer.

- TCP header: complicate

0 15			16 31
source port no.			destination port no.
seq. no.
ack. no.
header len.	resv.	flags	window
checksum(CRC)			urgent pointer
options
～ data ～

(Stallings 10th ed.) p.509 Fig.15.10

- TCP provides

① connection: a logical end-to-end connection between two TCP modules.

⇒ 3-way handshake

․ 3 segments are exchanged.

(segment: the unit of data exchanged bet. cooperating TCP modules)

․ flags used:

U  A  E  R  S  F

R  C  O  S  Y  I

G  K  M  T  N  N

ⓐThe ACK bit:

0: Indicate that the piggyback ack. no. field is not in use.

1: Indicate that ACK is sent.

ⓑThe SYN bit: Indicate that a connection is establishing.

The connection request has SYN=1 and ACK=0.

The connection reply has SYN=1 and ACK=1.

ⓒThe FIN bit: Used to release a connection.

⇒ Indicate that the sender has no more data.

ⓓThe RST bit: Used to reset a connection.

ⓔThe EOM bit: Used to indicate the end of message.

ⓕThe URG bit: Used for urgent pointer.

Host A's TCP		Host B's TCP
SYN=1, ACK=0, seq. no.=0, (ISN - initial seq. no., usually 0) no data	①	(B knows A's request and what seq. no. A will use as a starting no. for its segment)
(A knows B is alive and what seq. no. B will start with.)	②	SYN=1, ACK=1, seq. no.=0, no data (B's segment acknowledges the receipt of A's segment.)
ACK=1, seq. no.=1, data (the first real byte of data sent is ISN+1 (usually 1).)	③	"data transfer has begun."

② reliability: PAR(positive acknowledgement with retransmission)

․ If the data is received "undamaged" (by checking the CRC checksum), the receiver send an ACK back to the sender.

․ If the data is received "damaged", the receiver discards it.

After an appropriate time-out period, the sending TCP module "retransmits" any segment for which no ACK has been received. (ARQ)

③ a continuous stream of bytes.

⇒ Each byte is numbered sequentially starting from the ISN.

․ TCP maintain the sequence using the seq. no. and ack. no. field bet. the sender and receiver.

⇒ The seq. no. field identifies the sequential position in the data stream of the "first" data byte in the segment.

⇒ The ack. no. field is the seg. no. of the "last" byte received.

1 4000	4001 6000
1st segment	2nd segment

ex)

the sender set the seg. no. field
	1		4001
			1000

the receiver set the ack. no. and window field
	1		1001
	4000		6000

1 1000	1001 3000
1st segment	2nd segment

⇒  The window field contains the no. of bytes the receiver is able to accept.

ⓐ The sender can continue sending segments as long as

the total no. of bytes it sends〈 the window size

ⓑ The receiver "controls" the flow of bytes by changing the size of the window.

ex) window size = 0 ;	the receiver's buffer is full.

⇒ The sender muse "cease" transmission until it receives a non-zero window value.

Appendix 2. The Application Layer

User Services

∙ FTP, Telnet, SMTP, HTTP etc.

HTTP

∙ Overview

Browser

Client

Server

User

HTML files

Web Server

①request

②response

HTTP

- Default port no.: 80

∙ Request

- Format

Request Line

Request Header Field

Entity Body

① Request Line

<METHOD>	: 요청방식 - GET/POST

<RESOURCE IDENTIFIER>	: 요청하는 file

<HTTP VERSION>

<cr/lf>	;  a carriage-return/line-feed char.

- GET: To access a Web page, a client sends a GET request.

- POST: To send the contents of a Web form, a client uses the POST request.

EX) HTML form request methods

<FORM METHOD=POST ACTION="URL">

……

</FORM>

② Request Header Field: 부가적 정보 전송

NAME: VALUE<crlf>

③ Entity Data: optional 정보 전송

Ex) Request Format

GET /index.html HTTP/1.1

accept-language:ko

host:127.0.0.1

accept:*/*

user-agent:Mozilla/4.0(compatible; MSIE 5.0; Windows NT 5.0)

connection:Keep-Alive

accept-encoding:gzip, deflate

∙ Response

- Format

Response Header

Header Field

Entity Body

① Response Header

<HTTP Version>

<result code>	: success/fail 표시

OK - 200, error no. - 404 (can't find)

[<explanation>]

<cr/lf>

② Field: server의 속성과 HTML 문서에 관한 정보 전송 - NAME: VALUE<crlf>

③ Entity Body: user가 요청한 *.html file

Ex) Response Format

HTTP/1.1 200 OK

Date: Mon, 26 Nov 2001 06:57:11 GMT

Content-type: text/html

<HTML>

<HEAD><TITLE><\TITLE><\HEAD>

<BODY>

…

<\BODY>

<\HTML>