IP Addressing. Internet Protocol: Which version? There are currently two versions of the Internet...

40
IP Addressing

Transcript of IP Addressing. Internet Protocol: Which version? There are currently two versions of the Internet...

Page 1: IP Addressing. Internet Protocol: Which version? There are currently two versions of the Internet Protocol in use for the Internet IPv4 Specified in 1980/81.

IP Addressing

Page 2: IP Addressing. Internet Protocol: Which version? There are currently two versions of the Internet Protocol in use for the Internet IPv4 Specified in 1980/81.

Internet Protocol: Which version?

There are currently two versions of the Internet Protocol in use for the Internet

• IPv4• Specified in 1980/81 (RFC 760, 791)• Four byte addresses• Universally deployed• Problem: Address space almost exhausted

• IPv6• Specification from 1998 (RFC 2460)• Significant differences to IPv4, but not fundamental changes• 16-byte addresses• Problem: Not widely used (yet?)

Google Study from Oct 2008: IPv6 available to 0.238% of users

Page 3: IP Addressing. Internet Protocol: Which version? There are currently two versions of the Internet Protocol in use for the Internet IPv4 Specified in 1980/81.

IP Addresses

Application dataTCP HeaderEthernet Header Ethernet Trailer

Ethernet frame

IP Header

version(4 bits)

headerlength

Type of Service/TOS(8 bits)

Total Length (in bytes)(16 bits)

Identification (16 bits)flags

(3 bits)Fragment Offset (13 bits)

Source IP address (32 bits)

Destination IP address (32 bits)

TTL Time-to-Live(8 bits)

Protocol(8 bits)

Header Checksum (16 bits)

32 bits

Page 4: IP Addressing. Internet Protocol: Which version? There are currently two versions of the Internet Protocol in use for the Internet IPv4 Specified in 1980/81.

IP Addresses

Application dataTCP HeaderEthernet Header Ethernet Trailer

Ethernet frame

IP Header

0x4 0x5 0x00 4410

9d08 0102 00000000000002

128.143.137.144

128.143.71.21

12810 0x06 8bff

32 bits

Page 5: IP Addressing. Internet Protocol: Which version? There are currently two versions of the Internet Protocol in use for the Internet IPv4 Specified in 1980/81.

What is an IP Address?

• IP address = Internet Protocol Version 4 address• 32-bit label for a network interface

– Each interface has a separate IP address

• On the public Internet, IP address is unique global address

• The IP address is to used by hosts and routers for delivery of IP datagram

• Important special cases:– Dynamically assigned IP addresses ( DHCP)– IP addresses in private networks ( NAT)

Page 6: IP Addressing. Internet Protocol: Which version? There are currently two versions of the Internet Protocol in use for the Internet IPv4 Specified in 1980/81.

Dotted Decimal Notation

• IPv4 addresses are written using dotted decimal notation• Each byte is identified by a decimal number in the range

[0..255]

• Example:

1000111110000000 10001001 100100001st Byte

= 128

2nd Byte

= 143

3rd Byte

= 137

4th Byte

= 144

128.143.137.144

Page 7: IP Addressing. Internet Protocol: Which version? There are currently two versions of the Internet Protocol in use for the Internet IPv4 Specified in 1980/81.

• IP address consists of a network prefix and a host number

– Network prefix identifies a network – Host number identifies an interface on the network

• How do we know how long the network prefix is? – The length of the network prefix is indicated

1. by a netmask, or

2. by a suffix given the length as a number (CIDR notation)

– Netmask is often called subnetmask (there are subtle differences)

Structure of an IP address

network prefixnetwork prefix host numberhost number

Page 8: IP Addressing. Internet Protocol: Which version? There are currently two versions of the Internet Protocol in use for the Internet IPv4 Specified in 1980/81.

• Example:

• Network address is: 128.143.0.0 (or 128.143)• Host number is: 137.144• Netmask is: 255.255.0.0 (or ffff0000)

• Prefix or CIDR notation: 128.143.137.144/16» Network prefix is 16 bits long

Notation of IP address

128.143128.143 137.144137.144

Page 9: IP Addressing. Internet Protocol: Which version? There are currently two versions of the Internet Protocol in use for the Internet IPv4 Specified in 1980/81.

Network Prefix and Host Number

• Each IP network (often called subnetwork or subnet) has an IP address:IP address of a network = Host number is set to all zeros, e.g., 128.143.0.0

• IP routers are devices that forward IP datagrams between IP networks

• Delivery of an IP datagram proceeds in 2 steps:– Use network prefix to deliver datagram to the right network– Once the network is found, use the host number to deliver

to the right interface

Page 10: IP Addressing. Internet Protocol: Which version? There are currently two versions of the Internet Protocol in use for the Internet IPv4 Specified in 1980/81.

How does one get an IP network address?

• IP address allocation is managed by five Regional Internet Registries (RIR)

• Each RIR manages ranges of addresses:http://www.iana.org/assignments/ipv4-address-space/ipv4-address-space.xml

Page 11: IP Addressing. Internet Protocol: Which version? There are currently two versions of the Internet Protocol in use for the Internet IPv4 Specified in 1980/81.

Special IP Addresses

• Special addresses: Loopback interfaces

– all addresses 127.0.0.1-127.0.0.255 are reserved for loopback interfaces– Most systems use 127.0.0.1 as loopback address– loopback interface is associated with name “localhost”

IP address of a network – Host number is set to all zeros, e.g., 128.143.0.0

Broadcast address– Host number is all ones, e.g., 128.143.255.255 – Broadcast goes to all hosts on the network – Often ignored due to security concerns

• Test / Experimental addresses Certain address ranges are reserved for “experimental use”. Packets should get dropped if they contain this destination address (see RFC 1918):

10.0.0.0 - 10.255.255.255172.16.0.0 - 172.31.255.255192.168.0.0 - 192.168.255.255

• Convention (but not a reserved address) Default gateway has host number set to ‘1’, e.g., e.g., 192.0.1.1

Page 12: IP Addressing. Internet Protocol: Which version? There are currently two versions of the Internet Protocol in use for the Internet IPv4 Specified in 1980/81.

Subnetting

• Scenario: Organization has a large network prefix and wants to delegate management of IP addresses

• Subnetting: Use a portion of the host name to identify a smaller network ( “subnetwork”, “subnet”).

• Each subnets is a separate IP network

UofT NetworkUofT Network

Faculty of A&S

Library

Faculty of Engineering

128.100.0.0/16

128.100.11.0/24 128.100.58.0/24

128.100.136.0/24

Page 13: IP Addressing. Internet Protocol: Which version? There are currently two versions of the Internet Protocol in use for the Internet IPv4 Specified in 1980/81.

Basic Idea of Subnetting

• Split the host number portion of an IP address into a subnet number and a (smaller) host number.

• Result is a 3-layer hierarchy

• The extended network prefix is also called subnetmask• Then:

• Subnets can be freely assigned within the organization• Internally, subnets are treated as separate networks• Subnet structure is not visible outside the organization

network prefixnetwork prefix host numberhost number

subnet numbersubnet numbernetwork prefixnetwork prefix host numberhost number

extended network prefix

Page 14: IP Addressing. Internet Protocol: Which version? There are currently two versions of the Internet Protocol in use for the Internet IPv4 Specified in 1980/81.

• Routers and hosts use an extended network prefix (subnetmask) to identify the start of the host numbers

Subnetmask

128.143 137.144

network prefix host number

128.143 144

network prefix host numbersubnetnumber

137

extended network prefix

1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0

subnetmask

Page 15: IP Addressing. Internet Protocol: Which version? There are currently two versions of the Internet Protocol in use for the Internet IPv4 Specified in 1980/81.

Example: Subnetmask

• 128.143.0.0/16 is the IP address of the network• 128.143.137.0/24 is the IP address of the subnet

• 128.143.137.144 is the IP address of the host• 255.255.255.0 (or ffffff00) is the subnetmask of the host

• When subnetting is used, one generally speaks of a “subnetmask” (instead of a netmask) and a “subnet” (instead of a network)

Page 16: IP Addressing. Internet Protocol: Which version? There are currently two versions of the Internet Protocol in use for the Internet IPv4 Specified in 1980/81.

Advantages of Subnetting

• With subnetting, IP addresses use a 3-layer hierarchy:» Network » Subnet» Host

• Reduces router complexity. Since external routers do not need to know about subnetting, the complexity of routing tables at external routers is reduced.

• Note: Length of the subnet mask need not be identical at all subnetworks.

Page 17: IP Addressing. Internet Protocol: Which version? There are currently two versions of the Internet Protocol in use for the Internet IPv4 Specified in 1980/81.

Creating and Managing Subnetting

• Use of subnetting or length of the subnetmask is decided by the network administrator, who acts as owner of

• Subnets are created by setting the subnetmask of an IP interface

• Important: Subnetmasks must be set consistently

Page 18: IP Addressing. Internet Protocol: Which version? There are currently two versions of the Internet Protocol in use for the Internet IPv4 Specified in 1980/81.

No Subnetting

• All hosts think that the other hosts are on the same network

128.143.0.0/16

128.143.137.32/16subnetmask: 255.255.0.0

128.143.71.21/16subnetmask: 255.255.0.0

128.143.137.144/16subnetmask: 255.255.0.0

128.143.71.201/16subnetmask: 255.255.0.0

Page 19: IP Addressing. Internet Protocol: Which version? There are currently two versions of the Internet Protocol in use for the Internet IPv4 Specified in 1980/81.

128.143.0.0/16

128.143.137.32/24subnetmask: 255.255.255.0

128.143.71.21/24subnetmask: 255.255.255.0

128.143.137.144/24subnetmask: 255.255.255.0

128.143.71.201/24subnetmask: 255.255.255.0

128.143.137.0/24Subnet

128.143.71.0/24Subnet

With Subnetting

• Hosts with same extended network prefix belong to the same network

Page 20: IP Addressing. Internet Protocol: Which version? There are currently two versions of the Internet Protocol in use for the Internet IPv4 Specified in 1980/81.

• Different subnetmasks lead to different views of the scope of the network

128.143.0.0/16

128.143.137.32/26subnetmask: 255.255.255.192

128.143.71.21/24subnetmask: 255.255.255.0

128.143.137.144/26subnetmask: 255.255.255.192

128.143.71.201/16subnetmask: 255.255.0.0

128.143.71.0/24Subnet

128.143.137.128/26Subnet

128.143.137.0/26Subnet

With Subnetting

Page 21: IP Addressing. Internet Protocol: Which version? There are currently two versions of the Internet Protocol in use for the Internet IPv4 Specified in 1980/81.

Classful IP Addresses and CIDR

• In 1993, there was a major shift for interpreting and allocating IP addresses:

until 1993:

Classful Addresses

until 1993:

Classful Addresses

after 1993:

CIDR = Classless Interdomain

Routing

after 1993:

CIDR = Classless Interdomain

Routing

Page 22: IP Addressing. Internet Protocol: Which version? There are currently two versions of the Internet Protocol in use for the Internet IPv4 Specified in 1980/81.

Classful IP Addresses

• When Internet addresses were standardized (early 1980s), the Internet address space was divided up into classes:– Class A: Network prefix is 8 bits long

– Class B: Network prefix is 16 bits long

– Class C: Network prefix is 24 bits long

– Class D: Used (multicast) group addresses– Class E: Reserved

• Each IP address contained a key which identifies the class:– Class A: IP address starts with “0”

– Class B: IP address starts with “10”

– Class C: IP address starts with “110”

• No need for netmasks (unless subnetting is used)

Page 23: IP Addressing. Internet Protocol: Which version? There are currently two versions of the Internet Protocol in use for the Internet IPv4 Specified in 1980/81.

Classful IP Addresses

Class C network id host11 0

Network Prefix24 bits

Host Number8 bits

bit # 0 1 23 242 313

Class B 1 network id host

bit # 0 1 15 162

Network Prefix16 bits

Host Number16 bits

031

Class A 0Network Prefix

8 bits

bit # 0 1 7 8

Host Number24 bits

31

Page 24: IP Addressing. Internet Protocol: Which version? There are currently two versions of the Internet Protocol in use for the Internet IPv4 Specified in 1980/81.

Class D multicast group id11 1bit # 0 1 2 313

04

Class E (reserved for future use)11 1bit # 0 1 2 313

14

05

Classful IP Addresses

• We will learn about multicast addresses later in this course.

Page 25: IP Addressing. Internet Protocol: Which version? There are currently two versions of the Internet Protocol in use for the Internet IPv4 Specified in 1980/81.

IP Allocation with Classful IP Addresses

• Limited flexibility for obtaining a network address:≤ 254 IP addresses: Class C

≤ 216-1 = 65534 IP addresses: Class B

≤ 224-1 = 16,772,214 IP addresses: Class A

• Too few network addresses for large networks 27 = 128 Class A networks

214 = 16,384 Class B networks

• Flat address space. Routing tables in the backbone Internet need one entry for each network address.

Class C networks: up to 221 = 2,097,152 entriesBy 1993, the lookup time of routing tables had become a bottleneck for Internet performance

Page 26: IP Addressing. Internet Protocol: Which version? There are currently two versions of the Internet Protocol in use for the Internet IPv4 Specified in 1980/81.

Allocation of Classful Addresses

Page 27: IP Addressing. Internet Protocol: Which version? There are currently two versions of the Internet Protocol in use for the Internet IPv4 Specified in 1980/81.

CIDR - Classless Interdomain Routing

• Goals:– New interpretation of the IP address space – Restructure IP address assignments to increase efficiency– Enable routing table aggregation to minimize route table entries

• CIDR (Classless Interdomain Routing) – Abandons the notion of classes– Key Concept: The length of the network prefix in the IP addresses is

kept arbitrary– Consequences:

• Size of the network prefix must be provided with an IP address ( CIDR notation of IP addresses)

• Hierarchical routing aggregation introduces dependency of IP addresses to service provider

• Need for new lookup algorithms for routing tables

Page 28: IP Addressing. Internet Protocol: Which version? There are currently two versions of the Internet Protocol in use for the Internet IPv4 Specified in 1980/81.

CIDR Notation

• CIDR notation of an IP address:

192.0.2.0/18• "18" is the prefix length. It states that the first 18 bits are the

network prefix of the address (and 14 bits are available for specific host addresses)

• CIDR notation can replace the use of subnetmasks (but is more general)– IP address 128.143.137.144 and subnetmask 255.255.255.0 becomes

128.143.137.144/24

• CIDR notation allows to drop traling zeros of network addresses:

192.0.2.0/18 can be written as 192.0.2/18

Page 29: IP Addressing. Internet Protocol: Which version? There are currently two versions of the Internet Protocol in use for the Internet IPv4 Specified in 1980/81.

CIDR address blocks

• CIDR notation can nicely express blocks of addresses• Blocks are used when allocating IP addresses for a company and for routing tables

(route aggregation)

CIDR Block Prefix # of Host Addresses /27 32 /26 64 /25 128 /24 256 /23 512 /22 1,024 /21 2,048 /20 4,096 /19 8,192 /18 16,384 /17 32,768 /16 65,536 /15 131,072 /14 262,144 /13 524,288

Page 30: IP Addressing. Internet Protocol: Which version? There are currently two versions of the Internet Protocol in use for the Internet IPv4 Specified in 1980/81.

Subnetting and Supernetting

• CIDR is compatible with subnetting:– Subnets are created by extending the

prefix

• CIDR can do more:– CIDR can refer to multiple

networks with a single prefix:• 128.143.0.0/16 and

128.142.0.0/16 can be summarized as 128.142.0.0/15

– This is called supernetting (In fact, CIDR and supernetting are often used as the same thing)

– If neighboring networks have similar address blocks, supernetting reduces the size of routing tables

128.143.0.0/16

128.143.137.32/26subnetmask: 255.255.255.192

128.143.71.21/24subnetmask: 255.255.255.0

128.143.137.144/26subnetmask: 255.255.255.192

128.143.71.201/16subnetmask: 255.255.0.0

128.143.71.0/24Subnet

128.143.137.128/26Subnet

128.143.137.0/26Subnet

Page 31: IP Addressing. Internet Protocol: Which version? There are currently two versions of the Internet Protocol in use for the Internet IPv4 Specified in 1980/81.

CIDR and Hierarchical IP address allocation

• Exploiting supernetting to reduce size of routing tables:

– Backbone ISPs obtain blocks of IP addresses and allocate portions of their address blocks to their customers

– Customers can allocate a portion of their address block to their own customers

Page 32: IP Addressing. Internet Protocol: Which version? There are currently two versions of the Internet Protocol in use for the Internet IPv4 Specified in 1980/81.

Hierarchical Structure of IP Addresses

128.100/16

Rest of Internet

ISP X owns:

Company Y :

ISP Z :

Organization A: Organization B:

Page 33: IP Addressing. Internet Protocol: Which version? There are currently two versions of the Internet Protocol in use for the Internet IPv4 Specified in 1980/81.

Hierarchical Structure of IP Addresses

128.100/16

Rest of Internet

ISP X owns:

Company Y :

128.100.2/24

ISP Z :

128.100.11/24

Organization A:

128.100.11.192/26

Organization B:

128.100.11.64/26

Obtained from ARIN

Obtained from ISP XObtained from ISP X

Obtained from ISP ZObtained from ISP Z

Page 34: IP Addressing. Internet Protocol: Which version? There are currently two versions of the Internet Protocol in use for the Internet IPv4 Specified in 1980/81.

Hierarchical Structure of IP Addresses

128.100/16

Rest of Internet

ISP X owns:

Company Y :

128.100.2/24

ISP Z :

128.100.11/24

Organization A:

128.100.11.192/26

Organization B:

128.100.11.64/26

Only one routing entry for 128.100/16No entries needed for network addresses of Company Y, ISP Z, or Organizations A, B.

Routing table entry for 128.100.2/24 and 128.100.11/24(no entry for 128.100.11.192/26 and 128.100.11.64/26.

Page 35: IP Addressing. Internet Protocol: Which version? There are currently two versions of the Internet Protocol in use for the Internet IPv4 Specified in 1980/81.

Drawback of Hierarchical IP Addresses

• IP address assignment depends on service provider

128.100/16

Rest of Internet

ISP X owns:

Company Y :

128.100.2/24

ISP Z :

128.100.11/24

Organization A:

128.100.11.192/26

Organization B:

128.100.2.64/26

Must change IP addresses when changing service provider

128.100.11.64/26

Page 36: IP Addressing. Internet Protocol: Which version? There are currently two versions of the Internet Protocol in use for the Internet IPv4 Specified in 1980/81.

CIDR and Routing Tables

• Aggregation of routing table entries:– 128.100.0.0/16 and 128.101.0.0/16 can be represented as

128.100.0.0/15• Longest prefix match: Routing table lookup finds the routing entry

that matches the the longest prefix

What is the outgoing interface for

128.143.137.0/24 ?

Route aggregation can be exploited

when IP address blocks are assigned

in an hierarchical fashion

Prefix Interface

128.0.0.0/4 interface #5

128.128.0.0/9 interface #2

128.143.128.0/17 interface #1

Routing table

Page 37: IP Addressing. Internet Protocol: Which version? There are currently two versions of the Internet Protocol in use for the Internet IPv4 Specified in 1980/81.

IPv6 - IP Version 6

• IP Version 6– Is the successor to the currently used IPv4 – Specification completed in 1994– Makes improvements to IPv4 (no revolutionary changes)

• One (not the only !) feature of IPv6 is a significant increase in of the IP address to 128 bits (16 bytes)

• IPv6 will solve – for the foreseeable future – the problems with IP addressing

• 1024 addresses per square inch on the surface of the Earth.

Page 38: IP Addressing. Internet Protocol: Which version? There are currently two versions of the Internet Protocol in use for the Internet IPv4 Specified in 1980/81.

IPv6 Header

Application dataTCP HeaderEthernet Header Ethernet Trailer

Ethernet frame

IPv6 Header

version(4 bits)

Traffic Class(8 bits)

Flow Label(24 bits)

Payload Length (16 bits)Next Header

(8 bits)Hop Limits (8 bits)

Source IP address (128 bits)

32 bits

Destination IP address (128 bits)

Page 39: IP Addressing. Internet Protocol: Which version? There are currently two versions of the Internet Protocol in use for the Internet IPv4 Specified in 1980/81.

IPv6 vs. IPv4: Address Comparison

• IPv4 has a maximum of

232 4 billion addresses• IPv6 has a maximum of

2128 = (232)4 4 billion x 4 billion x 4 billion x 4 billion addresses

Page 40: IP Addressing. Internet Protocol: Which version? There are currently two versions of the Internet Protocol in use for the Internet IPv4 Specified in 1980/81.

Notation of IPv6 addresses

• Convention: The 128-bit IPv6 address is written as eight 16-bit integers (using hexadecimal digits for each integer)

CEDF:BP76:3245:4464:FACE:2E50:3025:DF12

• Short notation:• Abbreviations of leading zeroes:

CEDF:BP76:0000:0000:009E:0000:3025:DF12

CEDF:BP76:0:0:9E :0:3025:DF12

• “:0000:0000:0000” can be written as “::”CEDF:BP76:0:0:FACE:0:3025:DF12 CEDF:BP76::FACE:0:3025:DF12

• IPv6 addresses derived from IPv4 addresses have 96 leading zero bits. Convention allows to use IPv4 notation for the last 32 bits.::80:8F:89:90 ::128.143.137.144