ch4 ResponseCollege
ch4 ResponseCollege
ch4 ResponseCollege
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
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
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
223.1.2.2
223.1.2.1 223.1.3.1 223.1.3.2
Since ‘90s, address blocks can be assigned with any prefix size
= Classless InterDomain Routing (CIDR)
IPV4 ADDRESS BLOCK ALLOCATION
EVOLUTION
̶ 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
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)
/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
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
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:
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
Subnetwork
157.193.102.0
157.193.103.254
application application
transport transport
IP TCP
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
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?
Data
QUESTION
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.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