E-mail: [email protected]/predmeti/ot4ai/Internet-adresiranje-IPv4-new.pdf ·...
Transcript of E-mail: [email protected]/predmeti/ot4ai/Internet-adresiranje-IPv4-new.pdf ·...
What is an IP Address?
• 32-bit number, defined by the Internet Protocol (IP) (RFC 791).
• IP addresses must be unique within the network.
• One IP address may point to:
– one and only one destination on the Internet (unicast), or:
2
– one and only one destination on the Internet (unicast), or:
– one and only one group of destinations (multicast).
• IP addresses are 32-bit integers, oftenly written in 4-octet form:
147.91.8.6• IP address distribution is coordinated in hierarchical manner.
• End users receive their address space from their ISP!
How many IP addresses exists?
• Since 32-bits are used for IP addresses,
maximum number of IP addresses is:
4.294.967.296
• Complete address range can not be used for
host addressing!
IP Address Structure
• IP address consists of two parts:
147.91.8.6
4
10010011 01011011 00001000 00000110
Network prefix
(m bits)
Host id
(32-m bits)
Network Address
• Addresses all hosts on a network segment:
147.91.8.0 /24
5
10010011 01011011 00001000 00000000
Network prefix
(m bits)
Host id
(32-m zeros)
/24 - denotes prefix length (m = 24)
Subnet mask
• Subnet mask - a way of keeping information about prefix length.
255.255.255.0
6
11111111 11111111 11111111 00000000
Network prefix
(m ones)
Host id
(32-m zeros)
Broadcast Address
• Used by IP to broadcast data to all hosts on a given subnet.
147.91.8.255 /24
7
10010011 01011011 00001000 11111111
Network prefix
(m bits - network prefix)
Host id
(32-m ones)
/24 - denotes the prefix length (m = 24)
IP Address Structure - a Review (Repetitio mater studiorum est)
• IP adress:
10010011 01011011 00001000 00000110 147.91.8.6
• Network address:
8
10010011 01011011 00001000 00000000 147.91.8.0 /24
11111111 11111111 11111111 00000000 255.255.255.0
• Subnet mask:
10010011 01011011 00001000 11111111 147.91.8.255 /24
• Broadcast address:
Another Example ...
• Prefix length does notdoes not have to be on octet boundaries:
147.91.9.65 /26
9
10010011 01011011 00001001 01000001
Network prefix
(m=26 bits)
Host id
(6 bits)
/26 - denotes the prefix length (m = 26)
Another Example - Review
• IP adress:
10010011 01011011 00001001 01000001 147.91.9.65 /26
• Network address:
10
10010011 01011011 00001001 01000000 147.91.9.64 /26
11111111 11111111 11111111 11000000 255.255.255.192
• Subnet mask:
10010011 01011011 00001001 01111111 147.91.9.127 /26
• Broadcast address:
Addressing in the LAN
147.91.9.64/26
147.91.9.66
147.91.9.67
147.91.9.68
147.91.9.65
147.91.9.64/26
147.91.9.69
147.91.9.70 147.91.9.71
147.91.9.126
147.91.9.72147.91.9.100 147.91.9.101
Addressing in the LAN (VLAN)
VLAN 1
10.10.5.0/24
VLAN 2
147.91.8.0/2410.10.5.1
VLAN 8
147.91.9.0/24
VLAN 215
147.91.16.0/23
10.10.5.1
147.91.8.5
147.91.9.1
147.91.16.1
Addressing in the WAN
21.15.4.1
21.15.4.2
18.240.6.121.15.4.14
21.15.4.1
18.240.6.2
18.240.6.0/30
21.15.4.6
21.15.4.521.15.4.9
21.15.4.10
21.15.4.13
Why we are using network addresses?
eth0eth0
Routing table
147.91.9.65 -> eth0
147.91.9.66 -> eth0
147.91.9.67 -> eth0
147.91.9.68 -> eth0
147.91.9.69 -> eth0
147.91.9.70 -> eth0
147.91.9.71 -> eth0
147.91.9.72 -> eth0
147.91.9.73 -> eth0 Routing table
147.91.9.64/26
147.91.9.66
147.91.9.67
147.91.9.68
147.91.9.69
147.91.9.70 147.91.9.71
147.91.9.65
147.91.9.126
147.91.9.72147.91.9.100 147.91.9.101
eth0
147.91.9.64/26
147.91.9.66
147.91.9.67
147.91.9.68
147.91.9.69
147.91.9.70 147.91.9.71
147.91.9.65
147.91.9.126
147.91.9.72147.91.9.100 147.91.9.101
147.91.9.73 -> eth0
147.91.9.74 -> eth0
…
Routing table
147.91.9.64/26 -> eth0
IP Address Classification
• Total available address space: 0.0.0.0 0.0.0.0 -- 255.255.255.255255.255.255.255.
• We can classify addresses according to the following criteria:
–– Classes:Classes:
– A, B, C, D, E class networks. Classes are now obsoleted!
15
–– Usage:Usage:
– Public IP addresses (globally routeable, unique and non-reusable).
– Private IP addresses (routeable in private networks only).
– Special IP addresses (reserved, broadcast, multicast etc. networks).
–– Validity:Validity:
– Provider aggregatable (valid until the ISP-User agreement is valid).
– Provider independent (valid until initial criteria for their assignment
are met).
Network Prefix Length - m
• Prefix length may be determined:
– Automatically, depending on the address class - A, B, C, D, E (classful).
– Arbitary, depending on the ISP and customer network topology (CIDR).
• It defines the maximum number of addresses available to the user:
16
6553665536 //1616 65536 addresses
256256 //2424 256 addresses
6464 /26/26 64 addresses
16 bits
24 bits
26 bits
• Assigned network prefix length may be expanded (subnetting)
Classful Addressing
• Today mostly obsoleted, used only by some routing protocols.
• Classful addressing was created in the past to ease allocations.
• IP adress space is divided to 5 IP adress classes - A, B, C, D i E:
0 remaining 31 bits 0.0.0.0 - 127.255.255.255A
17
0 remaining 31 bits 0.0.0.0 - 127.255.255.255A
10 remaining 30 bits 128.0.0.0 - 191.255.255.255B
110 remaining 29 bits 192.0.0.0 - 223.255.255.255C
1110 remaining 28 bits 224.0.0.0 - 239.255.255.255D
1111 remaining 28 bits 240.0.0.0 - 255.255.255.255E
Prefix Length and Classes
Class IP range Start IP address m Subnet mask
A 0/1 0.0.0.0 8 255.0.0.0
B 128/2 128.0.0.0 16 255.255.0.0
C 192/3 192.0.0.0 24 255.255.255.0
18
C 192/3 192.0.0.0 24 255.255.255.0
D 224/4 224.0.0.0 - -
E 240/4 240.0.0.0 - -
• Older routing protocols determined prefix length (m) by the class.
• Newer routing protocols explicitly transmit prefix length.
Classless Addressing(CIDR)
• Basis for classless inter-domain routing (CIDR).
• A customer is assigned an IP network on arbitary boundaries, e.g.:
1319 195195..9191..160160..00 //1919 (81928192 hosts)
• The customer might expand the network prefix length, e.g.:
19
• The customer might expand the network prefix length, e.g.:
819 /24/245 3232 subnets, 254254 hosts/subnet
• Subnet number of all 0’s and all 1’s is allowed by default.
• At the time of introduction of classless routing, it was necessary to
additionally configure routers to support it.
Example Network Topology
Ethernet
Repeater
Access
server
Dial-in x 10
Total of 200
hosts
PPP (unnumbered)
1
9
20
Ethernet
Ethernet
Embedded
router
Router Router
100
hosts
50 PCs
50 PCs
40 PCs
35 PCs
30 PCs
20 PCs
2
3
4
5
6
7
8
Fixed-length Subnet Masks
Ethernet
Repeater
Access
server
10.0.0.3 10.0.0.12
10.0.0.50 10.0.0.0/24
10.0.0.0/24
Dial-in x 10
10.0.9.0 /24
PPP (unnumbered)
21
Ethernet
Ethernet
Embedded
router
Router Router
10.0.0.50 10.0.0.0/24
10.0.0.77
10.0.1.77 10.0.1.2110.0.1.0/24
10.0.1.78 10.0.1.7950 PCs - 10.0.2.0/24
50 PCs - 10.0.3.0/24
40 PCs - 10.0.4.0/24
35 PCs - 10.0.5.0/24
30 PCs - 10.0.6.0/24
20 PCs - 10.0.7.0/24
Addressing Plan - FLSM
i hosts Max addr Start address Prefix Subnet mask Broadcast
1 200 254 10.0.0.0 /24 255.255.255.0 10.0.0.255
2 100 254 10.0.1.0 /24 255.255.255.0 10.0.1.255
3 50 254 10.0.2.0 /24 255.255.255.0 10.0.2.255
22
3 50 254 10.0.2.0 /24 255.255.255.0 10.0.2.255
4 50 254 10.0.3.0 /24 255.255.255.0 10.0.3.255
5 40 254 10.0.4.0 /24 255.255.255.0 10.0.4.255
6 35 254 10.0.5.0 /24 255.255.255.0 10.0.5.255
7 30 254 10.0.6.0 /24 255.255.255.0 10.0.6.255
8 20 254 10.0.7.0 /24 255.255.255.0 10.0.7.255
9 10 254 10.0.8.0 /24 255.255.255.0 10.0.8.255
Network address and broadcast address can Network address and broadcast address can NOTNOT be used for host be used for host
addressing!addressing!
Variable-length Subnet Masks
(VLSM)
Ethernet
Repeater
Access
server
10.0.0.3 10.0.0.12
10.0.0.50 10.0.0.0/24
10.0.0.0/24
Dial-in x 10
10.0.2.192/28
PPP (unnumbered)
23
Ethernet
Ethernet
Embedded
router
Router Router
10.0.0.50 10.0.0.0/24
10.0.0.77
10.0.1.77 10.0.1.2110.0.1.0/25
10.0.1.78 10.0.1.7950 PCs - 10.0.1.128/26
50 PCs - 10.0.1.192/26
40 PCs - 10.0.2.0/26
35 PCs - 10.0.2.64/26
30 PCs - 10.0.2.128/27
20 PCs - 10.0.2.160/27
Addressing Plan - VLSM
i hosts Max addr Start address Prefix Subnet mask Broadcast
1 200 254 10.0.0.0 /24 255.255.255.0 10.0.0.255
2 100 126 10.0.1.0 /25 255.255.255.128 10.0.1.127
3 50 62 10.0.1.128 /26 255.255.255.192 10.0.1.191
24
3 50 62 10.0.1.128 /26 255.255.255.192 10.0.1.191
4 50 62 10.0.1.192 /26 255.255.255.192 10.0.1.255
5 40 62 10.0.2.0 /26 255.255.255.192 10.0.2.63
6 35 62 10.0.2.64 /26 255.255.255.192 10.0.2.127
7 30 30 10.0.2.128 /27 255.255.255.224 10.0.2.159
8 20 30 10.0.2.160 /27 255.255.255.224 10.0.2.191
9 10 14 10.0.2.192 /28 255.255.255.240 10.0.2.207
Network address and broadcast address can Network address and broadcast address can NOTNOT be used for host be used for host
addressing!addressing!
IP Address Distribution
IANAAllocations
RIPE NCC ARIN APNIC LACNIC AfriNIC
25
ISP ISP
ISP ISPISP ISP ISPISP
Assignments
Internet Registries
Address Distribution - Example
ISP
RIPE NCC
IANA
ISP
193193//88
193193..11..3232..0 0 //1919
193193..22..00..0 0 //1616
193193..11..128128..0 0 //1818
27
ISP
ISP ISP
193.2.20.32 /27193.2.20.32 /27 193.2.20.0 /24193.2.20.0 /24
193.2.8.0 /21193.2.8.0 /21
Information about address
distribution?
• Every Internet Registry is maintaining
public database about address assignment
• www.ripe.net - RIPE• www.ripe.net - RIPE
• www.arin.net - ARIN
• www.lacnic.net - LACNIC
• www.apnic.net - APNIC
• www.afrinic.net - AfriNIC
Address Categories
Public IP numbers:
• Globally unique - one IP address points to one and only one destination.
• Non-reusable - once used, the same IP address must not be used elsewhere!
• Routable - theoretically “visible” from anywhere in the Internet.
• Need global coordinated allocation/assignment process (IANA, RIRs, ISPs …).
31
• Need global coordinated allocation/assignment process (IANA, RIRs, ISPs …).
• Agreggatable - routes to 62.2.16/2162.2.16/21 and i 62.2.24/2162.2.24/21 give 62.2.16/2062.2.16/20!
• Limited resource, like a radio-frequency spectrum! They need careful planning!
Private IP numbers:
• Defined by the RFC 1918 (networks 10/810/8, 172.16/12172.16/12 and 192.168/16192.168/16).
• Basic application - intranets, networks behind firewalls or NATs or networks
which won’t connect to the Internet at all!
• They must not be routed on the public networks!
• Need coordination withing the private network where they are used.
Special IP Addresses
• Used internally by various networking protocols.
• They must notmust not be used for host/network addressing.
IP network m Abbreviated IP network usage
0.0.0.0 /0 0/0 Default gateway
32
0.0.0.0 /0 0/0 Default gateway
127.0.0.0 /8 127/8 Loopback network
224.0.0.0 /4 224/2 Multicast addresses (class D)
240.0.0.0 /4 240/4 Class E (reserved by IANA)
• Special addresses are also: network address, subnet mask, broadcast address.
Address Validity(RFC 2050)
Provider aggregatable (PA) address space:
• Assigned by the ISPs, for the need of their end users.
• Valid until the agreement between the ISP and the customer is valid.
• Upon provider change, the user must renumbermust renumber their network!
• Provider guarantees global uniqueness and visibility of the assigned addresses.
33
• Provider guarantees global uniqueness and visibility of the assigned addresses.
• Most of assignments, being done today, are provider aggregatable.
Provider independent (PI) address space:
• Address space, formerly assigned directly by InterNIC, RIPE NCC, APNIC.
• InterNIC, RIPE NCC, APNIC do notdo not assign addresses to end users any more!
• The ISP reserves the right to refuse to route them, or to extra charge the cost for
their routing.
• Necessary for multihomed networks!