3. internetworking (part 3: ip) rocky k. c. chang department of computing the hong kong...

49
3. INTERNETWORKING (PART 3: IP) Rocky K. C. Chang Department of Computing The Hong Kong Polytechnic University 18 February 2016 1

Upload: cathleen-marsh

Post on 20-Jan-2018

213 views

Category:

Documents


0 download

DESCRIPTION

3 1. The internetworking problem S2 S1 H4 H5 H3 H2 H1 Network 2 (Ethernet) Network 1 (Ethernet) H6 Network 3 (FDDI) Network 4 (point-to-point) H7S3H8

TRANSCRIPT

Page 1: 3. INTERNETWORKING (PART 3: IP) Rocky K. C. Chang Department of Computing The Hong Kong Polytechnic…

1

3. INTERNETWORKING (PART 3: IP)Rocky K. C. ChangDepartment of ComputingThe Hong Kong Polytechnic University

18 February 2016

Page 2: 3. INTERNETWORKING (PART 3: IP) Rocky K. C. Chang Department of Computing The Hong Kong Polytechnic…

2

1. The internetworking problem• Problem: How to interconnect heterogeneous networks

effectively?• Three problems with interconnection at the data-link layer:

• Do not scale to the number of data-link technologies. • Do not scale to the number of hosts (or networks).• Do not have a common addressing space.

Page 3: 3. INTERNETWORKING (PART 3: IP) Rocky K. C. Chang Department of Computing The Hong Kong Polytechnic…

3

1. The internetworking problem

S2

S1

H4

H5

H3H2H1

Network 2 (Ethernet)

Network 1 (Ethernet)

H6

Network 3 (FDDI)

Network 4(point-to-point)

H7 S3 H8

Page 4: 3. INTERNETWORKING (PART 3: IP) Rocky K. C. Chang Department of Computing The Hong Kong Polytechnic…

4

1.1 A layer-three internetworking solution

• Use IP, XNS, IPX, etc on top of the networks.• Replace LAN switches with layer-three switches, more

commonly known as routers.• Add IP software to each end host (with the whole protocol

suite software).• Assign an IP address to each network interface.

Page 5: 3. INTERNETWORKING (PART 3: IP) Rocky K. C. Chang Department of Computing The Hong Kong Polytechnic…

5

1.1 A layer-three internetworking solution

R2

R1

H4

H5

H3H2H1

Network 2 (Ethernet)

Network 1 (Ethernet)

H6

Network 3 (FDDI)

Network 4(point-to-point)

H7 R3 H8

Page 6: 3. INTERNETWORKING (PART 3: IP) Rocky K. C. Chang Department of Computing The Hong Kong Polytechnic…

6

2. Encapsulation and address binding• To transmit IP datagrams over any data-link network, two

requirements are needed:• A standard way to encapsulate IP datagrams• Address resolution between IP addresses and MAC addresses

• Standard RFCs for specifying datagram encap-sulations and possibly address resolutions, e.g., Ethernet (RFC 894), IEEE 802 (RFC 1042), etc.

• A shared medium uses an Address Resolution Protocol (ARP) for address binding.

Page 7: 3. INTERNETWORKING (PART 3: IP) Rocky K. C. Chang Department of Computing The Hong Kong Polytechnic…

7

2.1 Data encapsulation• You have seen from chapter 2

• IP over DIX Ethernet• IP over IEEE 802.3• IP over PPP

• Others are in the RFC documents

Page 8: 3. INTERNETWORKING (PART 3: IP) Rocky K. C. Chang Department of Computing The Hong Kong Polytechnic…

8

2.2 Address resolution protocol• An ARP request message is data-link broadcasted on the

LAN with the target IP address.• Every IP host picks up a copy of the message and

examine the target IP address.• If matching its IP address, send an ARP reply message back to the

sender with its MAC address.• Else, drop the message.

• To reduce broadcast traffic, each host uses an ARP cache to remember the recent binding.

Page 9: 3. INTERNETWORKING (PART 3: IP) Rocky K. C. Chang Department of Computing The Hong Kong Polytechnic…

9

2.2 Address resolution protocol

TargetHardwareAddr (bytes 2 – 5)

TargetProtocolAddr (bytes 0 – 3)

SourceProtocolAddr (bytes 2 – 3)

Hardware type = 1 ProtocolType = 0x0800

SourceHardwareAddr (bytes 4 – 5)

TargetHardwareAddr (bytes 0 – 1)

SourceProtocolAddr (bytes 0 – 1)

HLen = 48 PLen = 32 Operation

SourceHardwareAddr (bytes 0 – 3)

0 8 16 31

Page 10: 3. INTERNETWORKING (PART 3: IP) Rocky K. C. Chang Department of Computing The Hong Kong Polytechnic…

10

2.3 An internetworking example• On each “hop or link,” both data encapsulation and

address resolution occur.

R1

ETH FDDI

IPIP

ETH

TCP R2

FDDI PPP

IP

R3

PPP ETH

IP

H1

IP

ETH

TCP

H8

Page 11: 3. INTERNETWORKING (PART 3: IP) Rocky K. C. Chang Department of Computing The Hong Kong Polytechnic…

11

3. The IP service model• The IP service model consists of

• an addressing scheme to identify an IP host, and• a datagram (connectionless) model of data delivery.

• IP provides a best-effort service.• IP makes its best effort to send a datagram to its destination.• The best-effort service does not guarantee reliable datagram

delivery, i.e., an unreliable service.

Page 12: 3. INTERNETWORKING (PART 3: IP) Rocky K. C. Chang Department of Computing The Hong Kong Polytechnic…

12

3.1 Internet protocol suite (incomplete)

FTP HTTP NV TFTP

TCP UDP

IP

NET1 NET2 NETn

Application

Transport

Network

Data-link

ICMP IGMP

ARP & RARP

Ping DNS

RTPSSL

Page 13: 3. INTERNETWORKING (PART 3: IP) Rocky K. C. Chang Department of Computing The Hong Kong Polytechnic…

13

4. IP datagramVersion HLen TOS Length

Ident Flags Offset

TTL Protocol Checksum

SourceAddr

DestinationAddr

Options (variable) Pad(variable)

0 4 8 16 19 31

Data

Page 14: 3. INTERNETWORKING (PART 3: IP) Rocky K. C. Chang Department of Computing The Hong Kong Polytechnic…

14

4. IP datagram• Version: 4 for the current IP.• Type of service (TOS) for specifying how a router should

handle this datagram.• Header length handles a variable-length header.

• 20-byte IP header without IP options• A 16-bit length limits the size of an IP datagram to 65,535

bytes, including the IP header.• Identification, flags, and offset are used for packet

fragmentation and reassembly.

Page 15: 3. INTERNETWORKING (PART 3: IP) Rocky K. C. Chang Department of Computing The Hong Kong Polytechnic…

15

4. IP datagram• Time to live (TTL) limits the the number of times that a

datagram processed by routers.• Protocol specifies the type of payload, e.g., 6 for TCP and

17 for UDP.• Checksum is a 16-bit word checksum.• IP options, e.g.,

• Source routing• Record route

Page 16: 3. INTERNETWORKING (PART 3: IP) Rocky K. C. Chang Department of Computing The Hong Kong Polytechnic…

16

5. MTU and packet fragmentation• Each network chooses a maximum packet size that can

be sent on it, Maximum Transmission Unit (MTU). For example,• 1500 bytes for 10-Mbps Ethernet• 4352 bytes for FDDI• 17914 bytes for 16-Mbps token ring

• Note that all MTUs are smaller than IP datagram’s maximum size.

• One internetworking problem is to accommodate various MTU values.

Page 17: 3. INTERNETWORKING (PART 3: IP) Rocky K. C. Chang Department of Computing The Hong Kong Polytechnic…

17

5. MTU and packet fragmentation• To send datagrams to a directly attached host, use the

network’s MTU.• To send datagrams to a nondirectly attached host, use the

path MTU.• Path MTU is the minimum of the networks’ MTUs on the path from

the source to destination.• If the actual MTU used is larger than the path MTU,

packet fragmentation occurs.• Fragmentation occurs when a router attempts to forward it to a

network with a smaller MTU.

Page 18: 3. INTERNETWORKING (PART 3: IP) Rocky K. C. Chang Department of Computing The Hong Kong Polytechnic…

18

5. MTU and packet fragmentation

H1 R1 R2 R3 H8

ETH IP (1400) FDDI IP (1400) PPP IP (512)

PPP IP (376)

PPP IP (512)

ETH IP (512)

ETH IP (376)

ETH IP (512)

Page 19: 3. INTERNETWORKING (PART 3: IP) Rocky K. C. Chang Department of Computing The Hong Kong Polytechnic…

19

Ident = x Offset = 0

Start of header

0

Rest of header

1400 data bytes

(a)

Ident = x Offset = 0

Start of header

1

Rest of header

512 data bytes

(b)

Ident = x Offset = 512

Start of header

1

Rest of header

512 data bytes

Ident = x Offset = 1024

Start of header

0

Rest of header

376 data bytes

Page 20: 3. INTERNETWORKING (PART 3: IP) Rocky K. C. Chang Department of Computing The Hong Kong Polytechnic…

20

5. MTU and packet fragmentation• Each IP fragment contains enough information for

forwarding to the destination.• A fragmented IP datagram will be reassembled only at the

destination node.• If any fragments do not arrive within a certain time, other

received fragments in the datagram will be discarded.• Fragmentation could occur multiple times to an IP

datagram.

Page 21: 3. INTERNETWORKING (PART 3: IP) Rocky K. C. Chang Department of Computing The Hong Kong Polytechnic…

21

6. IP subnets• IP subnets introduce additional levels within an IP

network:• A network address, a subnet ID, and a host ID.

• IP subnets offer flexibility in allocating addresses to different sizes of sub-networks.

• A subnet mask is used to indicate which bits are referred to the network and subnet ID.• Each network interface stores subnet mask and its unicast IP

address.

Page 22: 3. INTERNETWORKING (PART 3: IP) Rocky K. C. Chang Department of Computing The Hong Kong Polytechnic…

22

6. IP subnets• Subnetting for a class B address:

Network number Host number

Class B address

Subnet mask (255.255.255.0)

Subnetted address

1111111111111111 11111111 00000000

Network number Host IDSubnet ID

Page 23: 3. INTERNETWORKING (PART 3: IP) Rocky K. C. Chang Department of Computing The Hong Kong Polytechnic…

23

6. IP subnetsSubnet mask: 255.255.255.128Subnet number: 128.96.34.0

128.96.34.15128.96.34.1

H1R1

128.96.34.130 Subnet mask: 255.255.255.128Subnet number: 128.96.34.128

128.96.34.129128.96.34.139

R2H2

128.96.33.1128.96.33.14

Subnet mask: 255.255.255.0Subnet number: 128.96.33.0

H3

Page 24: 3. INTERNETWORKING (PART 3: IP) Rocky K. C. Chang Department of Computing The Hong Kong Polytechnic…

24

7. IP forwarding mechanisms• Assume that both routers and hosts already have

appropriate routing tables in place.• Routing tables for routers are constructed from routing protocols.• Routing tables for hosts are constructed from other means.

• Problem: Given a routing table, how do hosts and routers forward datagrams?

Page 25: 3. INTERNETWORKING (PART 3: IP) Rocky K. C. Chang Department of Computing The Hong Kong Polytechnic…

25

7.1 Examples of routing tables• For example, R1’s routing table:

• Network/SubnetSubnet Mask Next Hop• 128.96.34.0 255.255.255.128 upper int.• 128.96.34.128 255.255.255.128 lower int.• 128.96.33.0 255.255.255.0 128.96.34.129

• For example, H1’s routing table:• Network/SubnetSubnet Mask Next Hop• 128.96.34.0 255.255.255.128 upper int.• 0.0.0.0 0.0.0.0 128.96.34.1

Page 26: 3. INTERNETWORKING (PART 3: IP) Rocky K. C. Chang Department of Computing The Hong Kong Polytechnic…

26

7.2 Host’s forwarding mechanisms• A host sends a datagram to another host on the same

LAN or not.• In the former, it sends the datagram to the destination directly.• In the latter, it sends the datagram to a default router.• In both cases, the host uses ARP cache or ARP to find out the

corresponding MAC addresses.

Page 27: 3. INTERNETWORKING (PART 3: IP) Rocky K. C. Chang Department of Computing The Hong Kong Polytechnic…

27

7.3 A general forwarding mechanismD = Destination IP address

for each entry (Network/Subnet ID, Subnet Mask, Next Hop)

D1 = Subnet mask & D

if D1 = Network/Subnet ID

if Next Hop is an interface

deliver datagram directly to destination

else

deliver datagram to Next Hop (a router)

Page 28: 3. INTERNETWORKING (PART 3: IP) Rocky K. C. Chang Department of Computing The Hong Kong Polytechnic…

28

7.4 Characteristics of IP forwarding• Both hosts and routers are involved in forwarding.

• Compared with routers, a host makes a much simpler binary decision.

• IP forwarding is done on a hop-by-hop basis.• It is assumed that the next-hop router is really closer to

the destination.• IP forwarding is able to specify a route to a network, and

not have to specify a route to every host.

Page 29: 3. INTERNETWORKING (PART 3: IP) Rocky K. C. Chang Department of Computing The Hong Kong Polytechnic…

29

8. The routing problem• Problem: How does a router construct its routing table for

IP forwarding?• Forwarding vs routing

• Routing is the process by which forwarding tables are built.• Forwarding table vs routing table

• A routing table is built by routing protocols as a precursor to building the forwarding table.

• A forwarding table consists of detail enough information to speed up datagram forwarding.

Page 30: 3. INTERNETWORKING (PART 3: IP) Rocky K. C. Chang Department of Computing The Hong Kong Polytechnic…

30

8.1 Internet topology

Backbone service provider

Peeringpoint

Peeringpoint

Large corporation

Large corporation

Smallcorporation

“Consumer ” ISP

“Consumer” ISP

“ Consumer” ISP

Page 31: 3. INTERNETWORKING (PART 3: IP) Rocky K. C. Chang Department of Computing The Hong Kong Polytechnic…

31

8.1 Internet topology• Major components in the Internet topology:

• Autonomous system (AS), e.g., polyu.edu.hk, ibm.com, etc.• Internet service providers (ISPs): Local ISPs, regional ISPs,

National ISPs, Backbone ISPs.• Exchange networks: For local traffic interchange, e.g., HKIX.• Some special networks, like Harnet in Hong Kong.• Routers (plus other networks) are usually used to connect these

components together.

Page 32: 3. INTERNETWORKING (PART 3: IP) Rocky K. C. Chang Department of Computing The Hong Kong Polytechnic…

32

8.1 Not all routers are equal • Interior routers: Only know how to route datagrams to

destinations within the same AS.• Border routers: Interface between its AS and other AS:

• A nonbackbone router usually has a “default route” to another “more knowledgeable” router for “unknown destinations.”

• A backbone router is supposed to know every IP network in the Internet.

• Intradomain routing vs Interdomain routing

Page 33: 3. INTERNETWORKING (PART 3: IP) Rocky K. C. Chang Department of Computing The Hong Kong Polytechnic…

33

8.2 Distance vector routing protocols

• Each node does two things:• It constructs a one-dimensional array (a vector) containing the

“distances” (costs) to all other nodes.• It distributes the vector to its immediate neighbors.

• Each node’s vector initially consists of• a distance of 0 for reaching itself, and• a distance of infinity for reaching other nodes.

• When the algorithm converges, each node knows for each destination node • (1) the next node closer to the destination, and• (2) the associated cost for this path.

Page 34: 3. INTERNETWORKING (PART 3: IP) Rocky K. C. Chang Department of Computing The Hong Kong Polytechnic…

34

8.2.1 An example

D

G

A

F

E

B

C

Page 35: 3. INTERNETWORKING (PART 3: IP) Rocky K. C. Chang Department of Computing The Hong Kong Polytechnic…

35

8.2.1 An example• Node A’s routing table (using hop count as the cost)

1. Initially 3. After convergence

Destination Cost Next hop Destination Cost Next hopA 0 A A 0 A

B 1 B2. After talking with its neighbors C 1 C

D 2 CDestination Cost Next hop E 1 E

A 0 A F 1 FB 1 B G 2 FC 1 CE 1 EF 1 F

Page 36: 3. INTERNETWORKING (PART 3: IP) Rocky K. C. Chang Department of Computing The Hong Kong Polytechnic…

36

8.2.2 Dynamic routing• Each node periodically sends its distance vector to its

neighbor (periodic updates).• If link A-C fails,

• The cost in A’s entry to C becomes infinity.• B will advertise to A a path to C with cost 1.• F will advertise to A a path to C with cost 2.• Therefore, A’ entry to C is updated to: Next hop = B and cost = 2.

Page 37: 3. INTERNETWORKING (PART 3: IP) Rocky K. C. Chang Department of Computing The Hong Kong Polytechnic…

37

8.2.2 Dynamic routing• Each node may send an updated distance vector to its

neighbor, triggered by external events (triggered updates).• If link A-C fails,

• The cost in A’s entry to C becomes infinity.• A will immediately send its updated vector to B, E, F.• This update does not affect B’s routing table. • However, E will update its entry to C from 2 to infinity, and then

from infinity to 3; and similarly for F.

Page 38: 3. INTERNETWORKING (PART 3: IP) Rocky K. C. Chang Department of Computing The Hong Kong Polytechnic…

38

8.2.3 Routing loops• If the link A-E fails,

• The corresponding entry in A is updated.• A triggered update from A, and periodic updates from B, C, and F.• Possible timing (>: earlier than):

• Case 1: A > B and A > C and A > F• Case 2: A > B and A > C but A < F• Case 3: A > B and A > F, but A < C

• In case 1, all nodes will eventually conclude that E is unreachable.• In case 2, a routing loop between A and F forms.

Page 39: 3. INTERNETWORKING (PART 3: IP) Rocky K. C. Chang Department of Computing The Hong Kong Polytechnic…

39

8.2.3 Routing loops• In case 3, a routing loop between A and C forms.

• In both cases 2 and 3, the cost to E keeps on increasing.• One solution to this problem is to declare the link unusable when the

cost reaches, say, 16 (count to infinity).• Split horizon is another solution to solving 2-node routing

loop.• A node will not advertise a route back to another node that serves as

the next hop for that route.• For example, B, C, F will not advertise their routes to E back to A.

Page 40: 3. INTERNETWORKING (PART 3: IP) Rocky K. C. Chang Department of Computing The Hong Kong Polytechnic…

40

8.2.4 Routing information protocol (RIP)

• RIP implements the distance vector approach.• A hop count of 16 is interpreted as infinity.• Each RIP router broadcasts its distance vectors to its

neighbors every 30 seconds.• RIP is implemented at the application level.

• Common daemons used on the Unix systems are the programs routed and gated.

• RIP packets are carried over UDP and IP.

Page 41: 3. INTERNETWORKING (PART 3: IP) Rocky K. C. Chang Department of Computing The Hong Kong Polytechnic…

41

8.3 Link state routing protocols• In this approach, every nodes maintains the network

topology information in a link state database.• Thus, this approach relies on two mechanisms:

• A reliable flooding for dissemination of link-state information, and• a shortest-path algorithm for computing routes.

Page 42: 3. INTERNETWORKING (PART 3: IP) Rocky K. C. Chang Department of Computing The Hong Kong Polytechnic…

42

8.3.1 An example

D

G

A

F

E

B

C

Page 43: 3. INTERNETWORKING (PART 3: IP) Rocky K. C. Chang Department of Computing The Hong Kong Polytechnic…

43

8.3.1 An example• Link state database:

From To Metric Seq. NumberA B 1 1A C 1 1A D 1 1A E 1 1A F 1 1A G 1 1B A 1 1B C 1 1B D 1 1B E 1 1B F 1 1B G 1 1: : : :: : : :

Page 44: 3. INTERNETWORKING (PART 3: IP) Rocky K. C. Chang Department of Computing The Hong Kong Polytechnic…

44

8.3.2 Link state updates• The link state can be based on any metric, including hop

count, latency, throughput, monetary cost, etc.• When a link state is changed, say from 1 to 2 for AE, A

will send this update to all other nodes through a reliable flooding scheme.• A sends the update to B, C, F.• A ensures the reliable transmission of the update through positive

acknowledgment and retransmission.

Page 45: 3. INTERNETWORKING (PART 3: IP) Rocky K. C. Chang Department of Computing The Hong Kong Polytechnic…

45

8.3.2 Link state updates• B, C, F, upon receiving the update, compare the sequence number of

the update and that in their databases. • If the sequence number in the update is higher, update the link state in the

database, and forward it to other interfaces other than the one where the update is received.

• Otherwise, drop the update and no change in the database.• Although C receives two copies of the update, it forwards only one

copy to D and the other is discarded.• The new link state database becomes

Page 46: 3. INTERNETWORKING (PART 3: IP) Rocky K. C. Chang Department of Computing The Hong Kong Polytechnic…

46

8.3.2 Link state updatesFrom To Metric Seq. NumberA B 1 1A C 1 1A D 1 1A E 2 2A F 1 1A G 1 1B A 1 1B C 1 1B D 1 1B E 1 1B F 1 1B G 1 1: : : :: : : :

Page 47: 3. INTERNETWORKING (PART 3: IP) Rocky K. C. Chang Department of Computing The Hong Kong Polytechnic…

47

8.3.3 Computing optimal paths• Given a link state database for the network topology, each

node can apply any shortest-path algorithms to find optimal paths from itself to other nodes in the network.

• For example, using the hop count as the metric, we have for node A:

Page 48: 3. INTERNETWORKING (PART 3: IP) Rocky K. C. Chang Department of Computing The Hong Kong Polytechnic…

48

8.3.3 Computing optimal paths

A

B

E

F G

C

D

Page 49: 3. INTERNETWORKING (PART 3: IP) Rocky K. C. Chang Department of Computing The Hong Kong Polytechnic…

49

8.3.4 Open shortest path first (OSPF) protocol

• OSPF implements a link state approach.• OSPF supports different type-of-service routing by having

different sets of metric for route computation.• OSPF supports equal-cost routes to a destination.• OSPF reduces the amount of routing update messages as

compared with RIP.• OSPF provides fast and loopless convergence.