ip addressing by_mamun sir

25
IP Addressing by Md. Abdullah Al Mamun Sr. Lecturer

Upload: sharifbdp

Post on 18-Jun-2015

721 views

Category:

Education


3 download

DESCRIPTION

This a Class Lecture Sheet on Networking Class. Mamun Sir is the Lecturer of that class. Which was held in Atish Dipankar Uninersity.

TRANSCRIPT

Page 1: Ip addressing by_Mamun sir

IP Addressing

byMd. Abdullah Al Mamun

Sr. Lecturer

Page 2: Ip addressing by_Mamun sir

Protocol = 6 means data portion contains a TCP segment. Protocol = 17 means UDP.

Layer 3 - IP datagramIHL Type of Service Total LengthVersion

Fragment OffsetIdentification FlagsTime to Live Protocol Header Checksum

Source AddressDestination Address

Version = 4 If no options, IHL = 5Source and Destination

are 32-bit IP addresses

DataPaddingOptions

Page 3: Ip addressing by_Mamun sir

Purpose of an IP address

Unique Identification of – Source

Sometimes used for security or policy-based filtering of data

– DestinationSo the networks know where to send the data

Network Independent Format– IP over anything

Page 4: Ip addressing by_Mamun sir

Purpose of an IP Address

identifies a machine’s connection to a networkphysically moving a machine from one network

to another requires changing the IP addressassigned by an appropriate authority such as

RIPE, ARIN, etc or Local Internet Registries (LIRs)

TCP/IP uses unique 32-bit address

Page 5: Ip addressing by_Mamun sir

Basic Structure of an IP Address

133 27 162 125

10000101 00011011 10100010 01111101

85 1B A2 7D

32 bit number (4 octet number):(e.g. 133.27.162.125)Decimal Representation:

Binary Representation:

Hexadecimal Representation:

Page 6: Ip addressing by_Mamun sir

Address Structure Revisited

Hierarchical Division in IP Address:– Network Part (Prefix)

» describes which physical network

– Host Part (Host Address)» describes which host on that network

– Boundary can be anywhere» very often NOT at a multiple of 8 bits

Network Host

205 . 154 . 8 1

11001101 10011010 00001000 00000001

Page 7: Ip addressing by_Mamun sir

Network MasksDefine which bits are used to describe the

Network Part and which for hostsDifferent Representations:

– decimal dot notation: 255.255.224.0– binary: 11111111 11111111 11100000 00000000– hexadecimal: 0xFFFFE000– number of network bits: /19

Binary AND of 32 bit IP address with 32 bit netmask yields network part of address

Page 8: Ip addressing by_Mamun sir

137.158.128.0/17 (netmask 255.255.128.0)

Example Prefixes

1000 1001 1001 1110 1 000 0000 0000 0000 1111 1111 1111 1111 1 000 0000 0000 0000

1100 0110 1000 0110 0000 0000 0000 0000 1111 1111 1111 1111 0000 0000 0000 0000

1100 1101 0010 0101 1100 0001 10 00 0000 1111 1111 1111 1111 1111 1111 11 00 0000

198.134.0.0/16 (netmask 255.255.0.0)

205.37.193.128/26 (netmask 255.255.255.192)

Page 9: Ip addressing by_Mamun sir

Special Addresses

All 0’s in host part: Represents Network– e.g. 193.0.0.0/24– e.g. 138.37.128.0/17

All 1’s in host part: Broadcast– e.g. 137.156.255.255 (137.156.0.0/16)– e.g. 134.132.100.255 (134.132.100.0/24)– e.g. 190.0.127.255 (190.0.0.0/17)

127.0.0.0/8: Loopback address (127.0.0.1)0.0.0.0: Various special purposes

Page 10: Ip addressing by_Mamun sir

Allocating IP AddressesThe subnet mask is used to define size of a

networkE.g a subnet mask of 255.255.255.0 or /24

implies 32-24=8 host bits– 2^8 minus 2 = 254 possible hosts

Similarly a subnet mask of 255.255.255.224 or /27 implies 32-27=5 hosts bits– 2^5 minus 2 = 30 possible hosts

Page 11: Ip addressing by_Mamun sir

Old-style classes of IP addresses Different classes used to represent different sizes of network

(small, medium, large) Class A networks (large):

– 8 bits network, 24 bits host (/8, 255.0.0.0)– First byte in range 0-127

Class B networks (medium):– 16 bits network, 16 bits host (/16 ,255.255.0.0)– First byte in range 128-191

Class C networks (small):– 24 bits network, 8 bits host (/24, 255.255.255.0)– First byte in range 192-223

Page 12: Ip addressing by_Mamun sir

Network Layer #12

IP Addresses

0network host

10 network host

110 network host

1110 multicast address

A

B

C

D

class1.0.0.0 to127.255.255.255

128.0.0.0 to191.255.255.255

192.0.0.0 to223.255.255.255

224.0.0.0 to239.255.255.255

32 bits

given notion of “network”, let’s re-examine IP addresses:

“class-full” addressing:

Page 13: Ip addressing by_Mamun sir

Old-style classes of IP addresses

Just look at the address to tell what class it is.– Class A: 0.0.0.0 to 127.255.255.255

» binary 0xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

– Class B: 128.0.0.0 to 191.255.255.255» binary 10xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

– Class C: 192.0.0.0 to 223.255.255.255» binary 110xxxxxxxxxxxxxxxxxxxxxxxxxxxxx

– Class D: (multicast) 224.0.0.0 to 239.255.255.255» binary 1110xxxxxxxxxxxxxxxxxxxxxxxxxxxx

– Class E: (reserved) 240.0.0.0 to 255.255.255.255

Page 14: Ip addressing by_Mamun sir

Implied netmasks of classful addresses

A classful network has a “natural” or “implied”prefix length or netmask:– Class A: prefix length /8 (netmask 255.0.0.0)– Class B: prefix length /16 (netmask 255.255.0.0)– Class C: prefix length /24 (netmask 255.255.255.0)

Old routing systems often used implied netmasks

Modern routing systems always use explicit prefix lengths or netmasks

Page 15: Ip addressing by_Mamun sir

Classless addressing

Forget old Class A, Class B, Class C terminology and restrictions

Internet routing and address management today is classless

CIDR = Classless Inter-Domain Routing– routing does not assume that class A,B,C implies

prefix length /8,/16,/24VLSM = Variable-Length Subnet Masks

– routing does not assume that all subnets are the same size

Page 16: Ip addressing by_Mamun sir

Classless Addressing

IP address with the subnet mask defines the range of addresses in the block– E.g 10.1.1.32/28 (subnet mask 255.255.255.240)

defines the range 10.1.1.32 to 10.1.1.47– 10.1.1.32 is the network address– 10.1.1.47 is the broadcast address– 10.1.1.33 ->46 assignable addresses

Page 17: Ip addressing by_Mamun sir

Classless addressing example

A large ISP gets a large block of addresses– e.g., a /16 prefix, or 65536 separate addresses

Allocate smaller blocks to customers– e.g., a /22 prefix (1024 addresses) to one customer,

and a /28 prefix (16 addresses) to another customerAn organisation that gets a /22 prefix from their

ISP divides it into smaller blocks– e.g. a /26 prefix (64 addresses) for one department,

and a /27 prefix (32 addresses) for another department

Page 18: Ip addressing by_Mamun sir

Classless addressing exercise

Consider the address block 133.27.162.0/23Allocate 8 separate /29 blocks, and one /28

blockWhat are the IP addresses of each block?

– in prefix length notation– netmasks in decimal– IP address ranges

What is the largest block that is still available?What other blocks are still available?

Page 19: Ip addressing by_Mamun sir

Network Layer #19

IP addressing: the last word...

Q: How does an ISP get block of addresses?A: ICANN: Internet Corporation for Assigned

Names and Numbers– allocates addresses– manages DNS– assigns domain names, resolves disputes

Page 20: Ip addressing by_Mamun sir

Network Layer #20

IP Addressing: scenario IP address: 32-bit identifier

for host, router interface interface: connection

between host, router and physical link– router’s typically have

multiple interfaces– host may have multiple

interfaces– IP addresses associated with

interface, not host, or router

223.1.1.1

223.1.1.2

223.1.1.3

223.1.1.4 223.1.2.9

223.1.2.2

223.1.2.1

223.1.3.2223.1.3.1

223.1.3.27

223.1.1.1 = 11011111 00000001 00000001 00000001

223 1 11

Page 21: Ip addressing by_Mamun sir

Network Layer #21

IP Addressing : scenario IP address:

– network part » high order bits

– host part » low order bits

What’s a network ? (from IP address perspective)– device interfaces with same

network part of IP address– can physically reach each

other without intervening router

223.1.1.1

223.1.1.2

223.1.1.3

223.1.1.4 223.1.2.9

223.1.2.2

223.1.2.1

223.1.3.2223.1.3.1

223.1.3.27

network consisting of 3 IP networks(for IP addresses starting with 223, first 24 bits are network address)

LAN

Page 22: Ip addressing by_Mamun sir

Network Layer #22

Getting a datagram from source to dest.

223.1.1.1

223.1.1.2

223.1.1.3

223.1.1.4 223.1.2.9

223.1.2.2

223.1.2.1

223.1.3.2223.1.3.1

223.1.3.27

A

BE

IP datagram: miscfields

sourceIP addr

destIP addr data

datagram remains unchanged, as it travels source to destination

addr fields of interest here mainly dest. IP addr

Dest. Net. next router Nhops223.1.1 1223.1.2 223.1.1.4 2223.1.3 223.1.1.4 2

routing table in A

Page 23: Ip addressing by_Mamun sir

Network Layer #23

Getting a datagram from source to dest.

223.1.1.1

223.1.1.2

223.1.1.3

223.1.1.4 223.1.2.9

223.1.2.2

223.1.2.1

223.1.3.2223.1.3.1

223.1.3.27

A

BE

Starting at A, given IP datagram addressed to B:

look up net. address of B find B is on same net. as A link layer will send datagram directly to

B inside link-layer frame B and A are directly connected

Dest. Net. next router Nhops223.1.1 1223.1.2 223.1.1.4 2223.1.3 223.1.1.4 2

miscfields 223.1.1.1 223.1.1.3 data

Page 24: Ip addressing by_Mamun sir

Network Layer #24

Getting a datagram from source to dest.

223.1.1.1

223.1.1.2

223.1.1.3

223.1.1.4 223.1.2.9

223.1.2.2

223.1.2.1

223.1.3.2223.1.3.1

223.1.3.27

A

BE

Dest. Net. next router Nhops223.1.1 1223.1.2 223.1.1.4 2223.1.3 223.1.1.4 2

Starting at A, dest. E: look up network address of E E on different network

A, E not directly attached routing table: next hop router to E is

223.1.1.4 link layer sends datagram to router

223.1.1.4 inside link-layer frame datagram arrives at 223.1.1.4 continued…..

miscfields 223.1.1.1 223.1.2.2 data

Page 25: Ip addressing by_Mamun sir

Network Layer #25

Getting a datagram from source to dest.

223.1.1.1

223.1.1.2

223.1.1.3

223.1.1.4 223.1.2.9

223.1.2.2

223.1.2.1

223.1.3.2223.1.3.1

223.1.3.27

A

BE

Arriving at 223.1.4, destined for 223.1.2.2

look up network address of E E on same network as router’s

interface 223.1.2.9 router, E directly attached

link layer sends datagram to 223.1.2.2 inside link-layer frame via interface 223.1.2.9

datagram arrives at 223.1.2.2!!! (hooray!)

miscfields 223.1.1.1 223.1.2.2 data network router Nhops interface

223.1.1 - 1 223.1.1.4223.1.2 - 1 223.1.2.9223.1.3 - 1 223.1.3.27

Dest. next