kazi fall 2007 csci 370/eeng 4801 csci-370/eeng-480 computer networks khurram kazi

37
N ew York Institute ofTechnology Engineering and C om puterSciences Kazi Fall 2007 CSCI 370/EENG 480 1 CSCI-370/EENG-480 Computer Networks Khurram Kazi

Post on 22-Dec-2015

239 views

Category:

Documents


5 download

TRANSCRIPT

New York Institute of Technology

Engineering and Computer Sciences

Kazi Fall 2007 CSCI 370/EENG 480 1

CSCI-370/EENG-480

Computer Networks

Khurram Kazi

New York Institute of Technology

Engineering and Computer Sciences

Kazi Fall 2007 CSCI 370/EENG 480 2

Major sources of the slides for this lecture

Slides from Tanenbaum’s and William Stallings’ website are used in this lecture

Interworking with TCP/IP, M9000-02, Global knowledge, training manual, (http://am.globalknowledge.com)

Teach yourself TCP/IP in 24 hours, Joe Casad, Bob Willsey, SAMS

The Internet and Its Protocol, Adrian Farrel’s book.

New York Institute of Technology

Engineering and Computer Sciences

Kazi Fall 2007 CSCI 370/EENG 480 3

Reference Network: For discussion purposes

Router A

Router B

Router C

Router D

Router F

Router E

LAN 1

LAN 2

Wide Area Network or Metro Area Network

Edge Router

Edge Router

Source of IP Traffic

Destination of IP Traffic (server)

Shows traffic flow

ip addr

ip addr

ip addr

ip addr

ip addr

ip addr

ip addr

ip addr

New York Institute of Technology

Engineering and Computer Sciences

Kazi Fall 2007 CSCI 370/EENG 480 4

Ethernet frame

                                                                                        

Preamble7 bytes

SFD1 byte

D Addr6 bytes

S Addr8 bytes

Protocoltype

2 bytes

DATA46-1500 BYTES

FCS4 bytes

Preamble7 bytes

SFD1 byte

D Addr6 bytes

S Addr8 bytes

DataLength2 bytes

DATA46-1500 BYTES

FCS4 bytes

Ethernet II Header Layout

802.3 Header Layout

This field is different in thetwo frame structures

SFD = Start of Frame Delimiter

D Addr = Destination Address

S Addr = Source Address

FCS = Frame Check Sequence

New York Institute of Technology

Engineering and Computer Sciences

Kazi Fall 2007 CSCI 370/EENG 480 5

Address Resolution Protocol (ARP) RFC 826

Consider two machines A and B that connect to the same physical network. Each has an assigned IP address IA and IB and a physical address PA and PB . The goal is to devise low-level software that hides physical addresses and allows higher-level programs to work only with internet addresses. Ultimately, however, communication must be carried out by physical networks using whatever physical address scheme the underlying network supplies.

The problem of mapping high-level addresses to physical address is known as the address resolution problem.

New York Institute of Technology

Engineering and Computer Sciences

Kazi Fall 2007 CSCI 370/EENG 480 6

Address Resolution Protocol (ARP)

Imagine a router receives a packet. It looks up the destination IP address carried by the packet and determines the next hop to which to forward the packet – there is a chance that the destination is attached to the router. This tells the router out of which interface it should send the packet.

If the link from the router is point-to-point, things will be simple as the router can simply wrap the packet in a data-link layer protocol and send it.

However, if the link is multihop link like Ethernet (a link where multiple nodes are attached). Hence, the router needs the data-link layer address (such as MAC address) to forward the packet to the proper node.

IPv4 address (4 octets) IS NOT EQUAL to MAC address (6 octets) in length. This does not allow the MAC address to be carried in the 4-octet IP address field.

Moreover, in IP, at times it is desired to be able to assign multiple addresses to a single node.

New York Institute of Technology

Engineering and Computer Sciences

Kazi Fall 2007 CSCI 370/EENG 480 7

Address Resolution Protocol (ARP)

need MAC address to send to LAN hostmanual included in network addressuse central directoryuse address resolution protocol

ARP (RFC 826) provides dynamic IP to Ethernet address mappingsource broadcasts ARP requestdestination replies with ARP response

New York Institute of Technology

Engineering and Computer Sciences

Kazi Fall 2007 CSCI 370/EENG 480 8

Format of ARP Message encapsulated in Ethernet

0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7

Octet 1 Octet 2 Octet 3 Octet 4

Destination MAC Address

Destination MAC Address (continued) Source MAC Address

Source MAC Address (continued)

Protocol Type = 0x0806 (ARP)

Ethernet Frame shown in Gray

Hardware Type = 1 (10 Mb Ethernet)

Protocol Type (IPv4) Hardware Size = 6 Protocol Size = 6

Operational Code = 2 (ARP Reply) Source MAC Address

Source MAC Address (continued)

Source IP Address

Target MAC Address

Target MAC Address (continued) Target IP Address

Target IP Address (continued)

New York Institute of Technology

Engineering and Computer Sciences

Kazi Fall 2007 CSCI 370/EENG 480 9

Addressing scheme in IP

Three key 32-bit fields (areas of information) within the IP software are integral to its operation IP Address– A unique 32 bit address assigned to a

computer or more accurately to a node Subnet Mask Field– A 32 bit pattern of bits used to tell

IP how to determine which part of the IP address is network portion and which part is the host portion

Default gateway field– An optional 32 bit address that, if present, identifies the address of a router. Datagrams destined to another network are sent to this address to be routed appropriately

New York Institute of Technology

Engineering and Computer Sciences

Kazi Fall 2007 CSCI 370/EENG 480 10

IP Addressing

IP address is divided into two partsNetwork IDHost ID

Network ID can be synonymous to a street name; every house on the street uses the same street name. Likewise every computer on a network uses the same network ID.

Similar to every house on the street has a unique street address, each computer on a network has a different host ID.

New York Institute of Technology

Engineering and Computer Sciences

Kazi Fall 2007 CSCI 370/EENG 480 11

IP Addressing

Some network administrator use parts of the local bits (bits used for local host IDs) to create more manageable pieces called subnets (subnetworks). Therefore, there can be network, subnet, and host fields of an IP address. Some rules to the IP address and those fields: No field of an interface’s IP address may contain all 1s

or all 0s All 1s in the host portion of a target IP address signify

an IP-level broadcast All 0s in the host portion of an IP address identify a

subnet or a network Subnet: Breaking network address into multiple

addresses

New York Institute of Technology

Engineering and Computer Sciences

Kazi Fall 2007 CSCI 370/EENG 480 12

IPv4 Address Formats

New York Institute of Technology

Engineering and Computer Sciences

Kazi Fall 2007 CSCI 370/EENG 480 13

IP Addresses - Class A

Class A network contains 8 bit network ID and 24 bit host ID => Class network can approximately support 224 (16,777,216 computers). In reality the number of computers is less than that number (all 1s or all 0s eliminated).

Left most bit is always a 0 all 0 reserved 01111111 (127) reserved for loopback or local host range 1.x.x.x to 126.x.x.x (usable range) Network administrators frequently separate the network into smaller

subnets. Class A addresses are assigned to large organizations such as Ford

Motor Company, MIT etc.

0NNNNNNN

1-127

LLLLLLLL LLLLLLLL LLLLLLLL

N = Net; L = Locally administered.

New York Institute of Technology

Engineering and Computer Sciences

Kazi Fall 2007 CSCI 370/EENG 480 14

IP Addresses - Class B

Class B addresses start with binary 10 range 128.x.x.x to 191.x.x.x second octet also included in network address 214 = 16,384 class B addresses Without subnetting, 65,534 addresses can be used

within a flat network. Class B networks are assigned to midsize

organizations such as colleges and universities.

10NNNNNN

128-191

NNNNNNNN

0-255

LLLLLLLL LLLLLLLL

N = Net; L = Locally administered.

New York Institute of Technology

Engineering and Computer Sciences

Kazi Fall 2007 CSCI 370/EENG 480 15

IP Addresses - Class C

start with binary 110 range 192.x.x.x to 223.x.x.x second and third octet also part of network address 221 = 2,097,152 network addresses Class C networks typically do not need subnetting for

management, unless they contain smaller workgroups in a diverse location

More often, organizations subnet Class C networks to restrict access to specific resources.

110NNNNN

192-223

NNNNNNNN

0-255

NNNNNNNN0-255

LLLLLLLL

N = Net; L = Locally administered.

New York Institute of Technology

Engineering and Computer Sciences

Kazi Fall 2007 CSCI 370/EENG 480 16

IP Addresses - Class D

Class D addresses have the first three bits set to a 1 and fourth bit set to a 0.

Class D addresses are used to reach groups by assigning the same multicast address to all members of the group. These group members also have their own individual Class A, B, or C host IP address. There are millions of possible multicast addresses

Class D addresses are designated for groups of users and therefore do not have host portions for assignment to individual interfaces. For that reason, Class D networks are not subnetted.

1110MMMM

224-239

MMMMMMMM

0-255

MMMMMMMM0-255

MMMMMMMM

0-255

M= Multicast.

New York Institute of Technology

Engineering and Computer Sciences

Kazi Fall 2007 CSCI 370/EENG 480 17

Subnets

A campus network consisting of LANs for various departments.

New York Institute of Technology

Engineering and Computer Sciences

Kazi Fall 2007 CSCI 370/EENG 480 18

Subnets and Subnet Masks

allows arbitrary complexity of internetworked LANs within organization

insulate overall internet from growth of network numbers and routing complexity

site looks to rest of internet like single network each LAN assigned subnet number host portion of address partitioned into subnet

number and host number local routers route within subnetted network subnet mask indicates which bits are subnet number

and which are host number

New York Institute of Technology

Engineering and Computer Sciences

Kazi Fall 2007 CSCI 370/EENG 480 19

Subnetting IP Networks191.255.193.44 IP decimal

255.255.252.0 mask decimal

10111111 11111111 11000001 00101100 IP binary

11111111 11111111 11111100 00000000 mask binary

NNNNNNNN NNNNNNNN SSSSSS I I I I I I I I I I mask meaning

In the mask, binary 1s indicate the position of the network and subnet portion of the IP address, while 0s identify bits that represent individual interfaces.

N – Net S – Subnet I – Interface

The natural mask is the mask that represents the bits used by the network number in Class A, B & C networks

A: 255.0.0.0

B: 255.255.0.0

C: 255.255.255.0

Additional bits in a mask in excess of the natural mask for the network class indicates a subnetted network

Subnet mask shown above can also be represented as 191.255.0.0/22: suggesting that the class B network uses a mask that identifies the first 22 bits of the 32-bit IP address as the network and subnet fields. Since first 16 bits identify the network, the remaining 6 bits set the subnet field.

New York Institute of Technology

Engineering and Computer Sciences

Kazi Fall 2007 CSCI 370/EENG 480 20

Subnet Calculations

Example:

The number of subnets or hosts in a subnet:

(2n) – 2

(n = the number of bits used in the mask)

With 4 bits in the host field of the mask:

(24) – 2 = 16 – 2 = 14 hosts

With three bits in the subnet field of the mask

(23) – 2 = 8 – 2 = 6 subnets

The (-2) term comes from invalid entries of all 1s or all 0s in the field.

Questions to ask when subnetting is used:

•How many subnets an organization need from its network

•What is the maximum number of interfaces that the largest subnet needs to support

•To answer these questions, limits of the class of network plus the rules of IP addressing need to be considered

•No field (network, subnet or host) may contain all 1s or all 0s (binary)

•There cannot be a mask with a subnet field of 1 bit

New York Institute of Technology

Engineering and Computer Sciences

Kazi Fall 2007 CSCI 370/EENG 480 21

IP Routing Rules

IP datagrams can travel over the network in two ways:Local routing – The datagram is sent directly

to a device on the same physical network as the sending device

Indirect routing – If the target device is on another physical network, IP must send the datagram to another device (a router) for help in getting it to the target.

New York Institute of Technology

Engineering and Computer Sciences

Kazi Fall 2007 CSCI 370/EENG 480 22

IP Routing Rules

IP decides if a device is on a local network by evaluating the source and target IP addresses. While the IP stack does a series of binary manipulations to make the routing decision, a simple set of rules clearly describes the result of the process:

1. If two address are in different classes, the datagram is sent to the router for forwarding

2. If the two addresses are in the same class but in different network, the datagram is sent to the router for forwarding

3. If the two addresses are in the same class and network, but in different subnets, the datagram is sent to the router for forwarding

4. At this point, the source and target addresses are in the same network and subnet so the datagram is sent directly to the target computer

New York Institute of Technology

Engineering and Computer Sciences

Kazi Fall 2007 CSCI 370/EENG 480 23

IP Routing: Are these addresses on the Same Subnet? How do we determine if the source and the

target IP addresses are in the same subnet? The subnet field in both addresses must have the same value.

How do we know if they have the same value?

We know if it by locating the subnet field and then checking the values to see if they are the same

New York Institute of Technology

Engineering and Computer Sciences

Kazi Fall 2007 CSCI 370/EENG 480 24

IP Routing: Are these addresses on the Same Subnet? Example 1: Determine if the addresses are in the same subnet:

Source – 161.55.121.33 Target – 161.155.131.49

These are Class B addresses and are in the same network; the 161.55.0.0 network

To determine if they are in the same subnet, we must also have the subnet mask.

Assume we are using the subnet mask 255.255.248.0

Keep in mind that subnet field is locally administered portion of the addresses and is indicated by the 1 bits in the locally administered portion of the mask.

New York Institute of Technology

Engineering and Computer Sciences

Kazi Fall 2007 CSCI 370/EENG 480 25

IP Routing: Are these addresses on the Same Subnet? Example 1 (continued):

Binary value

128 64 32 16 8 4 2 1 128 64 32 16 8 4 2 1

Source 0 1 1 1 1 0 0 1 0 0 1 0 0 0 0 1

Mask 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0

Target 1 0 0 0 0 0 1 1 0 0 1 1 0 0 0 1

Local portion of the source address is 121.33 (7B.21 Hex).

Local portion of the target address is 131.49 (83.31 Hex)

Local portion of the mask is 248.0 (F8.0 Hex)

First 5 bits are 1, telling us the we have five-bit mask. Source AND Mask = 01111

Target AND Mask = 10000

Hence not in the same subnet

New York Institute of Technology

Engineering and Computer Sciences

Kazi Fall 2007 CSCI 370/EENG 480 26

IP Routing: Are these addresses on the Same Subnet? Example 2: Determine if the addresses are in the same

subnet: Source – 204.238.7.50 Target – 204.238.7.66 Mask – 255.255.255.240

These are Class C addresses and are in the same network; the 204.238.7.0 network

New York Institute of Technology

Engineering and Computer Sciences

Kazi Fall 2007 CSCI 370/EENG 480 27

IP Routing: Are these addresses on the Same Subnet? Example 2 (continued):

Binary value

128 64 32 16 8 4 2 1

Source 0 0 1 1 0 0 1 0

Mask 1 1 1 1 0 0 0 0

Target 0 1 0 0 0 0 1 0

Local portion of the source address is 50 (32 Hex).

Local portion of the target address is 66 (42 Hex)

Local portion of the mask is 240 (F0 Hex)

First 4 bits are 1, telling us the we have four-bit mask. Source AND Mask = 0011

Target AND Mask = 0100

Hence not in the same subnet

New York Institute of Technology

Engineering and Computer Sciences

Kazi Fall 2007 CSCI 370/EENG 480 28

IP Routing: Are these addresses on the Same Subnet? Example 3: Determine if the addresses are in the same

subnet: Source – 200.1.1.69 Target – 200.1.1.135 Mask – 255.255.255.224

These are Class C addresses and are in the same network; the 200.1.1.0 network

New York Institute of Technology

Engineering and Computer Sciences

Kazi Fall 2007 CSCI 370/EENG 480 29

IP Routing: Are these addresses on the Same Subnet? Example 3 (continued):

Binary value

128 64 32 16 8 4 2 1

Source 0 1 0 0 0 1 0 1

Mask 1 1 1 0 0 0 0 0

Target 1 0 0 0 0 1 1 1

Local portion of the source address is 69 (45 Hex).

Local portion of the target address is 135 (87 Hex)

Local portion of the mask is 240 (E0 Hex)

First 4 bits are 1, telling us the we have four-bit mask. Source AND Mask = 0100

Target AND Mask = 1000

Hence not in the same subnet

New York Institute of Technology

Engineering and Computer Sciences

Kazi Fall 2007 CSCI 370/EENG 480 30

Subnets

A campus network consisting of LANs for various departments.

New York Institute of Technology

Engineering and Computer Sciences

Kazi Fall 2007 CSCI 370/EENG 480 31

The Network Layer

Chapter 5

New York Institute of Technology

Engineering and Computer Sciences

Kazi Fall 2007 CSCI 370/EENG 480 32

Network Layer Design Isues

• Store-and-Forward Packet Switching

• Services Provided to the Transport Layer

• Implementation of Connectionless Service

• Implementation of Connection-Oriented Service

• Comparison of Virtual-Circuit and Datagram Subnets

New York Institute of Technology

Engineering and Computer Sciences

Kazi Fall 2007 CSCI 370/EENG 480 33

Store-and-Forward Packet SwitchingThe environment of the network layer protocols.

fig 5-1

New York Institute of Technology

Engineering and Computer Sciences

Kazi Fall 2007 CSCI 370/EENG 480 34

Implementation of Connectionless Service

Routing within a diagram subnet.

New York Institute of Technology

Engineering and Computer Sciences

Kazi Fall 2007 CSCI 370/EENG 480 35

Implementation of Connection-Oriented Service

Routing within a virtual-circuit subnet.

New York Institute of Technology

Engineering and Computer Sciences

Kazi Fall 2007 CSCI 370/EENG 480 36

Comparison of Virtual-Circuit and Datagram Subnets

5-4

New York Institute of Technology

Engineering and Computer Sciences

Kazi Fall 2007 CSCI 370/EENG 480 37

Routing Algorithms

• The Optimality Principle• Shortest Path Routing• Flooding• Distance Vector Routing• Link State Routing• Hierarchical Routing• Broadcast Routing• Multicast Routing• Routing for Mobile Hosts• Routing in Ad Hoc Networks