29
Lesson 3 IPv4 Yuan Application Engineer / iConnectivity Group (ICG) 2014.11.24 1

Chap3. i pv4

  • Upload
    -

  • View
    105

  • Download
    2

Embed Size (px)

Citation preview

Lesson 3

IPv4

YuanApplication Engineer / iConnectivity Group (ICG)

2014.11.24

1

Recap

ARP

2

Application

• ARP probe

– an ARP request constructed with an all-zero sender

IP address

– used in the IPv4 Address Conflict Detection

specification (RFC 5227)

– Sent when there is any change in connectivity

– Should not send periodically

5

Application

• ARP Announcements (gratuitous ARP)

– Updating other host's mapping of a hardware address when the sender's IP address or MAC address has changed

– Broadcast as an ARP request containing the sender's protocol address (SPA) in the target field (TPA=SPA), with the target hardware address (THA) set to zero.

– detecting IP conflicts

– No ARP reply is expected

6

Hands On

• ARP probe

• Gratuitous ARP

7

IPv4

8

Outline

• IPv4

– Overview

– Bitwise operation

– Classful Addressing

– Classless Addressing

– Special Addresses

– NAT

9

Overview

• Internet Protocol version 4

– The fourth version in the development of the

Internet Protocol (IP) Internet

– IPv4 is described in IETF publication RFC 791

(September 1981), replacing an earlier definition

(RFC 760, January 1980)

• Addressing

– 32-bit(4-byte)

– Address space to 232 addresses

10

Bitwise operation

• Bitwise NOT

– unary, complenent

11

32 bits

NOT

32 bits

input

output

input output

0 1

1 0

ordinary 00010001 01111001 00001110 00100011

complement 11101110 10000110 11110001 11011100

ordinary 17 121 14 35

complement 238 134 241 220

Base-2

Base-10

Bitwise operation

• Bitwise NOT

– unary, complenent

– Hands on

12

32 bits

NOT

32 bits

input

output

input output

0 1

1 0

a. 11100110 11110010 11010110 00011001

b. 17.63.110.114

a. 00011001 00001101 00101001 11100110

b. 238.192.145.141

Bitwise operation

• Bitwise AND

– binary, pick the lower

13

32 bits

AND

32 bits

input 1

output

input 1 Input 2 output

0 0 0

0 1 0

1 0 0

1 1 1

input 1 00010001 01111001 00001110 00100011

input 2 11111111 11111111 10001100 00000000

output 00010001 01111001 00001100 00000000

input 1 17 121 14 35

input 2 255 255 140 0

output 17 121 12 0

Base-2

Base-10

32 bits input 2

Bitwise operation

• Bitwise AND

– binary, pick the lower

14

32 bits

AND

32 bits

input 1

output

input 1 Input 2 output

0 0 0

0 1 0

1 0 0

1 1 1

32 bits input 2

a. 11100110 11110010 11010110 0001100111011000 00011111 00110011 11001000

b. 17.63.110.114255.112.0.1

a. 11000000 00010010 00010010 00001000

b. 17.32.0.0

Bitwise operation

• Bitwise OR

– binary, pick the higher

15

32 bits

OR

32 bits

input 1

output

input 1 Input 2 output

0 0 0

0 1 1

1 0 1

1 1 1

input 1 00010001 01111001 00001110 00100011

input 2 11111111 11111111 10001100 00000000

output 11111111 11111111 10001110 00100011

input 1 17 121 14 35

input 2 255 255 140 0

output 255 255 142 35

Base-2

Base-10

32 bits input 2

Bitwise operation

• Bitwise OR

– binary, pick the higher

16

32 bits

OR

32 bits

input 1

output

input 1 Input 2 output

0 0 0

0 1 1

1 0 1

1 1 1

32 bits input 2

a. 11100110 11110010 11010110 0001100111011000 00011111 00110011 11001000

b. 17.63.110.114255.112.0.1

a. 11111110 11111111 11110111 11011001

b. 255.127.110.115

Classful Addressing

• Divides into 5 classes

17

Class A: 231= 2,147,483,648 addresses, 50%

Class B: 230= 1,073,741,824 addresses, 25%

Class C: 229= 536,870,912 addresses, 12.5%

Class D: 228= 268,435,456 addresses, 6.25%

Class E: 228= 268,435,456 addresses, 6.25%

8 bits 8 bits 8 bits 8 bits

Class A 0…….

Class B 10……

Class C 110…..

Class D 1110….

Class E 1111….

8 bits 8 bits 8 bits 8 bits

Class A 0-127

Class B 128-191

Class C 192-223

Class D 224-239

Class E 240-255

Class A Class B Class C Class D Class E

11 1 1

0 0 0 0

Classful Addressing

• Two-level addressing

– netid, hostid, like Tel: (02)2792-7818

– Network address

18

8 bits 8 bits 8 bits 8 bits

Class A netid hostid 128 nets, 16,777,214 hosts per net

Class B netid hostid 16,384 nets, 65,534 host per net

Class C netid hostid 2,097,152 nets, 254 host per net

Class D Multicast address

Class E Reserve

Classful Addressing

– network mask(default mask)

19

8 bits 8 bits 8 bits 8 bits Network mask

Class A 11111111 00000000 00000000 00000000 255.0.0.0

Class B 11111111 11111111 00000000 00000000 255.255.0.0

Class C 11111111 11111111 11111111 00000000 255.255.255.0

destn addr. input 1 201 24 67 32

network mask input 2 255 255 0 0

Output AND 201 24 0 0

Classful Addressing

• Three-level addressing

– Subnetting

• Network address, subnet address, host address,

like Tel: (02)2792-7818

20

Class B 10101000 01011111 00000000 00000000 (168.95.0.0)

10101000 01011111 00000000 00000000 (168.95.0.0)

network address

network address

host address

host addresssubnet address

Classful Addressing

– subnet mask

21

destn addr. input 1 141 14 120 77

subnet mask input 2 255 255 192 0

Output AND

8 bits 8 bits 8 bits 8 bits

Class B 10101000 01011111 11000000 00000001 168.95.192.1

Network mask 11111111 11111111 00000000 00000000 255.255.0.0

Subnet mask 11111111 11111111 11111000 00000000 255.255.248.0

141 14 64 0

Classful Addressing

• Three-level addressing

– Supernetting

22

Class C 11101000 01011111 00111000 00000000 (232.95.56.0)

11101000 01011111 00111000 00000000 subnetting

network address

network address

host address

host address

11101000 01011111 00111000 00000000 supernettingnetwork address host address

Classful Addressing

– supernet mask

23

destn addr. input 1 141 14 120 77

subnet mask input 2 255 255 192 0

Output AND

8 bits 8 bits 8 bits 8 bits

Class C 11101000 01011111 00111010 00000001 235.95.58.1

Network mask 11111111 11111111 11111111 00000000 255.255.255.0

Supernet mask 11111111 11111111 11111000 00000000 255.255.248.0

141 14 64 0

Classful Addressing

– network mask

– subnet mask

– supernet mask

24

8 bits 8 bits 8 bits 8 bits

Class C 11101000 01011111 00111010 00000001 235.95.58.1

supernet mask 11111111 11111111 11111000 00000000 255.255.248.0

network mask 11111111 11111111 11111111 00000000 255.255.255.0

subnet mask 11111111 11111111 11111111 11100000 255.255.255.224

Classful Addressing

• Class 4 -IP multicast addressing

– the address denotes the recipient group

– no geographic or location boundaries

25

Description IPv4 Address Range

Local-link address (reserved) 224.0.0.0/24

Globally scope address (assigned) 224.0.1.0 to 238.255.255.255

Administratively scoped addresses (local)

239.0.0.0/8

Class D Multicast Address Allocations by IANA

Classless Addressing

• Classful addressing, the network portion ends

on one of the separating dots in the address

• Classless addressing uses a variable number of

bits for the network and host portions of the

address

26

…… ……

…… ……

AddressSpace

AddressSpace

Blocks of same size

Blocks of different sizes

Classless Addressing

• Prefix: internet, like netid

• Suffix: host, like hostid

27

Classful addressing 11101000 01011111 00111000 00000000

Classless addressing 11101000 01 011111 00111000 00000000

netid

prefix

hostid

suffix

Classless Addressing

• CIDR, classless interdomain routing, slash

notation

28

byte . byte . byte . byte / n=prefix length

Slash notation Network mask

230.8.24.56/16 block 230.8.0.0 to 230.8.255.255 255.255.0.0

230.8.24.56/20 block 230.8.16.0 to 230.8.31.255 255.255.240.0

230.8.24.56/26 block 230.8.24.0 to 230.8.24.63 255.255.255.192

230.8.24.56/27 block 230.8.24.32 to 230.8.24.63 255.255.255.224

230.8.24.56/29 block 230.8.24.56 to 230.8.24.63 255.255.255.248

Level Prefix length

A /8

B /16

C /24

D /4

E /4

Classful addressing

Special Addresses

• This network: host ID all zero

– 203.75.205.0, this class C network

• Broadcast: host ID all one, also use in subnet

– 203.75.205.255, broadcast in 203.74.205.0

• Limit(Local) broadcast: broadcast in local

network

– 255.255.255.255, broadcast in the same network

• Private IP address

29

Private IPClass A 10.0.0.0 – 10.255.255.255

Class B 172.16.0.0 – 172.31.255.255

Class C 192.168.0.0 – 192.168.255.255

Special Addresses

30

Reserved address blocksRange Description Reference

0.0.0.0/8 Current network (only valid as source address) RFC 6890

10.0.0.0/8 Private network RFC 1918

100.64.0.0/10 Shared Address Space RFC 6598

127.0.0.0/8 Loopback RFC 6890

169.254.0.0/16 Link-local RFC 3927

172.16.0.0/12 Private network RFC 1918

192.0.0.0/24 IETF Protocol Assignments RFC 6890

192.0.2.0/24 TEST-NET-1, documentation and examples RFC 5737

192.88.99.0/24 IPv6 to IPv4 relay RFC 3068

192.168.0.0/16 Private network RFC 1918

198.18.0.0/15 Network benchmark tests RFC 2544

198.51.100.0/24 TEST-NET-2, documentation and examples RFC 5737

203.0.113.0/24 TEST-NET-3, documentation and examples RFC 5737

224.0.0.0/4 IP multicast (former Class D network) RFC 5771

240.0.0.0/4 Reserved (former Class E network) RFC 1700

255.255.255.255 Broadcast RFC 919

Thanks

31