计算机网络课件ch4 2_第1页
计算机网络课件ch4 2_第2页
计算机网络课件ch4 2_第3页
计算机网络课件ch4 2_第4页
计算机网络课件ch4 2_第5页
已阅读5页,还剩64页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

Chapter

4-2

IP

addressIP

address2/69Chapter

4:

NetworkLayer4.

1

Introduction4.2

Virtual

circuit

anddatagram

networks4.3

What’s

inside

arouter4.4

IP:

InternetProtocolDatagram

formatIPv4addressingICMPIPv64.5

Routing

algorithmsLink

stateDistanceVectorHierarchical

routing4.6

Routing

in

theInternetRIPOSPFBGP4.7

Broadcast

andmulticast

routing3/69ComputerInPeatdwdorreks-sLink

Layerand

LANsThe

InternetNetworklayerforwardingtableHost,无法显示该图片。

router

network

layer

functions:Routing

protocols•pathselectionRIP,

OSPF,

BGPIP

protocol•addressing

conventionsdatagram

format•packet

handling

conventionsICMPprotocol•errorreporting•router

“signaling”Transport

layer:

TCP,

UDPLink

layerphysical

layerNetworklayerObjectivesIP

address4/69Concept

of

IP

AddressClass

of

IP

AddressReserved

and

PrivateIPAddressNetwork

Mask

andSubnettingVLSM

andCIDRIP

AddressIP

address5/69Each

computer

in

a

TCP/IP

networkmust

be

given

a

unique

identifier,

or

IPaddress.

An

IP

address

is

a

32-bitsequence

of

1s

and

0s.Representation

of

IP

AddressTo

make

the

IPaddress

easier

to

use,the address

is

usually

written

as

fourdecimal numbers

separated

by

periodsIP

address6/69192

.

168

.

123

.

2Structure

of

IP

AddressIP

address7/69IP地址的类别(Class

of

IP

Address)IP

address8/69Class

AAddressRange:1-126(127

Reserved)IP

address9/69Class

BAddress

Range:128-191IP

address10/69Class

CAddress

Range:192-223IP

address11/69Address

AllocatingIP

address12/69Allocate

A

class

IP:(国际网络信息中心

NIC)Allocate

B

class

IP

:InterNIC、APNIC、ENICAllocate

C

class

IP(国家或地区的NIC)Reserved

AddressIP

address13/69•Certain

host

addresses

are

reserved

and

cannot

be

assigned

todevices

on

a

network.An

IP

address

that

has

binary

0s

in

all

host

bit

positions

is

reservedfor

the

network

address.An

IP

address

that

has

binary

1s

in

all

host

bit

positions

is

reservedfor

the

broadcast

address.0.0.0.0An

IP

address

that

has

binary

0s

in

all

bit

positions

is

reserved

for

defaultroute255.255.255.255, An

IP

address

that

has

binary

1s

in

all

bit

positions

is

reserved

for

floodbroadcastPrivate

IPAddressPrivate

IP

addresses

are

another

solution

to

theproblem

of

the

impending

exhaustion

of

public

IPaddresses.Private

IP

addresses

are

not

routed

on

theInternet

backbone.IP

address14/69Exercise:IPAddressClassesIP

address15/69AddressClassNetworkHost10.2.1.1128.63.2.100201.222.5.64192.6.141.2130.113.64.16256.241.201.10IPAddressClassesExerciseAnswersAddressClassNetworkHost10.2.1.1A10.0.0.00.2.1.1128.63.2.100B128.63.0.00.0.2.100201.222.5.64C201.222.5.00.0.0.64192.6.141.2C192.6.141.00.0.0.2130.113.64.16B130.113.0.00.0.64.16256.241.201.10NonexistentIP

address16/69NetworkMaskClass

A:255.0.0.0IP

address17/69classB:255.255.0.0class

C:255.255.255.0Function

of

Network

Mask•10101100000100000000001010100000172.16.2.160¯11111111111111110000000000000000255.255.0.0•10101100000100000000000000000000172.16.0.0Network

IDIP

address18/69SubnettingIP

address19/69Toefficiently

manage

a

limited

supplyof

IP

addresses,

all

classes

can

besubdivided

into

smaller

subnetworks.Reasons

for

SubnettingIP

address20/69Provides

addressing

flexibility

Provides•Broadcast

Containment•Low-level

security

on

the

LANIntroduction

to

SubnettingHost

bitsmustarereassigned(or“borrowed”)as

networkbits.3

bits

borrowed

allows

23-2

or

6

subnets12

bitsIbP

oadrdrorewssed

allows

212-2

or

4094

s2u1b/6n9ets5

bits

borrowed

allows

25-2

or

30

subnetsIP

address22/69Introduction

toSubnettingNetidHost

idNetidHost

idNetidHost

idSubnet

id不考虑子网NetmaskNetmaskExtended

net

id考虑子网化IP

address23/69Comparison

between

decimal

and

binaryE.g1Two

BitsSubnetting

forClass

CSubnet

range00

0000001~62000000001~00111111•01

00000065~1276401000001~01111111•10

000000~111111111281910000001~10111111

129~3~255•IP

address

24/69Number

ofUsable

SubnetsandHostsIP

address25/69usable

subnets=(2

power

of

borrowed

bits)–2usablehosts=(2

power

of

remaining hostbits)–2Summary

of

Class

CSubnettingIP

address26/69Written

Exercise:

Subnet

MasksAddressSubnet

MaskClassSubnet172.16.2.10255.255.255.010.6.24.20255.255.0.0172.30.36.12255.255.255.0202.30.36.82255.255.255.192IP

address27/69Subnet

Mask

Exercise

AnswersAddressSubnet

MaskClassSubnet172.16.2.10255.255.255.0B172.16.2.010.6.24.20255.255.240.0A10.6.16.010.30.36.12255.255.255.0A10.30.36.0IP

address28/69Broadcast

AddressesAddressSubnet

MaskClassSubnet

Broadcast201.222.10.60255.255.255.24815.16.193.6255.255.248.0128.16.32.13255.255.255.252153.50.6.27255.255.255.128IP

address29/69Broadcast

Addresses

ExerciseAnswersAddressSubnet

MaskClassSubnetBroadcast201.222.10.60255.255.255.248C201.222.10.56201.222.10.6315.16.193.6255.255.248.0A15.16.192.015.16.199.255128.16.32.13255.255.255.252B128.16.32.12128.16.32.15153.50.6.27255.255.255.128B153.50.6.0153.50.6.127IP

address30/69SubnetsIP

address:subnet

part

(highorder

bits)host

part

(low

orderbits)What’s

a

subnet

?device

interfaces

withsame

subnet

part

of

IPaddresscan

physicallyreacheach

otherwithoutintervening

router223.1.1.1IP

address31/69223.1.1.3223.1.1.2223.1.1.4223.1.2.9223.1.2.2223.1.2.1223.1.3.1223.1.3.27network

consisting

of

3

subnetssubnet223.1.3.2Subnets223.1.1.0/24IP

address32/69223.1.2.0/24223.1.3.0/24RecipeTo

determine

thesubnets,

detacheach

interfacefrom

its

host

orrouter,

creatingislands

of

isolatednetworks.

Eachisolated

network

iscalled

a

subnet.Subnet

mask:

/24SubnetsHow

many?223.1.1.1223.1.1.3223.1.1.4223.1.2.2223.1.2.1223.1.2.6223.1.3.2223.1.3.1223.1.3.27223.1.1.2223.1.7.0IP

address33/69223.1.7.1223.1.8.1

223.1.8.0223.1.9.1223.1.9.2IP

addressing:

CIDRCIDR:

Classless

InterDomain

Routingsubnet

portion

of

address

of

arbitrary lengthaddress

format:

a.b.c.d/x,

where

x

is

# bits

in

subnet

portion

of

addresssubnetparthostpart11001000

00010111

00010000

00000000200.23.16.0/23IP

address34/69Subnet

ProgrammingOthersubnets30

hosts

per

subnetClass

C

address:201.222.5.0IP

address35/69Variable-Length

Subnet

MaskHQIP

address36/69172.16.0.0/16Variable-Length

Subnet

MaskHQHQHQIP

address37/69172.16.0.0/16172.16.14.32/27172.16.14.

64/27Variable-Length

Subnet

MaskBA172.16.14.96/27CSubnet

172.16.14.0/24

is

divided

into

smaller

subnets:Subnet

with

one

mask

at

first

(/27)HQHQHQIP

address38/69172.16.0.0/16172.16.14.96/27Subnet

with

one

mask

at

first

(/27)Further

subnet

one

of

these

subnets

not

used

elsewhere

(/30)CB172.16.14.32/27A172.16.14.

64/27HQHQHQIP

address39/69172.16.0.0/16Variable-Length

Subnet

MaskCalculating

VLSMsIP

address40/69Subnetted

Address:

172.16.32.0/20In

Binary10101100.

00010000.00100000.00000000Calculating

VLSMsVLSM

Address:

172.16.32.0/26In

Binary00100000.0010101100.

00010000.000000Subnetted

Address:

172.16.32.0/20IP

address41/69In

Binary10101100.

00010000.00100000.00000000Calculating

VLSMsNetworkSubnetVLSMsubnet10101100

.

00010000.00100000.00000000=172.16.32.0/26Host1st

subnet:VLSM

Address:

172.16.32.0/26In

Binary00100000.0010101100.

00010000.000000Subnetted

Address:

172.16.32.0/20IP

address42/69In

Binary10101100.

00010000.00100000.00000000Subnetted

Address:

172.16.32.0/20IP

address43/69In

Binary10101100.

00010000.00100000.00000000VLSM

Address:

172.16.32.0/26In

Binary00100000.0010101100.

00010000.000000NetworkSubnetVLSMSubnet000000=172.16.32.0/26000000=172.16.32.64/26000000=172.16.32.128/26000000=172.16.32.192/26000000=172.16.33.0/26Host10101100.00010000.00100000.00172.16.00100000.01172.16.00100000.10172.16.00100000.11172.16.00100001.001st

subnet:2nd

subnet:3rd

subnet:4th

subnet:5th

subnet:Calculating

VLSMsExercise:Design

NetworkIP

address44/69Using

VLSMDerived

from

the

172.16.32.0/20

Subnet(62

Hosts)(62

Hosts)(62

Hosts)(62

Hosts)45/69Exercise

Answer172.16.33.0/30172.16.33.4/3030-BitMask(2

Hosts)

IP

address172.16.32.0/26172.16.32.64/26172.16.33.8/30172.16.32.128/26172.16.33.12/30172.16.32.192/26Derived

from

the172.16.33.0/26

Subnet26-BitMask(62

Hosts)Derived

from

the

172.16.32.0/20

SubnetAgainIP

address46/69Net-id

and

host-idnet-id24

bithost-id24

bitnet-id16

bitnet-id8

bit0A

classhost-id16

bitBclassCclass1

10host-id8

bitD

class1110Multicast

addressE

classreserved1111010IP

address47/69rangeClassnetwork

No.s

fromtohostnumberA 126

(27

2)B 16,384

(214)-2C2,097,152

(221)-2

192.0.01

126128.0

191.255223.255.25516,777,21465,534254IP

address48/691/21/41/81/161/326Five

classes

IP

addressIPI地P址ad与dr网e络ss层49/69Some

special

IP

addressIP

address50/69Available?

Which

class?IP

address51/690.210.45.3154.2.0.7117.93.187.35202.0.3.23200.200.200.200204.30.71.34245.79.8.2953.70.80.90109.56.34.010.0.0.286参考:Internet的IP地址和AS号码管理结构ARINRIPE

NCCAPNIC(Possible

future

RIRs)ICANN

ASO(TheAddress

Supporting

Organization)NIRLIPISPCNNICEU

EUISPEUEULIPEU

EUISPEnd

UsersInternet

ServiceProvidersLocal

InternetRegistriesNational

InternetRegistriesCERnetNICUSTCNICIP

address52/69More

about

IP

addressingIP

address53/69DHCProute

aggregationNATIP

addresses:

how

to

getone?IP

address54/69Q:

How

does

a

host

get

IP

address?hard-coded

by

system

admin

in

a

fileWindows:

control-panel->network->configuration->tcp/ip->propertiesUNIX:

/etc/rc.configDHCP:

Dynamic

Host

Configuration

Protocol:dynamically

get

address

from

as

server“plug-and-play”IP

address

Network

55/69LayerDHCP:

Dynamic

Host

ConfigurationProtocolGoal:

allow

host

to

dynamically

obtain

its

IP

addressfrom

network

server

when

it

joins

networkCan

renew

its

lease

on

address

in

useAllowsreuse

of

addresses

(only

hold

address

while

connectedan

“on”)Support

for

mobile

users

who

want

to

joinnetwork

(moreshortly)DHCP

overview:host

broadcasts

“DHCP

discover”

msgDHCP

server

responds

with

“DHCP

offer”

msghost

requests

IP

address:

“DHCP

request”

msgDHCP

server

sends

address:

“DHCP

ack”

msgIP

address56/69DHCP

client-server

scenario223.1.1.1223.1.1.2223.1.1.4223.1.2.9223.1.2.1223.1.3.1223.1.1.3

223.1.3.27AB223.1.2.2

E223.1.3.2DHCPserverarriving

DHCPclient

needsaddress

in

thisnetworkIP

address57/69DHCP

client-server

scenarioDHCP

server:

223.1.2.5arrivingclienttimeDHCP

discoversrc

:

0.0.0.0,

68dest.:

255.255.255.255,67yiaddr:

0.0.0.0transaction

ID:

654DHCP

offersrc:

223.1.2.5,

67dest:

255.255.255.255,

68yiaddrr:

223.1.2.4transaction

ID:

654Lifetime:

3600

secsDHCP

requestsrc:

0.0.0.0,

68dest::

255.255.255.255,

67yiaddrr:

223.1.2.4transaction

ID:

655Lifetime:

3600

secsDHCP

ACKsrc:

223.1.2.5,

67dest:

255.255.255.255,

68yiaddrr:

223.1.2.4transaction

ID:

655Lifetime:

3600

secsIP

addresses:

how

to

getone?Q:

How

doesnetworkgetsubnetpart

ofIP

addr?A:

gets

allocatedportion

ofits

providerISP’s

addressspaceISP's

block11001000

00010111

0001000000000000200.23.16.0/20Organization

011001000

00010111

0001000000000000200.23.16.0/23Organization

111001000

00010111

0001001000000000200.23.18.0/23Organization

211001000

00010111

0001010000000000200.23.20.0/23...…..….….Organization

711001000

00010111

0001111000000000200.23.30.0/23IP

address58/69Hierarchical

addressing:

route

aggregation“Send

me

anythingwith

addressesbeginning200.23.16.0/20”200.23.18.0/23200.23.30.0/23Fly-By-Night-ISPOrganization

7InternetOrganization

1ISPs-R-Us“Send

me

anythingwith

addressesbeginning199.31.0.0/16”200.23.20.0/23IP

address59/69Organization

2....Hierarchical

addressing

allows

efficient

advertisement

of

routinginformation:Organization

0200.23.16.0/23Hierarchical

addressing:

more

specificroutes“Send

me

anythingwith

addressesbeginning200.23.16.0/20”200.23.18.0/23200.23.30.0/23Fly-By-Night-ISPISPs-R-Us

has

a

more

specific

route

to

Organization

1Organization

0200.23.16.0/23Organization

7InternetOrganization

1ISPs-R-Us“Send

me

anything

with

addressesbeginning

199.31.0.0/16or

200.23.18.0/23”200.23.20.0/23IP

address60/69Organization

2....NAT:

Network

Address

Translation10.0.0.110.0.0.210.0.0.310.0.0.4138.76.29.7local

network(e.g.,

home

network)10.0.0/24rest

ofInternetDatagrams

with

source

ordestination

in

this

networkhave

10.0.0/24

address

forsource,

destination

(as

usual)Alldatagrams

leaving

localnetwork

havesame

single

sourceNAT

IP

address:

138.76.29.7,different

source

port

numbersIP

address61/69NAT:

Network

Address

TranslationIP

address62/69Motivation:

local

network

uses

just

one

IP

address

asfar

as

outside

world

is

concerned:range

of

addresses

not

needed

from

ISP: just

one

IPaddress

for

all

devicescan

change

addresses

of

devices

in

local

networkwithout

notifying

outside

worldcan

change

ISP

without

changing

addresses

ofdevices

in

local

networkdevices

inside

local

net

not

explicitly

addressable,visible

by

outside

world

(a

security

plus).NAT:

Network

Address

TranslationIP

address63/69Implementation:

NAT

router

must:outgoing

datagrams:

replace

(source

IP

address,

port

#)of

every

outgoing

datagram

to

(NAT

IP

address,

newport

#).

.

.

remote

clients/servers

will

respond

using

(NAT

IPaddress,

new

port

#)

as

destination

addr.remember

(in

NAT

translation

table)

every

(source

IPaddress,

port

#) to

(NAT

IP

address,

new

port

#)translation

pairing

datagrams:

replace

(NAT

IP

address,

new

port

#)

indest

fields

of

every ing

datagram

withcorresponding

(source

IP

address,

port

#)stored

in

NAT

tableNAT:

Network

AddressTranslation10.0.0.110.0.0.210.0.0.3S:

10.0.0.1,

3345D:

128.119.40.186,

80110.0.0.4138.76.29.71:

host

10.0.0.1sends

datagram

to128.119.40.186,

80NAT

translation

tableWAN

side

addrLAN

side

addr138.76.29.7,

5001……10.0.0.1,

3345……S:

128.119.40.186,

80D:

10.0.0.1,

33454S:

138.76.29.7,

5001D:

128.119.40.186,

8022:

NAT

routerchanges

datagramsource

addr

from10.0.0.1,

3345

to138.76.29.7,

5001,updates

tableS:

128.119.40.186,

80D:

138.76.29.7,

500133:

Reply

arrivesdest.

address:138.76.29.7,

50014:

NAT

routerchanges

datagramdest

addr

from138.76.29.7,

5001

to

10.0.0.1,

3345IP

address64/69NAT:

Network

AddressTranslationIP

address65/6916-bit

port-number

field:60,000

simultaneous

connections

with

a

singleLAN-side

address!NAT

is

controversial:routers

should

only

process

up

to

layer

3violates

end-to-end

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论