Room 817, Ho Sin Hang Engineering Building Email: [email protected]

47
© P.C. Wong Transparency No.2-1 Room 817, Ho Sin Hang Engineering Building Email: [email protected] URL: http://learning.hkedcity.net/ieg1001/ Information Engineering in Information Engineering in Society Society Chapter #2 : The Internet Chapter #2 : The Internet and TCP/IP and TCP/IP Prof. P.C. Wong Department of Information Engineering The Chinese University of Hong Kong 2003

description

Information Engineering in Society Chapter #2 : The Internet and TCP/IP Prof. P.C. Wong Department of Information Engineering The Chinese University of Hong Kong 2003. Room 817, Ho Sin Hang Engineering Building Email: [email protected] URL: http://learning.hkedcity.net/ieg1001/. - PowerPoint PPT Presentation

Transcript of Room 817, Ho Sin Hang Engineering Building Email: [email protected]

Page 1: Room 817, Ho Sin Hang Engineering Building Email: pcwong@ie.cuhk.hk

© P.C. Wong Transparency No.2-1

Room 817, Ho Sin Hang Engineering BuildingEmail: [email protected]: http://learning.hkedcity.net/ieg1001/

Information Engineering in Information Engineering in SocietySociety

Chapter #2 : The Internet and Chapter #2 : The Internet and TCP/IP TCP/IP

Prof. P.C. Wong Department of Information EngineeringThe Chinese University of Hong Kong

2003

Page 2: Room 817, Ho Sin Hang Engineering Building Email: pcwong@ie.cuhk.hk

© P.C. Wong Transparency No.2-2

What do you need to know?

1. Internet – a network of networks.

2. Protocol – data format, procedures for communications.

3. Internet hosts have domain names and IP addresses.

4. IP address – 4 byte represented by (n.n.n.n)

5. Information is carried by IP packets up to 64 Kbytes each.

6. IP packets are routed independently to the destination (packet switching) based on the IP address on the packet.

7. There are two common transport protocols – TCP and UDP.

a. TCP – connection oriented.

b. UDP – connectionless (datagram)

8. Applications (e.g., FTP) are run on top of TCP or UDP. Application data is put into TCP segments or UDP datagrams.

9. TCP and UDP data is put into IP packets for delivery.

Page 3: Room 817, Ho Sin Hang Engineering Building Email: pcwong@ie.cuhk.hk

© P.C. Wong Transparency No.2-3

Outline

1. What is Internet?

2. How is Internet connected?

3. How to send data on the Internet?

4. How are Internet applications supported?

Page 4: Room 817, Ho Sin Hang Engineering Building Email: pcwong@ie.cuhk.hk

© P.C. Wong Transparency No.2-4

Net 1Net 1Net 2Net 2

Net 3Net 3

What is Internet?

Email

Servers

Inter-Net – An interconnected network of networks

Page 5: Room 817, Ho Sin Hang Engineering Building Email: pcwong@ie.cuhk.hk

© P.C. Wong Transparency No.2-5

Net 1Net 1Net 2Net 2

Net 3Net 3

World-wide-web (www)

An Overlay Network of Linked Web Documents

http://www.ie.cuhk.edu.hk

Page 6: Room 817, Ho Sin Hang Engineering Building Email: pcwong@ie.cuhk.hk

© P.C. Wong Transparency No.2-6

.COM – commercial

.NET - network

.GOV – government

.EDU – education

.ORG - organisation

.MIL - military

.BIZ - business

.INFO - information

.hk - hong kong

.cn - china

.tw – taiwanWhat about go.to?

www.hkcampus.netwww.hkedcity.net

www.hkcampus.netwww.hkedcity.net

Internet Domains

http://www.networksolutions.com

http://www.hkdnr.net.hk

Top domains

Hong Kong domains

Page 7: Room 817, Ho Sin Hang Engineering Building Email: pcwong@ie.cuhk.hk

© P.C. Wong Transparency No.2-7

Internet – the largest Wide Area Network

Internet: A worldwide network of networks

1. Initiated by Defense Advanced Research Projects Agency

ARPANET, later developed into the NSFnet

2. Connecting [Jul 2002] 162,128,493 hosts all over the world The number still doubles every two year.

Each host has a unique IP address.

3. The protocol suite - TCP/IP (1973-4)

4. Basic services - EMAIL, FTP, TELNET (1970)

5. Popular applications - Web (1990), Video Streaming via RTSP(1998),

Video Conferencing via H.323, and Voice over IP.

Page 8: Room 817, Ho Sin Hang Engineering Building Email: pcwong@ie.cuhk.hk

© P.C. Wong Transparency No.2-8

“Cool” internet appliances

World’s smallest web serverhttp://www-ccs.cs.umass.edu/~shri/iPic.html

IP picture framehttp://www.ceiva.com/

Web-enabled toaster+weather forecaster

Page 9: Room 817, Ho Sin Hang Engineering Building Email: pcwong@ie.cuhk.hk

© P.C. Wong Transparency No.2-9

Source: Computer Industry Almanac IncSource: Computer Industry Almanac Inc

Internet Connectivity

Million of Hosts

39

151

319

717

0

100

200

300

400

500

600

700

800

1995 1998 2000 2005

300 million

Page 10: Room 817, Ho Sin Hang Engineering Building Email: pcwong@ie.cuhk.hk

© P.C. Wong Transparency No.2-10

What’s the Internet: “nuts and bolts” view

1. millions of connected computing devices: hosts, end-systems

a. PCs workstations, servers

b. PDAs phones, toasters

running network apps

2. communication links

a. fiber, copper, radio, satellite

b. transmission rate = bandwidth

3. routers: forward packets (chunks of data)

local ISP

companynetwork

regional ISP

router workstation

servermobile

Page 11: Room 817, Ho Sin Hang Engineering Building Email: pcwong@ie.cuhk.hk

© P.C. Wong Transparency No.2-11

What’s the Internet: “nuts and bolts” view

1. protocols control sending, receiving of msgs

a. e.g., TCP, IP, HTTP, FTP, PPP

2. Internet: “network of networks”

a. loosely hierarchical

b. public Internet versus private intranet

3. Internet standards

a. RFC: Request for comments

b. IETF: Internet Engineering Task Force

local ISP

companynetwork

regional ISP

router workstation

servermobile

Page 12: Room 817, Ho Sin Hang Engineering Building Email: pcwong@ie.cuhk.hk

© P.C. Wong Transparency No.2-12

What’s a protocol?

human protocols:

1. “what’s the time?”

2. “I have a question”

3. introductions

… specific msgs sent

… specific actions taken when msgs received, or other events

network protocols:

1. machines rather than humans

2. all communication activity in Internet governed by protocols

Protocols define format, order of msgs sent and received among network entities, and actions taken on msg transmission, receipt

Page 13: Room 817, Ho Sin Hang Engineering Building Email: pcwong@ie.cuhk.hk

© P.C. Wong Transparency No.2-13

What’s a protocol?

a human protocol and a computer network protocol:

Hi

Hi

Got thetime?

2:00

TCP connection reqTCP connectionresponseGet http://www.awl.com/kurose-ross

<file>time

Page 14: Room 817, Ho Sin Hang Engineering Building Email: pcwong@ie.cuhk.hk

© P.C. Wong Transparency No.2-14

What do we do with the Internet?

E-mail

Servers

Web Browsing

Instant Messaging

File Transfer

Page 15: Room 817, Ho Sin Hang Engineering Building Email: pcwong@ie.cuhk.hk

© P.C. Wong Transparency No.2-15

Many more applications!

Peer-to-peer applications Napster, Gnutella, Kazaa file exchange Searching for ExtraTerrestrial Intelligence (SETI)

Audio & video streaming Network games On-line purchasing Text messaging in PDAs, cell phones (SMS) Voice-over-Internet Online databases eServices, eLearning, Telemedicine, etc.

Page 16: Room 817, Ho Sin Hang Engineering Building Email: pcwong@ie.cuhk.hk

© P.C. Wong Transparency No.2-16

Who defines the Internet?

1. Internet Engineering Task Force (IETF)

a. Develops and reviews specifications intended as Internet standards.

2. Role of Standards

a. Allows interoperability

b. Allows smaller companies to enter large markets

c. Results in increase rate of innovation and evolution of technology and standards

3. Request for Comment (RFC)

a. A formal Internet document concerning an Internet issue

b. State: maturity level of an RFC

c. Status: requirement level of an RFC

http://www.ietf.org

Page 17: Room 817, Ho Sin Hang Engineering Building Email: pcwong@ie.cuhk.hk

© P.C. Wong Transparency No.2-17

Standardization Process

Page 18: Room 817, Ho Sin Hang Engineering Building Email: pcwong@ie.cuhk.hk

© P.C. Wong Transparency No.1-18

How to connect to the Internet?How to connect to the Internet?

Page 19: Room 817, Ho Sin Hang Engineering Building Email: pcwong@ie.cuhk.hk

© P.C. Wong Transparency No.2-19

Net 1Net 1Net 2Net 2

ISPISP

Internet Connectivity

撥號上網 (Dial-up Access)

專線上網 (Leased Line Access)

寬頻上網 (Broadband Access)  

router

ADSL ModemCable ModemEthernet Connection

Page 20: Room 817, Ho Sin Hang Engineering Building Email: pcwong@ie.cuhk.hk

© P.C. Wong Transparency No.2-20

Media and Cabling – How to connect to a network?

1. Cable – allows you to connect devices

2. Connector – standard interfacefor making connections.

Note: We need different cables & connectorsfor different links.

Page 21: Room 817, Ho Sin Hang Engineering Building Email: pcwong@ie.cuhk.hk

© P.C. Wong Transparency No.2-21

What if the distance is too long?

1. Repeater

2. Hub – multiple port repeater

<100m<100m

Signal regenerationSignal regeneration

<100m<100m<100m<100m

<100m<100m<100m<100m

The signal is regenerated on all segments

uplinkuplink

Page 22: Room 817, Ho Sin Hang Engineering Building Email: pcwong@ie.cuhk.hk

© P.C. Wong Transparency No.2-22

Switches and Hub

Number of ports: 8/16/24/…

Nature: Hub or Switch (access/core)

Speed: 10/100/1Gbps

Interfaces: Fiber/Copper

Backplane bus: stackability

Uplink: connecting to core switch

Management: SNMP and web

Others:

redundant supply

control console

Page 23: Room 817, Ho Sin Hang Engineering Building Email: pcwong@ie.cuhk.hk

© P.C. Wong Transparency No.2-23

Ethernet Transmissions• The address of a node as defined by its LAN.

• The address in included in an Ethernet frame of data.

•Ethernet uses a six-byte physical address which is imprinted on the network interface card (NIC)

Transmission with a LAN

Page 24: Room 817, Ho Sin Hang Engineering Building Email: pcwong@ie.cuhk.hk

© P.C. Wong Transparency No.2-24

How can IP packet be sent on a local area network?

Data is divided into frames.

64-1518 bytes

Src address: 6 bytes

Dst address: 6 bytes

Page 25: Room 817, Ho Sin Hang Engineering Building Email: pcwong@ie.cuhk.hk

© P.C. Wong Transparency No.1-25

How to send data on the Internet?How to send data on the Internet?

Page 26: Room 817, Ho Sin Hang Engineering Building Email: pcwong@ie.cuhk.hk

© P.C. Wong Transparency No.2-26

IGS1.IE.CUHK.HK

adnetpc0

137.189.96.37

137.152.96.253

137.152.96.254

137.154.96.250

137.148.96.252

AGS.PWH.HK

IGS2.STH.HK137.150.96.252

137.189.96.131

T-1

137.189.96.252

137.154.96.251

137.148.96.47

137.150.96.48

magnet2.pwh.hk

magnet3.sth.hk

adnet1

Internet Addresses and Domains

Ethernet addressing cannot be used across networks.

Page 27: Room 817, Ho Sin Hang Engineering Building Email: pcwong@ie.cuhk.hk

© P.C. Wong Transparency No.2-27

IP Addressing

The Internet (IP) addressing. Each address is represented by4 bytes, denoting(1) Network address(2) Host address

1100101011001010 0010110100101101 1011011110110111 0000000100000001

202.45.183.1

Network-ID Host-ID

Host address=0 the network, Host address=1s broadcast.

Page 28: Room 817, Ho Sin Hang Engineering Building Email: pcwong@ie.cuhk.hk

© P.C. Wong Transparency No.2-28

Internet Addresses

1 1 1 1 Reserved for future use0

1 1 1 0 Multicast address

1 1 0 netid hostid

1 0 netid hostid

0 netid hostid

Class

A

B

C

D

E

24 bits (16777214)7 bits

14 bits 16 bits (65534)

21 bits 8 bits (254)

CUHK : 137.189.X.X (dotted decimal notation) -> a Class B network

1st Octet netid hostidA 1 - 126 p q.r.sB 128 - 192 p.q r.sC 192 - 223 p.q.r s

Page 29: Room 817, Ho Sin Hang Engineering Building Email: pcwong@ie.cuhk.hk

© P.C. Wong Transparency No.2-29

Subnet Addressing

1100101011001010 1100101011001010 1100101011001010 0111111101111111

IP Address: 202.45.183.127

Subnet Mask: 255.255.255.240

1111111111111111 1111111111111111 1111111111111111 1111000011110000

Result subnet ID: 202.45.183.112

1100101011001010 1100101011001010 1100101011001010 0111000001110000

Subnet range202.45.183.112-1270000 – net ID, 1111 - broadcast

Page 30: Room 817, Ho Sin Hang Engineering Building Email: pcwong@ie.cuhk.hk

© P.C. Wong Transparency No.2-30

Packet delivery on the Internet - Switching and Routing

1. Data is divided into small packets (IP packets)

2. Switching

a. Each packet is examined by a switch/router and forwarded to an output link.

3. Routing

a. The packet is targeted to the destination based on a certain routing path.

Page 31: Room 817, Ho Sin Hang Engineering Building Email: pcwong@ie.cuhk.hk

© P.C. Wong Transparency No.2-31

IP Packet Format

PADDING

SOURCE IP ADDRESS

DESTINATION IP ADDRESS

IP OPTIONS (IF ANY)

FRAGMENT OFFSET

TOTAL LENGTH

IDENTIFICATION

0 8 1631

HLENVERS SERVICE TYPE

FLAGS

HEADER CHECKSUMPROTOCOLTIME TO LIVE

DATA

...

VERS: versionHLEN: header length (32-bit words) TOTAL LENGTH: packet size (octets)

PacketHeader

PacketData

Page 32: Room 817, Ho Sin Hang Engineering Building Email: pcwong@ie.cuhk.hk

© P.C. Wong Transparency No.2-32

How are IP packets routed in a network?

magnet2.pwh.hk

IGS1.IE.CUHK.HK

137.152.96.253

137.152.96.254

137.154.96.250

137.148.96.252

AGS.PWH.HK

IGS2.STH.HK137.150.96.252

137.189.97.37

T-1

137.189.96.252

137.154.96.251

137.148.96.47

137.150.96.48

magnet3.sth.hk

adnetpc0

(1)

(2)

(3)

(4)

Issues1. Direct delivery vs. indirect delivery

2. Gateway selection

3. Routing table

4. Default routes

5. Host-Specific routes

IP addresswith net_id routing137.152.0.0 directly137.154.0.0 directly137.148.0.0 directly137.150.0.0 137.154.96.250137.189.0.0 137.152.96.254

The Routing table for AGS.PWH.HK

Page 33: Room 817, Ho Sin Hang Engineering Building Email: pcwong@ie.cuhk.hk

© P.C. Wong Transparency No.1-33

How are Internet applications supported?How are Internet applications supported?

Page 34: Room 817, Ho Sin Hang Engineering Building Email: pcwong@ie.cuhk.hk

© P.C. Wong Transparency No.2-34

TCP and UDP?

TCP/IP : (Transmission Control Protocol/Internet Protocol) It is a set of protocols developed and used in the ARPANET, supported by the Defense Advanced Projects Research Agency (DARPA).

It supports two major servicesa. Connectionless packet delivery service (UDP)b. Reliable Stream Transport service (TCP)

It featuresa. Network technology independenceb. Universal interconnectionc. End-to-end acknowledgmentsd. Application protocol standards

Its major applicationsa. e-mail (SMTP)b. file transfer (FTP)c. remote login (TELNET)d. web (HTTP)

physicalnetwork

router orgateway

Page 35: Room 817, Ho Sin Hang Engineering Building Email: pcwong@ie.cuhk.hk

© P.C. Wong Transparency No.2-35

TCP/IP Protocols and Applications

TCP - Transmission Control ProtocolUDP - User Packet ProtocolICMP - Internet Control Message ProtocolIP - Internet ProtocolARP - Address Resolution ProtocolRARP - Reverse ARPSLIP - Serial Line Interface ProtocolPPP - Point-to-point Protocol

IP

Ethernet, FDDI,ATM, etc.

ARP, RARP

ICMP TCP UDP

PPP, SLIP

ApplicationApplication Application

ports

FTP, TELNET, MAIL, Other Applications

Page 36: Room 817, Ho Sin Hang Engineering Building Email: pcwong@ie.cuhk.hk

© P.C. Wong Transparency No.2-36

Relationship of layers and addresses in TCP/IP

Identify a LAN station

Identify a Internet host

Identify an Internet application

Page 37: Room 817, Ho Sin Hang Engineering Building Email: pcwong@ie.cuhk.hk

© P.C. Wong Transparency No.2-37

TCP Port numbers

Decimal Keyword Description015791113202123253742537980103104113117119139

--TCPMUXRJEECHODISCARDUSERSDAYTIMEFTP-DATAFTPTELNETSMTPTIMENAMESERVERDOMAINFINGERHTTPX400X400SNDAUTHUUCP-PATHNNTPNETBIOS-SSN

ReservedTCP multiplexerRemote job entryEchoDiscardActive usersDaytimeFile transfer protocol-dataFile transfer protocolTerminal connectionSimple mail transfer protocolTimeHost name serverDomain name serverFingerWeb serverX.400 Mail ServiceX.400 Mail SendingAuthentication ServiceUUCP Path ServiceUSENET news transfer protocolNETBIOS session service

Page 38: Room 817, Ho Sin Hang Engineering Building Email: pcwong@ie.cuhk.hk

© P.C. Wong Transparency No.2-38

binding: 23-204

1048

TELNET client

23

TELNET Server

7 21

magnet1137.189.96.31

iestp10137.189.96.210

204

TELNET Client

9 208

How can a server support multiple clients?

TCP assigns some well-known ports for communications- server port defines the application.- client port defines the client.

Solution: Connection is identified by a pair of end-points

E.g., (137.189.96.31, 23) and (137.189.96,210, 204)

Page 39: Room 817, Ho Sin Hang Engineering Building Email: pcwong@ie.cuhk.hk

© P.C. Wong Transparency No.2-39

Protocol Layering

Application

Transport

Internet

Interface

Internet

Interface

Physicalnetwork 1

Physicalnetwork 1

Application

Transport

Internet

Interface

Gateway G

frame

packet

datagram or transport segment

Frame Data AreaFrame Header

Packet Header Packet Data Area

Header Transport data

Kernal

User

H/W

Page 40: Room 817, Ho Sin Hang Engineering Building Email: pcwong@ie.cuhk.hk

© P.C. Wong Transparency No.2-40

Internet Connection via TCP

Page 41: Room 817, Ho Sin Hang Engineering Building Email: pcwong@ie.cuhk.hk

© P.C. Wong Transparency No.2-41

FTP: File Transfer Protocol

userinterface

user protocol

interpreter

user data transfer

function

serverprotocol

interpreter

serverdata transfer

functionfile systemfile system

user at aterminal

ServerClient

controlconnection

dataconnection

21

20

Commands 3 or 4 bytes NVT ASCII w/wo arguments

Replies 3-digit numbers, optional messages ASCII

Page 42: Room 817, Ho Sin Hang Engineering Building Email: pcwong@ie.cuhk.hk

© P.C. Wong Transparency No.2-42

FTP commands (NVT ASCII)

ABOR

LIST filelist

PASS password

PORT n1,n2,n3,...,n6

QUIT

RETR filename

STOR filename

SYST

TYPE type

USER username

abort previous FTP command and any data transfer

list files or directory

password on server

client IP address (n1..n4) and port (n5x256+n6)

logoff from server

retrieve (get) a file

store (put) a file

server returns system type

specify file type:A (for ascii) I (for image)

username on server

Name Meaning

Page 43: Room 817, Ho Sin Hang Engineering Building Email: pcwong@ie.cuhk.hk

© P.C. Wong Transparency No.2-43

FTP commands and replies

/data/staff/pcwong> ftp -d magnet1Connected to magnet1.220 magnet1 FTP server (SunOS 4.1) ready.Name (magnet1:pcwong): pcwong---> USER pcwong331 Password required for pcwong.Password:---> PASS rachel41230 User pcwong logged in.ftp> dir cantoni.1---> PORT 137,189,96,21,11,33200 PORT command successful.---> LIST cantoni.1150 ASCII data connection for /bin/ls (137.189.96.21,2849) (0 bytes).-rw-r--r-- 1 pcwong staff 1953 Nov 10 18:16 cantoni.1226 ASCII Transfer complete. �remote: cantoni.165 bytes received in 0.11 seconds (0.56 Kbytes/s)ftp> get cantoni.1---> PORT 137,189,96,21,11,34200 PORT command successful.---> RETR cantoni.1150 ASCII data connection for cantoni.1 (137.189.96.21,2850) (1953 bytes).226 ASCII Transfer complete.local: cantoni.1 remote: cantoni.12009 bytes received in 0.051 seconds (39 Kbytes/s)

Page 44: Room 817, Ho Sin Hang Engineering Building Email: pcwong@ie.cuhk.hk

© P.C. Wong Transparency No.2-44

1. User clicks on http://www.singtao.com/

2. Ethereal network analyzer captures all frames observed by its Ethernet NIC

3. Sequence of frames and contents of frame can be examined in detail down to individual bytes

How do protocols work together?

Internet

http://www.ethereal.com/http://www.ethereal.com/

Page 45: Room 817, Ho Sin Hang Engineering Building Email: pcwong@ie.cuhk.hk

© P.C. Wong Transparency No.2-45

Top Pane shows

frame/packet sequence

Middle Pane shows encapsulation for a

given frame

Bottom Pane shows hex & text

Page 46: Room 817, Ho Sin Hang Engineering Building Email: pcwong@ie.cuhk.hk

© P.C. Wong Transparency No.2-46

What do you need to know?

1. Internet – a network of networks.

2. Protocol – data format, procedures for communications.

3. Internet hosts have domain names and IP addresses.

4. IP address – 4 byte represented by (n.n.n.n)

5. Information is carried by IP packets up to 64 Kbytes each.

6. IP packets are routed independently to the destination (packet switching) based on the IP address on the packet.

7. There are two common transport protocols – TCP and UDP.

a. TCP – connection oriented.

b. UDP – connectionless (datagram)

8. Applications (e.g., FTP) are run on top of TCP or UDP. Application data is put into TCP segments or UDP datagrams.

9. TCP and UDP data is put into IP packets for delivery.

Page 47: Room 817, Ho Sin Hang Engineering Building Email: pcwong@ie.cuhk.hk

© P.C. Wong Transparency No.1-47

Thank YouThank You