l2-1 - Heyook Lab

Download Report

Transcript l2-1 - Heyook Lab

ICS 156: Lecture 2 (part 1)
Today:
 IP addressing
 Data link protocols and ARP
 Notes about lab
IP Addressing


Addressing defines how addresses
are allocated and the structure of
addresses
IPv4



Classful IP addresses (obsolete)
Classless inter-domain routing (CIDR)
(RFC 854, current standard)
IP Version 6 addresses
What is an IP Address?




An IP address is a unique global
address for a network interface.
An IP address uniquely identifies a
network location.
Routers forwards a packet based on
the destination address of the
packet.
Exceptions:

DHCP and NAT (lab 7)
IP Addresses
32 bits
version
(4 bits)
header
length
Type of Service/TOS
(8 bits)
flags
(3 bits)
Identification (16 bits)
TTL Time-to-Live
(8 bits)
Total Length (in bytes)
(16 bits)
Protocol
(8 bits)
Fragment Offset (13 bits)
Header Checksum (16 bits)
Source IP address (32 bits)
Destination IP address (32 bits)
Ethernet Header
IP Header
TCP Header
Ethernet frame
Application data
Ethernet Trailer
IP Addresses
32 bits
0x4
0x5
0x00
9d08
12810
4410
0102
0000000000000 2
0x06
8bff
128.143.137.144
128.143.71.21
Ethernet Header
IP Header
TCP Header
Ethernet frame
Application data
Ethernet Trailer
An IP address is often written in dotted
decimal notation

Each byte is identified by a decimal
number in the range [0..255]:
10000000
10001111
10001001
10010000
1st Byte
2nd Byte
3rd Byte
4th Byte
= 128
= 143
= 137
= 144
128.143.137.144
Structure of an IP address
31
0
network prefix

host number
An IP address encodes both a
network number (network prefix) and
an interface number (host number).


network prefix identifies a network
the host number identifies a specific host
(actually, interface on the network).
How long the network prefix is?


Before 1993: The network prefix is
implicitly defined (class-based
addressing)
After 1993: The network prefix is
indicated by a netmask.
Before 1993: Class-based addressing

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 is multicast address
Class E is reserved
Classful IP Adresses (Until 1993)

Each IP address contained a key
which identifies the class:





Class
Class
Class
Class
Class
A: IP address starts with “0”
B: IP address starts with “10”
C: IP address starts with “110”
D: IP address starts with “1110”
E: IP address starts wit “11110”
The old way: Internet Address
Classes
bit # 0
Class A
1
7 8
31
0
Network Prefix
Host Number
8 bits
24 bits
bit # 0 1 2
Class B
10
15 16
network id
110
host
Network Prefix
Host Number
16 bits
16 bits
bit # 0 1 2 3
Class C
31
23 24
network id
31
host
Network Prefix
Host Number
24 bits
8 bits
The old way: Internet Address
Classes
bit # 0 1 2 3 4
Class D
1110
31
multicast group id
bit # 0 1 2 3 4 5
Class E
11110
31
(reserved for future use)
Problems with Classful IP Addresses

Fast growing routing table size



Each router must have an entry for every
network prefix
~ 221 = 2,097,152 class C networks
In 1993, the size of routing tables started to
outgrow the capacity of routers
Other problems with classful addresses

Address depletion for large networks

Class A and Class B addresses were gone


How many class A/B network prefixes can there
be?
Limited flexibility for network addresses:
 Class A and B addresses are overkill
(>64,000 addresses)

Class C address is insufficient (256
addresses)
Classless Inter-domain routing (CIDR)



Network prefix is of variable length
Addresses are allocated
hierarchically
Routers aggregate multiple address
prefixes into one routing entry to
minimize routing table size
CIDR network prefix is variable length
128
Addr
Mask

143
137
10000000
10001111
10001001
255
255
255
11111111
11111111
1111111
144
10010000
0
00000000
A network mask specifies the
number of bits used to identify a
network in an IP address.
CIDR notation

CIDR notation of an IP address:



128.143.137.144/24
/24 is the prefix length. It states that the
first 24 bits are the network prefix of the
address (and the remaining 8 bits are
available for specific host addresses)
CIDR notation can nicely express blocks
of addresses


An address block
[128.195.0.0, 128.195.255.255]
can be represented by an address prefix
128.195.0.0/16
How many addresses are there in a /x address
block?
 2 (32-x)
CIDR hierarchical address allocation
ISP
128.1.0.0/16
128.2.0.0/16
128.0.0.0/8
128.195.0.0/16
University
Foo.com
Bar.com
Library
128.195.1.0/24





128.195.4.150
CS
128.195.4.0/24
IP addresses are hierarchically allocated.
An ISP obtains an address block from a Regional Internet
Registry
An ISP allocates a subdivision of the address block to an
organization
An organization recursively allocates subdivision of its address
block to its networks
A host in a network obtains an address within the address block
assigned to the network
Hierarchical address allocation
128.195.4.0
128.0.0.0




128.195.0.0
128.195.4.255
128.196.255.255
128.195.4.150
128.255.255.255
ISP obtains an address block 128.0.0.0/8 
[128.0.0.0, 128.255.255.255]
ISP allocates 128.195.0.0/16 ([128.195.0.0,
128.195.255.255]) to the university.
University allocates 128.195.4.0/24
([128.195.4.0, 128.195.4.255]) to the CS
department’s network
A host on the CS department’s network gets one
IP address 128.195.4.150
CIDR allows route aggregation
You can reach 128.0.0.0/8 via ISP1
128.1.0.0/16
Foo.com
ISP3
ISP1
128.2.0.0/16
I
128.0.0.0/8
128.0.0.0/8 ISP1
128.195.0.0/16
Bar.com
University
Library


CS
ISP1 announces one address prefix
128.0.0.0./8 to ISP2
ISP2 can use one routing entry to reach
all networks connected to ISP1
CIDR summary



A network prefix is of variable
length: a.b.c.d/x
Addresses are hierarchical allocated
Routers aggregate multiple address
prefixes into one routing entry to
minimize routing table size.
What problems CIDR does not solve (I)
You can reach 128.0.0.0/8
And 204.1.0.0/16 via ISP1
ISP1
ISP2
128.0.0.0/8
204.0.0.0/8
ISP3
128.0.0.0/8
204.1.0.0/16
204.1.0.0/16 ISP1
Mutil-home.com
204.1.0.0/16

ISP1
An multi-homing site still adds one
entry into global routing tables
What problems CIDR does not solve (II)
You can reach 128.0.0.0/8
And 204.1.0.0/16 via ISP1
ISP1
ISP2
128.0.0.0/8
204.0.0.0/8
204.1.0.0/16
ISP3
128.0.0.0/8
204.1.0.0/16 ISP1
Switched.com
204.1.0.0/16

ISP1
A site switches provider without
renumbering still adds one entry into
global routing tables
Global routing tables continue to grow
Source: http://bgp.potaroo.net/as6447/
Special IP Addresses

Reserved or (by convention) special addresses:
Loopback interfaces



all addresses 127.0.0.1-127.255.255.255 are reserved for loopback
interfaces
Most systems use 127.0.0.1 as loopback address
loopback interface is associated with name “localhost”
Broadcast address




Test / Experimental addresses




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
10.0.0.0 - 10.255.255.255
172.16.0.0 - 172.31.255.255
192.168.0.0 - 192.168.255.255
Convention (but not a reserved address)
Default gateway has host number set to ‘1’, e.g., 128.195.4.1
IP Addressing


Addressing defines how addresses
are allocated and the structure of
addresses
IPv4



Classful IP addresses (obsolete)
Classless inter-domain routing (CIDR)
(current standard)
IP Version 6 addresses
IPv6 - IP Version 6


IP Version 6
 Designed to be 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.
IPv6 Header
32 bits
version
(4 bits)
Traffic Class
(8 bits)
Flow Label
(24 bits)
Next Header
(8 bits)
Payload Length (16 bits)
Hop Limits (8 bits)
Source IP address (128 bits)
Destination IP address (128 bits)
Ethernet Header
IPv6 Header
TCP Header
Ethernet frame
Application data
Ethernet Trailer
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
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:DF
12
 Short notation:
 Abbreviations of leading zeroes:
CEDF:BP76:0000:0000:009E:0000:3025:D
F12
 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

IPv4 address in IPv6


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