ch4 ResponseCollege

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 35

RESPONSE COLLEGE:

NETWORK LAYER DATA PLANE

WOENSDAG 20 OKTOBER 2021


Wouter Tavernier

Partnerlogo 1 Partnerlogo 2 Partnerlogo 3 Partnerlogo 4


AGENDA
̶ IP addressing and subnetting
̶ IP routing tables
NETWORK LAYER
• network layer protocols run in every application
transport
host and router network
data link
physical
network network
data link data link
network physical
physical
data link
physical
• end-host functionality: network
data link
network
data link
physical physical
– send side: receive segment from transport
layer, encapsulate into datagrams and network network
data link data link
forward to correct outgoing link physical physical
network
– receiving side: decapsulate datagram and data link
physical
deliver segment to transport layer application
network transport
data link network network
network physical data link data link
data link physical physical
physical
• router examines header fields in of the
network layer datagram and forward
datagram to next router or host
INTERNET PROTOCOL IN THE NETWORK LAYER
• Internet Protocol (IP, v4 and v6)

• Best-effort end-to-end packet delivery service

• Connectionless: no call setup at network layer


– routers: no state about end-to-end connections

• Packet forwarding using destination host address


– packets between same source-dest pair may take different paths

application
application
transport
transport
network
data link 1. Send data 2. Receive data network
data link
physical
physical
IP PACKET FORMAT
4-bit 4-bit 8-bit ToS 16-bit total length of packet
version header
length
16-bit identification 3-bit flags 13-bit fragment
offset
8-bit TTL 8-bit protocol 16-bit header checksum
32-bit source IP address
32-bit destination IP address
Indicate higher layer protocol
Options
1 Internet (if any)
Control Message Prot. ICMP
2 Internet Group Management Prot. IGMP
4 IP-in-IP tunnelling IP-in-IP
6 Transmission
Data Control Protocol TCP
17User Datagram Protocol UDP
46Resource Reservation Protocol RSVP
89Open Shortest Path First OSPF

IP packet does NOT change from source to destination


NETWORK LAYER
Host & router network layer functions:
Transport layer: TCP, UDP

Routing
Internet Protocol datagram • RIP, OSPF, BGP
• IPv4 datagram format • path selection
• IPv4 fragmentation
Network forwarding
logic
layer Internet Protocol
addressing ICMP protocol
• Addressing conventions • error reporting
• Address assignment • router
“signaling”
Link layer

Physical layer

Data Plane Control Plane


Chapter 4 Chapter 5
IPv4 addressing: interfaces
A: wired Ethernet interfaces
• interface: connection/port connected by Ethernet
223.1.1.1 switches
between host/router and
physical link 223.1.2.1

– host typically has one or two


223.1.1.2
interfaces (e.g., wired 223.1.1.4 223.1.2.6
Ethernet, wireless 802.11)
– router’s typically have
multiple interfaces 223.1.2.46
223.1.1.3
223.1.2.2

• Q: how are interfaces


actually connected? 223.1.2.33 223.1.2.34

– via de link layer

A: wireless WiFi interfaces


connected by WiFi base
station
Network Layer: DP 4-7
IPv4 addressing - address format
• Each interface (≠ host) 223.1.1.1
receives an IP address
223.1.2.1
– connection/port between
host/router and physical link
▪ host typically has one or 223.1.1.4 223.1.2.6

two interfaces (e.g., wired


Ethernet, wireless 802.11)
223.1.2.46
▪ router’s typically have 223.1.1.3
223.1.2.2
multiple interfaces

• IPv4 address: 32-bit 223.1.2.33 223.1.2.34

identifier per host, router


interface
– 4 octets, decimal notation,
separation by dot 223.1.1.1 = 11011111 00000001 00000001 00000001
– 232 possible addresses
223 1 1 1

Network Layer: DP 4-8


IPv4 addressing - subnets
223.1.1.1
• interfaces are grouped into
subnets (networks) 223.1.2.1

223.1.1.4 223.1.2.6
• subnet: set of device interfaces
that can physically reach each
223.1.2.46
other without intervening router 223.1.1.3
223.1.2.2
(locally/directly connected ~
subnet
LAN)

223.1.2.33 223.1.2.34

• recipe: to determine the subnets,


detach each interface from its
host or router, creating islands of
isolated networks network consisting of 3 subnets
– each isolated network is called a
subnet

Network Layer: DP 4-9


IPv4 addressing - subnets
223.1.1.123

• Q: how many subnets ?


223.1.1.1 223.1.1.201

• Rule: Every subnet needs 223.1.1.222

to use a different block of IP


223.1.2.2 223.1.7.0
addresses for its interfaces

• Q: How are address blocks 223.1.2.1 223.1.7.1


223.1.8.1 223.1.8.0
assigned?
223.1.2.6 223.1.3.27

223.1.2.2
223.1.2.1 223.1.3.1 223.1.3.2

Network Layer: DP 4-10


Address assignment – Network
Q: How does an ISP get block of addresses?
A: Internet Assigned Numbers Authority (IANA) of Internet
Corporation for Assigned Names and Numbers (ICANN)
– allocates addresses, delegating to Regional Internet Registries
(RIR)
– manages DNS
– assigns domain names, resolves disputes

Network Layer: DP 4-11


www.icann.org
IPV4 ADDRESSING – CLASSFUL ADDRESSING
• Before the ’90s, network address ranges were constrained to 8, 16 or 24 bits (class A, B and
C networks)
– Coarse granularity with networks of 16M, 64K or 256 addresses per network
– Waste of address ranges => classful addressing not used anymore

[0.0.0.0-128.0.0.0[ [128.0.0.0-192.0.0.0[ address space


HP : 15.0.0.0 UGent : 157.193.0.0

Class A 0 Network Host


128 networks
Class B 10 Network Host 16 million addr/network

Class C 110 Network Host

Class D 1110 Multicast address 16k networks


64k addr/network
Class E 11110 Reserved for future use
2 M networks, 256 addr/network

Since ‘90s, address blocks can be assigned with any prefix size
= Classless InterDomain Routing (CIDR)
IPV4 ADDRESS BLOCK ALLOCATION
EVOLUTION

• Move towards IPv6 delayed


because of:
– Network Address Translation
– Many client/server applications
Address assignment – Network

Q: How are IP address blocks assigned to organizations?


A: Gets allocated portion of its provider ISP’s address
space

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

Or: Organization 7 11001000 00010111 00011110 00000000 200.23.30.0/24


Organization 8 11001000 00010111 00011111 00000000 200.23.31.0/24

Network Layer: DP 4-14


IP ADRESSES & SUBNETS
̶ Every interface of a host or router has an IP address
̶ All interfaces which are directly connected through a link are in the same subnet
̶ IPv4 address of 32 bits has 2 parts, eg: 223 . 1 . 2 . 6 / 29
̶ Mask: 255.255.255.11111000 11011111 00000001 00000010
0000011029 bit subnet part 3 bits
prefix host part

̶ All interfaces in same subnet need to have the same prefix in the IP adres:
̶ Network address is first address in adress block -> denotes the subnet
‒ 223 . 1 . 2 . 0 / 29
‒ 11011111 00000001 00000010 00000000
̶ Broadcast address -> received by all interfaces in the subnet
‒ 223 . 1 . 2 . 7 / 29
‒ 11011111 00000001 00000010 00000111
̶ Other 2^3-2 = 6 addresses to be used for hosts/interfaces within subnet
IPv4 addressing – CIDR examples
IPv4 address (sub-)network part host part
223.1.1.1

Subnet mask 1 1 1 1 1 …1 1 1 1 1 1 1 1 1 1 10 0 0 0…0 0 0 0


223.1.2.1

BORDER SUBNET | HOST


223.1.1.4 223.1.2.6

Subnetwork : 223.1.1.0/24
(sub-)network address : 223.1.1.0 (24 bits)
223.1.2.46
mask used : 255.255.255.0 223.1.1.254
223.1.2.2
# hosts : 254 (0 and 255 not allowed)
host range : 223.1.1.1 - 223.1.1.254

Subnetwork : 223.1.2.0/29
223.1.2.33 223.1.2.34
(sub-)network address : 223.1.2.0 (29 bits)
mask used : 255.255.1111 1000
# hosts : 6 (000 and 111 not allowed)
host range : 223.1.2.1 – 223.1.2.6

Subnetwork : 223.1.2.32/28
(sub-)network address : 223.1.2.32 (28 bits)
mask used : 255.255.255.1111 0000
# hosts : 14 (0000 and 1111 not allowed)
Note : binary, decimal
Network and
Layer: DPhexadecimal
4-16
host range : 223.1.2.33 – 223.1.2.46 notation used where appropriate
Subnet sizes & subnet masks
Addresses Hosts Netmask (decimal)

The following subnet sizes are equivalent: /30 4 2 255.255.255.252

• Binary: 11111111 11111111 11111110 00000000 /29 8 6 255.255.255.248

• Hexadecimal FF.FF.FE.0 /28 16 14 255.255.255.240

/27 32 30 255.255.255.224
• Decimal 255.255.254.0
/26 64 62 255.255.255.192
• Slash notation /23
/25 128 126 255.255.255.128

/24 256 254 255.255.255.0

/23 512 510 255.255.254.0

/22 1024 1022 255.255.252.0

/21 2048 2046 255.255.248.0

/20 4096 4094 255.255.240.0

/19 8192 8190 255.255.224.0

/18 16384 16382 255.255.192.0

/17 32768 32766 255.255.128.0

/16 65536 65534 255.255.0.0

Network Layer: DP 4-17


IPv4 addressing - Special Addresses
The first address of a subnet address range is reserved identifying the network
examples : X.0.0.0/8 or X.Y.0.0/16 or X.Y.Z.0/24
The last address (and 255.255.255.255) of a subnet address range is reserved
broadcasting purposes
examples : X.255.255.255/8 or X.Y.255.255/16 or X.Y.Z.255/24

0.X.Y.Z/8 : this host on this network (used for booting)


only allowed as source address

127.X.Y.Z : loopback Interface (for debugging)


in practice mainly 127.0.0.1 address used

169.254.0.0/16: link-local addressing (only valid on link, not routable)


only allowed as destination address, no forwarding allowed

10.0.0.0-10.255.255.255;
172.16.0.0-172.31.255.255;
192.168.0.0-192.168.255.255 :
used for private networks (can be re-used = occur multiple times)
examples: home networks, enterprise LAN
Network Layer: DP 4-18
EXERCISE 1: ADDRESSING

Is this a possible host adres?


102.101.99.98 Yes
253.254.255.256 No (>255 !)
123.123.123.123 subnetmask : FF.E0.00.00 Yes
14.143.143.143 subnetmask : FF.0F.00.00 No (wrong mask)
FF.0F.00.00
How many hosts are there in this subnetwork
157.193.122.96 subnetmask : FF.FF.FF.E0 30 hosts

157.193.122.240 is a host in a network with 62 hosts 62 = 2^6 -2 -> 32-6 -> /26
What is the (sub)networkaddress and the subnetmask ? mask: 255.255.255.1100 000
= 255.255.255.192
network address = mask AND host address
= 157.193.122.192
CONVERSION TABLE (OCTET)
EXERCISE 2: SUBNETTING
PC room
Plateau
ftwe01 ftwe02 ftwe51 Belnet backbone
157.193.103.1 157.193.103.2 157.193.103.51

157.193.103.254
157.193.227.2Router Belnet
(belnet)
Router Plateau 157.193.227.1
(ftwe)
157.193.234.2
Router ARC
157.193.60.249 (rtr-arc)

157.193.40.254
157.193.234.1

Router Technicum
Questions: 157.193.60.254 (rtr-tech)
1. How many subnets (with shown addresses)?
II. What prefix lengths can you find (assuming smallest possible eduserv1 eduserv2
address blocks)? 157.193.40.9157.193.40.10
III. What are the smallest subnets and associated prefixes? Note : assume smallest possible subnets with given addresses
STRATEGY: Check smallest and largest used address in subnet, and find longest
common prefix:

Longest common prefix of 157.193.103.1 and 157.193.103.254 = 157.193.103. =


24 first bits
-> /24 network prefix = 255.255.255.0 subnet mask

Longest common prefix of 157.193.60.249 and 157.193.60.254


157.193.60.11111001 and 157.193.60.111111110 -> 29 first
bits
-> /29 network prefix = 255.255.255.248 subnet mask

Longest common prefix of 157.193.234.1 and 157.193.234.2 = 30 first bits


-> /30 network prefix = 255.255.255.252 subnet mask
EX. 2: SOLUTION
PC room
Plateau direct
ftwe01 connected ftwe02 ftwe51 Belnet backbone
157.193.103.1 157.193.103.2 157.193.103.51
network
direct
157.193.103.0/2 connecte
4
157.193.103.254
d
157.193.227.2
Router Belnet
254
Routeraddresses
Plateau
direct
network (belnet)
157.193.227.1
(ftwe) 157.193.227.0
direct 157.193.234.2
connected /30
Router ARC
157.193.60.249 direct
2 addresses
(rtr-arc)
connected network 157.193.40.254
connecte
network 157.193.234.0
157.193.60.24
157.193.234.1
d
/30
8/29
2 addresses
Router Technicum
network
6 addresses
157.193.60.254 (rtr-tech) 157.193.40.0/24
Questions: 254 addresses
1. How many subnets (with shown addresses)? 5
II. What are the largest subnet(s) and associated
eduserv1 eduserv2
prefixes? purple
III. What are the smallest subnets and associated 157.193.40.9157.193.40.10
prefixes? orange
EXC. 2: SOLUTION
subnetmask (CIDR) /24 /25 /26 /27 /28 /29 /30 TIP: Check smallest and largest used address, and find
subnetmask (DEC) 0 .128 .192 .224 .240 .248 .252 smallest subnet in table (e.g., .1+.254  /24, .1+.2  /30,
subnetmask (HEX) .00 .80 .C0 .E0 .F0 .F8 .FC .249+.254  /29)
0 255 0 127 0 63 0 31 0 15 0 7 0 3
4 7 128 255 128 191 128 159 128 143 128 135 128 131
8 15 8 11 132 135
12 15 136 143 136 139
16 31 16 23 16 19 140 143
20 23 144 159 144 151 144 147
24 31 24 27 148 151
28 31 152 159 152 155
32 63 32 47 32 39 32 35 156 159
36 39 160 191 160 175 160 167 160 163
40 47 40 43 164 167
44 47 168 175 168 171
48 63 48 55 48 51 172 175
52 55 176 191 176 183 176 179
56 63 56 59 180 183
60 63 184 191 184 187
64 127 64 95 64 79 64 71 64 67 188 191
68 71 192 255 192 223 192 207 192 199 192 195
72 79 72 75 196 199
76 79 200 207 200 203
80 95 80 87 80 83 204 207
84 87 208 223 208 215 208 211
88 95 88 91 212 215
92 95 216 223 216 219
96 127 96 111 96 103 96 99 220 223
100 103 224 255 224 239 224 231 224 227
104 111 104 107 228 231
108 111 232 239 232 235
112 127 112 119 112 115 236 239
116 119 240 255 240 247 240 243
120 127 120 123
244 247
124 127
248 255 248 251
252 255
AGENDA
̶ IP addressing and subnetting
̶ IP routing tables
IPV4 FORWARDING – HOST & ROUTER
• Forwarding occurs in hosts & routers based on the destination address in the
IP header

• Forwarding never modifies the IP header (apart from fragmentation)


C
Y:to Y

W Forwarding Y
(Routing)
Table
A B
Y:to B
Y:to C
Z:to D
Z:to E

X Source : X D
Destination : Y
Content : TCP

Z
4-26
IPV4 FORWARDING – ROUTERS
• Q: When do nodes need to forward packets to routers?
– Subnet = collection of interfaces able to interact directly via link layer
– Router = device/node connecting different (sub-)networks (acting at the network layer)

• A: When the packet destination is in another subnet than the sending device.
– Gateway = router which gives access to the other subnet

157.193.103.12 Packet to 157.193.102.51


(same subnet)
Subnetwork
157.193.103.0 ==> SEND DIRECTLY

Subnetwork
157.193.102.0
157.193.103.254

router Packet to 157.193.103.12

157.193.102.254 ==> SEND TO ROUTER


(gateway)
157.193.102.51 157.193.102.3

subnet mask : FF.FF.FF.00 or /24


ROUTERS VS SWITCHES
• End-host = terminal = end-point operate at L1-L5
• Routers operate on L3 (and below)
– Forward datagram based on the IP header towards (global) destination

• Switches operate on L2 (and below)


– Forward frame based on the Ethernet header towards other LAN device

application application
transport transport
IP TCP

network network ETH IP TCP


network
data link data link data link data link data link
physical physical physical physical physical physical

ETH IP TCP ETH IP TCP


IP TCP
router switch
ETH

desktop server
FORWARDING TABLE : EXAMPLE
157.193.102.253 157.193.103.254

157.193.102.254

Subnetwork
eth1 157.193.103.0/24
eth0
router B router A 157.193.103.1
Subnetwork
157.193.102.0/24

et h
3
157.193.102.1 157.193.102.34

157.193.104.254

INTERNET Subnetwork
157.193.104.0/24

Forwarding table router A 157.193.104.1


Destination Mask
Prefix length Gateway Interface Interface
127.0.0.0 /8
FF.00.00.00 127.0.0.1 Lo0 127.0.0.1
0.0.0.0 /0
0.0.0.0 157.193.102.25 eth0 157.193.102.2
3 54
/24
157.193.102.0 FF.FF.FF.00 * eth0 157.193.102.2
/24
54
157.193.103.0 FF.FF.FF.00
/24 * eth1
FORWARDING TABLE : EXAMPLE UGENT NETWORK
PC room Forwarding table for an edge router (ftwe)
Plateau Destination Gateway Interface
127.0.0.1 127.0.0.1 lo0
ftwe01 ftwe02 ftwe51 Belnet backbone
157.193.103.1
157.193.103.0
157.193.103.2 157.193.103.51
* lan0
157.193.60.0 * lan1
lan0 default 157.193.60.254 lan1
Forwarding table for a host
157.193.103.254
(eduserv2) 157.193.227.2
Router Belnet
Destination Gateway
157.193.227.1 Interface
(belnet)
Router Plateau
(ftwe) 127.0.0.1 127.0.0.1 lo0
157.193.234.2
157.193.40.0 *Router ARC hme0
157.193.60.31 default 157.193.40.254
(rtr-arc) hme0

157.193.40.254
157.193.234.1

lan1 hme0
Router Technicum
157.193.60.254 (rtr-tech)

eduserv1 eduserv2
157.193.40.9 157.193.40.10
INSPECTING LOCAL ROUTING TABLE
> netstat -rn -r routing table
Routing tables -n name resolution -> use IP addresses

Internet:
Destination Gateway Flags etif
default 192.168.1.1 UGScI en0
127 127.0.0.1 UCS lo0
127.0.0.1 127.0.0.1 UH lo0
169.254 link#4 UCSI en0
192.168.1 link#4 UCSI en0
192.168.1.1 24:f5:a2:ba:9b:ab UHLWIi en0
192.168.1.1/32 link#4 UCSI en0
192.168.1.41 94:b0:1f:81:9c:65 UHLWIi en0
192.168.1.92 4c:6b:e8:c0:68:9c UHLWI en0
192.168.1.194 78:d7:5f:b5:ed:b5 UHLWIi en0
192.168.1.240 a4:e9:75:ac:25:2d UHLWI en0
192.168.1.241/32 link#4 UCS en0
192.168.1.255 ff:ff:ff:ff:ff:ff UHLWbI en0
224.0.0/4 link#4 UmCSI en0
224.0.0.251 1:0:5e:0:0:fb UHmLWI en0
239.255.255.250 1:0:5e:7f:ff:fa UHmLWI en0
Flags :
255.255.255.255/ link#4 UCSI en0
U : route is up S: statically added route L: link-level info C: new
route cloned
G : route to a gateway (if not set : directly connected destination) I/i:
interface scope/ref
WHAT IF ROUTING TABLES ARE MISCONFIGURED?

4-bit 4-bit 8-bit ToS 16-bit total length of packet


version header
length
16-bit identification 3-bit flags 13-bit fragment
offset
8-bit TTL 8-bit protocol 16-bit header checksum
32-bit source IP address
32-bit destination IP address

Time-To-Live : Options (if any)


start at 32 or 64
decrement at each hop
discard packet if TTL=0

Data
QUESTION

Can router A have a routing table such that:


- all traffic from H1 to H3 goes via router B
- all traffic from H2 to H3 goes via router C

33
Make routing table of router A
EXERCISE

Subnetwork
157.193.103.0

router B Subnetwork
router A 157.193.103.1
157.193.102.0

157.193.102.1 157.193.102.34

Subnetwork
157.193.227.0
router
towards
Subnetwork INTERNET
157.193.10.0

157.193.10.1 subnet masks: /24


SOLUTION
157.193.103.254 subnet masks: /24
157.193.102.253
157.193.102.254
LAN 2
Subnetwork
157.193.103.0
LAN 1
router B Subnetwork router A 157.193.103.1
157.193.102.0 157.193.227.254
LAN 4
157.193.102.1 157.193.102.34
157.193.227.253
Subnetwork
LAN 3

157.193.227.0
router
towards
INTERNET directly connected NWs
need no GW
Subnetwork
157.193.10.0
157.193.10.254
157.193.10.1
Destination Subnet Mask Gateway Interface
157.193.102.0 /24 - 157.193.102.254
Direct connected
157.193.103.0 /24 - 157.193.103.254
157.193.227.0 /24 - 157.193.227.254
Networks, not in default 157.193.10.0 /24 157.193.102.253 157.193.102.254
Always: - “default” 0.0.0.0 /0 157.193.227.253 157.193.227.254

You might also like