The Internet Network layer: IP Addressing
3 Major Components
Host, router network layer functions:
Network layer
Copyright By PowCoder代写 加微信 powcoder
•path selection •RIP, OSPF, BGP
•addressing conventions •datagram format
•packet handling conventions
Routing protocols
IP protocol
Transport layer: TCP, UDP
routing table
ICMP protocol
Link layer physical layer
•error reporting •router
Addressing 1
IP Addressing: introduction
Dotted-decimal notation
IP address: 32-bit identifier for host, router interface
223.1.1.1 223.1.1.2
interface: connection between host, router and physical link
223.1.3.27
Routers typically have multiple interfaces
host may have multiple interfaces
IP addresses associated with interface, not host, router
223.1.1.1 = 11011111 00000001 00000001 00000001 223 1 1 1
Must be globally unique
Addressing 2
223.1.2.1 223.1.1.4 223.1.2.9
IP Address v4
76543210 76543210 76543210 76543210
128 64 32 16 8 4 2 1 128 64 32 16 8 4 2 1 128 64 32 16 8 4 2 1 128 64 32 16 8 4 2 1
11000000 11111000 11111100 11111101
128 64 0 0 0 0 0 0
128 64 32 16 8 0 0 0
128 64 32 16 8 4 0 0
128 64 32 16 8 4 0 1
High-order bits 192
Low-order bits 253
IP address
192.248.252.253
See Excel Sheet
Addressing 3
IP Addressing
In terms of IP addresses, is there an identifiable pattern that can be observed out of the four IP addresses marked by the red dashed border?
223.1.1.2 223.1.1.4
223.1.2.1 223.1.2.9
They all share the first 3 decimal numbers from the left.
223.1.1.0/24
Addressing 4
223.1.3.27
IP Addressing
IP address:
network part (high order
223.1.1.1 223.1.1.2
host part (low order bits)
223.1.2.1 223.1.1.4 223.1.2.9
One IP Network: 223.1.1.0/24
/24 – Network mask
leftmost 24 bits identify the
network consisting of 3 IP networks or 3 subnets (for IP addresses starting with 223; the first 24 bits correspond to the network address)
network address
most significant bits of the
Addressing 5
223.1.3.27
IP Addressing
IP address:
network part (high order
223.1.1.1 223.1.1.2
host part (low order bits)
223.1.2.1 223.1.1.4 223.1.2.9
What is a network ? (from IP address
223.1.1.3 223.1.3.27 223.1.2.2 LAN
perspective)
device interfaces with same network part of IP address
network consisting of 3 IP networks (for IP addresses starting with 223, first 24 bits are network address)
can physically reach each other without any intervening router
Addressing 6
IP Addressing
How to find the networks?
Detach each interface from router, host
create islands of isolated networks
Interconnected system consisting of 6 subnets
223.1.3.27 223.1.3.2
Addressing 7
8-bit subnet addresses
1.0.0.0 to 127.255.255.255
16-bit subnet
network network
128.0.0.0 to 191.255.255.255
192.0.0.0 to 223.255.255.255
IP Addressing: Classful addressing: given notion of network, let’s re-examine IP addresses:
Classful addressing:
Note: Reserving 216= 65K for host addresses would be wasteful for a 2K hosts requirement
A addresses B 10
0 24-bit subnet C 110
multicast address 32 bits
224.0.0.0 to 239.255.255.255
255.255.255.255 = broadcast address
for special use)
Supports only up to (2^8)-2=254
hosts (2 addresses are reserved
Addressing 8
IP Addressing: CIDR Classful addressing:
(1993) IETF standardized on CIDR
inefficient use of address space, address space exhaustion e.g., class B net allocated enough addresses for 65K hosts,
even if only 2K hosts in that network
CIDR: Classless Inter Domain Routing network portion of address of arbitrary length
address format: a.b.c.d/x, where x is # bits in network portion of address
Network Prefix
network part
11001000 00010111 00010000 00000000 200.23.16.0/23 Addressing 9
IP addressing: Subnet Mask Masks are commonly used in some configuration files
Simply convert the mask to binary and check which is the network part and which is the host part
e.g., for a 23 bits network and 9 bits host, the subnet mask would be
255.255.254.0
Or 1111 1111 1111 1111 1111 1110 0000 0000
Possible values for masks are combinations where there are only
IP address:
11001000 00010111 00010000 00000000 200.23.16.0/23
1’s at the left side and 0’s on the right side of the mask
network part
Addressing 10
ipconfig /all
Addressing 11
Datagram Forwarding Table
IP destination address in arriving packet’s header
routing algorithm
There are 4.2 billion+ possible IP addresses, so rather than listing the individual destination address, we should
local forwarding table dest address output link
list the range of addresses instead (aggregate table entries)
address-range 1 3 address-range 2 2 address-range 3 2 address-range 4 1
Network Layer 4-12
Datagram Forwarding table: example
Destination Address Range
Link Interface
00010111 00010000 00000000 00010111 00010111 11111111 00010111 00011000 00000000 00010111 00011000 11111111
00010111 00011001 00000000 00010111 00011111 11111111
Network Layer 4-13
Datagram Forwarding table: example
Destination Address Range
Link Interface 0
00010111 00010000 00000000 00010111 00010111 11111111 00010111 00011000 00000000 00010111 00011000 11111111
00010111 00011001 00000000 00010111 00011111 11111111
Q: but what happens if ranges don’t divide up so nicely?
Network Layer 4-14
Longest prefix matching rule
Longest prefix matching
when looking for forwarding table entry for given destination address, use longest address prefix that matches destination address.
Destination Address Range
Link interface
11001000 00010111 00010*** ********* 11001000 00010111 00011000 ********* 11001000 00010111 00011*** ********* otherwise
Destination Address: 11001000 00010111 00010110 10100001 Destination Address: 11001000 00010111 00011000 10101010
0 Which interface? 1
Which interface?
Network Layer 4-15
Effects of dynamic forwarding table updating
Packet reordering
Datagram networks maintain forwarding state info in their forwarding tables (which is updated every 1 to 5 minutes, or so). Because of this, a series of packets sent from one end system to another may follow different paths through the network, and may arrive out of order.
Destination Address Range
Link interface 0
11001000 00010111 00010*** ********* 11001000 00010111 00011000 ********* 11001000 00010111 00011*** ********* otherwise
Why packets arrive out-of-order sometimes?
Network Layer 4-16
How an organisation gets a block
of IP addresses?
Network Layer 4-17
ISP’s block
200.23.16.0/20
11001000 00010111 00010000 00000000
An ISP named Fly-By-Night ISP receives a block of IP addresses, specified as 200.23.16.0/20.
Having 8 organisations under the same umbrella, how can it partition this block of addresses equally among 8 organisations?
• IP addresses are managed under the authority of the
Internet Corporation for Assigned Names and Numbers (ICANN),
based on guidelines set forth in [RFC 2050].
• Regional Internet registries (for example, ARIN, RIPE, APNIC, and LACNIC,etc.)
IP addresses: how to get one? Network (network portion):
get allocated portion of ISP’s address space for use within an organisation’s subnet:
ISP’s block 11001000 00010111 00010000 00000000 200.23.16.0/20 Subnet part Host part
How can we divide this block of addresses into 8 organisations?
Addressing 19
IP addresses: how to get one? Network (network portion):
get allocated portion of ISP’s address space for use within an organisation’s subnet:
ISP’s block
11001000 00010111 00010000 00000000 200.23.16.0/20 Subnet part Host part
Host part: 2^12 = 4096 addresses 4096/8 = 512 addresses per organisation
How can we divide this block of addresses to 8 organisations?
Addressing 20
IP addresses: how to get one? Network (network portion):
get allocated portion of ISP’s address space for use within an organisation’s subnet:
ISP’s block 11001000 00010111 00010000 00000000 200.23.16.0/20
Subnet part Host part: 2^12 = 4096 addresses
4096/8 = 512 addresses per organisation FROM
ORGANISATION 0 ORGANISATION 1 ORGANISATION 2 ORGANISATION 3 ORGANISATION 4 ORGANISATION 5 ORGANISATION 6 ORGANISATION 7
0 512 1024 1536 2048 2560 3072 3584
511 1023 1535 2047 2559 3071 3583 4095
How can we divide this block of addresses to 8 organisations?
Addressing 21
IP addresses: how to get one? Network (network portion):
get allocated portion of ISP’s address space for use within an organisation’s subnet:
ISP’s block 11001000 00010111 00010000 00000000 200.23.16.0/20
Host part: 2^12 = 4096 addresses 4096/8 = 512 addresses per organisation
ORGANISATION 0
Host part: [0, 511]
Subnet part Host part
11001000 00010111 00010000 00000000
128 64 0 0 8 0 0 0 0 0 0 16 0 4 2 1 0 0 0 16 0 0 0 0 0 0 0 0 0 0 0 0 200 23 16 0
11001000 00010111 00010001 11111111
128 64 0 0 8 0 0 0 0 0 0 16 0 4 2 1 0 0 0 16 0 0 0 2561 128 64 32 16 8 4 2 1
Addressing 22
IP addresses: how to get one?
ORGANISATION 0
Subnet part
Host part: [0, 511]
The first 23 bits from the left is common to all addresses in Organisation 0; therefore, the subnet address is 200.23.16.0/23
11001000 00010111 00010000 00000000
128 64 0 0 8 0 0 0 0 0 0 16 0 4 2 1 0 0 0 16 0 0 0 0 0 0 0 0 0 0 0 0 200 23 16 0
11001000 00010111 00010001 11111111
128 64 0 0 8 0 0 0 0 0 0 16 0 4 2 1 0 0 0 16 0 0 0 2561 128 64 32 16 8 4 2 1
Addressing 23
Organisation’s Subnet
Network (network portion):
get allocated portion of ISP’s address space for use within an organisation’s subnet:
ISP’s block
11001000 00010111 00010000 00000000
200.23.16.0/20
Organization 0
11001000 00010111 00010000 00000000
200.23.16.0/23
Organization 1
11001000 00010111 00010010 00000000
200.23.18.0/23
Organization 2 …
11001000 00010111 00010100 00000000 ….. ….
200.23.20.0/23 ….
Organization 7
11001000 00010111 00011110 00000000
200.23.30.0/23 Addressing 24
Subnet part
For the complete list, see IP_Addressing.xlsx
Hierarchical addressing: route aggregation
Hierarchical addressing allows for efficient advertisement of routing information:
Organization 0 200.23.16.0/23
Route aggregation – Ability to use a single network prefix to advertise multiple networks
Organization 1 200.23.18.0/23
Send me anything with addresses beginning 200.23.16.0/20
Organization 2 200.23.20.0/23
. Fly-By-Night-ISP
. Organization7 .
200.23.30.0/23
Send me anything with addresses beginning 199.31.0.0/16
Addressing 25
Hierarchical addressing: more specific routes
Fly-By-Night-ISP acquires ISPs-R-Us then transfers Organisation 1 to its network • ISPs-R-Us has a more specific route to Organization 1
Organization 0 200.23.16.0/23
Organization 2 200.23.20.0/23
. Fly-By-Night-ISP
. Organization7 .
200.23.30.0/23
Organization 1
200.23.18.0/23
Send me anything
with addresses
beginning 199.31.0.0/16 or 200.23.18.0/23
Uses longest prefix matching rule – longest, most specific address
matching the destination address
Addressing 26
Send me anything with addresses beginning 200.23.16.0/20
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
Global authority
manages DNS root servers
assigns domain names, resolves disputes
Allocates addresses to regional internet registries (e.g.
ARIN, RIPE, APNIC, LACNIC)
Based on guidelines in RFC 2050
Addressing 27
How a single machine gets an IP
Addressing 28
default gateway, address of local DNS server)
host broadcasts DHCP discover msg (sent within a UDP packet to
IP addresses: how to get one?
Obtaining Host Addresses:
hard-coded by system admin (in a file)
DHCP: Dynamic Host Configuration Protocol: (RFC2131)
DHCP server responds with DHCP offer msg (sent within a UDP
– dynamically get IP address: plug-and-play,
– provides extra network configuration information: (subnet mask,
packet to port 68)
host requests IP address: DHCP request msg
DHCP server sends address: DHCP ack msg Open-source implementation: https://www.isc.org/downloads/
Addressing 29 https://support.microsoft.com/en-us/help/169289/dhcp-dynamic-host-configuration-protocol-basics
ipconfig /all
• acquired via DHCP protocol
Addressing 30
In the simplest case, each subnet will have a DHCP server.
If no server is present on the subnet, a DHCP relay agent that knows the address of the DHCP server relays DHCP messages between DHCP clients and DHCP servers on different IP networks.
DHCP client-server scenario
arriving client
223.1.1.2 223.1.2.1
DHCP relay agent
223.1.3.27
arriving client
DHCP server
223.1.1.4 223.1.2.9
Addressing 31
DHCP client-server scenario
Subnet 223.1.1/24
223.1.2.1 223.1.1.4 223.1.2.9
DHCP relay agent
Subnet 223.1.3/24
223.1.1.1 223.1.1.2
Subnet 223.1.2/24
223.1.3.27
arriving client
When an arriving host wants to connect to the network (i.e. avail of an IP address, and net configuration), it has to find the DHCP server
first. This is done by sending a DHCP discover message.
Addressing 32
DHCP server
DHCP client-server scenario
Within a UDP packet, to port 67
DHCP server: 223.1.2.5
DHCP discover
arriving client
Broadcast address
src : 0.0.0.0, 68
dest.: 255.255.255.255,67 yiaddr: 0.0.0.0 transaction ID: 654
Network Layer
Addressing 4-3333
DHCP client-server scenario
Within a UDP packet, to port 67
DHCP server: 223.1.2.5
DHCP discover
arriving client
Broadcast address
src : 0.0.0.0, 68
dest.: 255.255.255.255,67 yiaddr: 0.0.0.0 transaction ID: 654
DHCP offer
src: 223.1.2.5, 67
dest: 255.255.255.255, 68 yiaddrr: 223.1.2.4 transaction ID: 654 Lifetime: 3600 secs
Network Layer
Addressing 4-3434
DHCP client-server scenario
Within a UDP packet, to port 67
DHCP server: 223.1.2.5
DHCP discover
arriving client
Broadcast address
src : 0.0.0.0, 68
dest.: 255.255.255.255,67 yiaddr: 0.0.0.0 transaction ID: 654
Note: the leased IP address may be renewed using a DHCP renew mechanism.
src: 223.1.2.5, 67
dest: 255.255.255.255, 68 yiaddrr: 223.1.2.4 transaction ID: 655 Lifetime: 3600 secs
Client can now use the IP address leased
src: 0.0.0.0, 68
dest:: 255.255.255.255, 67 yiaddrr: 223.1.2.4 transaction ID: 655 Lifetime: 3600 secs
DHCP request
DHCP offer
src: 223.1.2.5, 67
dest: 255.255.255.255, 68 yiaddrr: 223.1.2.4 transaction ID: 654 Lifetime: 3600 secs
Network Layer 4-35
程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com