43
© MMII JW Ryder CS 428 Computer Networking 1 Reading Make sure you read all of chapter 2 & 3

© MMII JW RyderCS 428 Computer Networking1 Reading Make sure you read all of chapter 2 & 3

Embed Size (px)

Citation preview

© MMII JW Ryder CS 428 Computer Networking 1

Reading Make sure you read all of chapter 2 & 3

© MMII JW Ryder CS 428 Computer Networking 2

Internet Architecture How are networks interconnected to form an

internetwork? We’ve seen how hosts on a single network

interconnect Physically

2 networks attached by a computer that attaches to both of them

Doesn’t guarantee that the computer will cooperate with other hosts

Need computers willing to shuffle packets from one network to another They are internet gateways (internet routers)

© MMII JW Ryder CS 428 Computer Networking 3

IP Routers See figure 3.1 on page 56 (draw) Need to know about topology of internet

beyond connected networks See figure 3.2 on page 57

R 1 must transfer from network 1 to network 2 all packets destined for both network 2 and 3

© MMII JW Ryder CS 428 Computer Networking 4

IP Routers

In a TCP/IP internet, computers called routers or gateways provide all interconnections among physical networks.

Routers are usually small computers with limited memory and disk storage

Trick: Routers use the destination network, not the destination host when routing a packet

© MMII JW Ryder CS 428 Computer Networking 5

IP Routers Amount of information needed to keep is

proportional to the number of networks in the internet not the number of computers

User’s view of internet is single virtual network to which all machines connect

See figure 3.3 on page 59 Advantage of network level interconnection (over

app level) is that application level programs need not be concerned with network details

© MMII JW Ryder CS 428 Computer Networking 6

All Networks are Equal Any communication system capable of

transferring packets counts as a single network Ethernet LAN WAN - ANSNET backbone Point to Point link

How do IP addresses work

© MMII JW Ryder CS 428 Computer Networking 7

Internet Addresses TCP/IP internet, a virtual network built by

interconnecting physical networks with routers

Now we discuss addressing Hides physical network details

© MMII JW Ryder CS 428 Computer Networking 8

Universal Comm. Service Any to any host Needs globally accepted method of computer id Names - What an object is

Addresses - Where it is Route - How to get there

IP addresses - 32 bit integers Chosen to make routing efficient Encodes id of network to which the host attaches as

well as host id itself

© MMII JW Ryder CS 428 Computer Networking 9

IP Addresses Unique 32 bit address used for ALL

communication with that host Simplest view

Each host has unique 32 bit addr Bits of all hosts on a common network share

same prefix Each addr. is a pair (netid, hostid)

netid = network id hostid = host id

© MMII JW Ryder CS 428 Computer Networking 10

IP Address Classes

Class A (000)

Class B (128)

Class C (192)

Class D (224)

Class E (240)

0 netid hostid

1 0 netid hostid

1 1 0 netid hostid

1 1 1 0 multicast address

1 1 1 1 0 reserved for future use

- 2 bits can distinguish between 3 common classes

© MMII JW Ryder CS 428 Computer Networking 11

Address Classes

Class A - Handful of networks that each have more than 216 (65,536) hosts 7 bits to netid, 24 bits to hostid

Class B - Intermediate size networks - between 28 and 216 hosts 14 bits to netid, 16 bits to hostid

Class C - Less than 28 hosts 21 bits to the netid, 8 to hostid

© MMII JW Ryder CS 428 Computer Networking 12

IP Addresses Dealt with as 32 bit addresses Assume following IP Addr. 137.141.152.35 (Decimal) 89.8D.98.23 (Hexadecimal) 1000 1001.1000 1101.1001 1000.0010 0011 (Binary)

Class B (128) 1 0 netid hostid

0 1 2 3 4 . . . 8 . . . 16 . . . 24 . . . 31

1 0 0 0 1 0 0 1 -1 0 0 0 1 1 0 1 - 1 0 0 1 1 0 0 0 - 0 01 0 0 0 1 1

‘898D’x ‘9823’x

2445 38947 decimal

© MMII JW Ryder CS 428 Computer Networking 13

Multi-Homed Hosts A router connects 2 or more physical

networks How is one IP address assigned to the

router??? IP Addr. encode a network and a host A router is a multi-homed host

© MMII JW Ryder CS 428 Computer Networking 14

Network Connections

Routers have 2 or more IP Addresses One for each network on which it resides IP addresses do not specify and individual

computer, but a connection to a network A router connecting n networks has n

distinct IP addresses, one for each network connection

© MMII JW Ryder CS 428 Computer Networking 15

Network Addresses By convention, hostid 0 is never assigned to an

individual host IP addr. with hostid = 0 refers to the network

itself 137.141.0.0 (hostid = 0.0 right??) This allows IP addresses to refer to networks as

well as hosts All bits of hostid = 0 ?

Refers to a network

© MMII JW Ryder CS 428 Computer Networking 16

Broadcast Address Any hostid consisting of strictly 1’s is reserved for

broadcast Broadcast not supported on all networks Early release of Berkeley Unix used all 0’s, still

around Sometime option of specifying 0’s - not

recommended Directed broadcast still correctly identifies the

network but broadcasts to all hosts on a given network

© MMII JW Ryder CS 428 Computer Networking 17

Limited Broadcast 32 bits of 1’s Broadcast only to local network Host may use this prior to knowing its IP addr. at

start up Field of 1’s = ‘All’ Field of 0’s = ‘This’ IP addr. with hostid = 0 refers to ‘this’ host Network id = 0 refers to ‘this’ network

© MMII JW Ryder CS 428 Computer Networking 18

This Receive a packet with netid of dest. addr = 0

and hostid matches its address Interpret to mean ‘this’ network Addressing scheme actually slightly more

intricate Subnetting

© MMII JW Ryder CS 428 Computer Networking 19

Internet Addresses Disadvantages Address refers to network connections Host moves to a different network, it must

change its IP addr. If IP addr referred to host itself the could

move without changing IP addr.

© MMII JW Ryder CS 428 Computer Networking 20

Traveling PC Example

Disconnect your computer from your local network.

Take it with you on a trip Reconnect to an internet at destination PC cannot ‘own’ an IP address because the IP

addr. is associated with the physical network not the host

Do 137.141.152.35 example in Lons le Saunier

© MMII JW Ryder CS 428 Computer Networking 21

Another Disadvantage

Any class C network that grows beyond 255 hosts must change its class to Class B Big pain to change One less Class B network address available

Class C (192)

1 1 0 netid hostid

0 1 2 3 4 . . . 8 . . . 16 . . . 24 . . . 31

© MMII JW Ryder CS 428 Computer Networking 22

Largest Flaw

Not entirely apparent until we do routing Routing is based on internet addresses (IP

addr) with netid portion used to make routing decisions

Multi-homed host Because routing uses the netid portion of IP

addr. the path taken to a multi-homed host will depend entirely upon which IP addr. was supplied

© MMII JW Ryder CS 428 Computer Networking 23

Multiple Routes Multiple names for same host yield packets for same host

behaving differently It may be impossible to reach a dest. even though you

know a valid IP addr.

Network 1

Network 2

R A B

I1 I2 I3

I4 I5

I = IP Addr. R = Router B known by two IP addresses

© MMII JW Ryder CS 428 Computer Networking 24

Dotted Decimals IP Addresses written as 4 decimal integers separated by decimal

points 10000000 00001010 00000010 00011110 is 128 . 10 . 2

. 30 Unix netstat command - displays current routing telnet, ftp - application programs all use dotted decimal notation

Class Lowest Addr. Highest Addr. A 0.1.0.0 126.0.0.0 B 128.0.0.0 191.255.0.0 C 192.0.1.0 223.255.255.0 D 224.0.0.0 239.255.255.255 E 240.0.0.0 247.255.255.255

© MMII JW Ryder CS 428 Computer Networking 25

Loopback Address Not all possible addresses are assigned to

classes 127.0.0.0 not used - Class A Used for loopback - usual addr used is

127.0.0.1 Intended for TCP/IP testing and IPC on local

machine

© MMII JW Ryder CS 428 Computer Networking 26

Special Addresses

All 0’s This host

All 0’s Host Host on this net

All 1’s Limited Broadcast (local net)

Net All 1’s Directed Broadcast for specific network

127 Anything,often 1 Loopback

Limited and Direct Broadcast addresses are never valid source addresses. Length of netid portion of directed broadcast depends on network class. All 0’s only allowed at system start up.

© MMII JW Ryder CS 428 Computer Networking 27

Internet Addressing Authority Internet Assigned Number Authority (IANA) Ultimate control over numbers assigned and

sets policy An organization can obtain network addresses

from the Internet Network Information Center (INTERNIC)

Only needed to assign network portion of IP Address. Why ???

© MMII JW Ryder CS 428 Computer Networking 28

More IP Addr Stuff Only necessary to assign IP Addresses to

networks which will participate in the Internet 9.0.0.0 = IBM; 12.0.0.0 = AT&T; 10.0.0.0 =

ARPANET See figure 4.5 on page 73

3 networks, what are their classes? How do you know?

© MMII JW Ryder CS 428 Computer Networking 29

IP Address Assignment See figure 4.6 on page 73 Host computers now attached and IP addresses

assigned 4 hosts

Arthur, Merlin, Guenevere, Lancelot 2 routers

Taliesyn, Glatisant Multi-homed host Note network IP addresses, remember classes

© MMII JW Ryder CS 428 Computer Networking 30

Network Byte Order 32 bit binary integer; What does it look like in

memory ??? Let’s take the hexadecimal number ‘6789ABCD’x Which one does it look like ?

a) 6789ABCD b) ABCD6789 c) CDAB8967 d) 8967CDAB e) None of the above

© MMII JW Ryder CS 428 Computer Networking 31

Network Byte Order Let’s take the hexadecimal number ‘6789ABCD’x Which one does it look like ?

a) 6789ABCD (Big Endian) b) ABCD6789 (Little Endian) c) CDAB8967 (LE&ByteSwap) d) 8967CDAB (Just odd) e) None of the above

Little Endian stores LOB portion of the integer at the lowest address

Big Endian stores HOB portion of the integer at the lowest address

© MMII JW Ryder CS 428 Computer Networking 32

Network Byte Order

With TCP/IP, Network Standard Byte Order is defined to be Big Endian Most Significant Byte is sent first and down

the line If the architecture of the machine does not match

this pattern then it is the responsibility of the TCP/IP developers for that machine to convert data on the way in and out

© MMII JW Ryder CS 428 Computer Networking 33

Internet Routing

Read Chapters 7 & 8 Routing - Process of choosing a path over

which to send packets Router - A computer making such a choice Goal: “… provide a virtual network that

encompasses multiple physical networks and offers a connectionless datagram delivery service.” - Comer

© MMII JW Ryder CS 428 Computer Networking 34

Routers An internet composed of multiple physical

networks interconnected by computers called routers

Router - direct connections to 2 or more physical networks

Host computer - a single, direct connection

© MMII JW Ryder CS 428 Computer Networking 35

Routers Multi-homed hosts - direct connections to

2 or more physical networks Both hosts and routers route IP datagrams Hosts?? Two or more routers on network? Which to

send to? Host must make decision Any computer with multiple network

connections can act as a router

© MMII JW Ryder CS 428 Computer Networking 36

Delivery Direct - Local

Sender encapsulates datagram in a physical frame Binds dest IP addr to a physical hardware addr Sends frame to destination

Known local because netid matches host’s netid

Indirect - Between physical networks

© MMII JW Ryder CS 428 Computer Networking 37

Indirect Delivery

Sender must identify a router to send datagram to Router then forwards it toward its destination When frame reaches the router

Software extract the encapsulated datagram IP software selects next router along the path Datagram again placed in a frame Sent over physical network to next router

© MMII JW Ryder CS 428 Computer Networking 38

Table Driven Routing IP Routing Table on each machine

netstat -nr Want to contain most minimal information at all

times Next hop routing done by using the routing tables (N, R) pairs

N = netid part of IP addr R = Next router along path to N

© MMII JW Ryder CS 428 Computer Networking 39

Next Hop Routing

Important - all routers identified in machine M’s routing table are physically located on the same network as M

When a datagram ready to leave M IP software locates dest IP addr extracts the network portion to make routing decision M will select a router which M can directly reach

Hosts have minimal information, rely on routers

© MMII JW Ryder CS 428 Computer Networking 40

Routing Example

R

Q

S

10.0.0.0

20.0.0.0

30.0.0.0

40.0.0.0

10.0.0.5

20.0.0.5

20.0.0.6

30.0.0.6

30.0.0.7

40.0.0.7

20.0.0.0 Direct Delivery

30.0.0.0 Direct Delivery

10.0.0.0 20.0.0.5

40.0.0.0 30.0.0.7

IP Addr Gateway

© MMII JW Ryder CS 428 Computer Networking 41

Consequences All traffic destined for given network use same

path Even when multiple paths exist, won’t be used Only final router can determine if dest. host

exists or is operational Need way for routers to return delivery problem

errors Datagrams travelling from A to B may follow a

different path from B to A

© MMII JW Ryder CS 428 Computer Networking 42

Default Routes Especially useful when local network has

small set of hosts and 1 connection to internet 2 tests

One for local network Default that points to default router

© MMII JW Ryder CS 428 Computer Networking 43

Routing AlgorithmRouteDatagram (Datagram, RoutingTable)

Extract destination IP addr, D, from the datagram and compute the network prefix, N;

If N matches any directly connected network address, deliver datagram to destination D over that network (This involves resolving D to a physical address, encapsulating the datagram, and sending the frame)

else if the table contains a host-specific route for D send the datagram to next hop specified in the table

else if the table contains a route for network N, send datagram to next hop specified in the table

else if the table contains a default route, send datagram to the default router specified in the table

else declare a routing error