Week11.1 Final
Week11.1 Final
Computer Networks
1
Reminder
• Course Evaluations:
https://sucourse.sabanciuniv.edu/mynotif-
tool/goToEvaluationDashboard.jsp
2
Protocol Suites
4
Switch
Switch is a link-layer device: takes an active role
• Uses MAC addresses
• store, forward frames
• examine incoming frame’s MAC address, selectively forward
frame to one-or-more outgoing links when frame is to be
forwarded on segment,
transparent: hosts unaware of presence of switches
plug-and-play, self-learning
• switches do not need to be configured
Internet
IP addressing: 223.1.1.2
introduction
223.1.1.1
223.1.1.4
192.168.56.8
223.1.1.2
223.1.9.2 223.1.7.3
223.1.9.1 223.1.7.1
223.1.8.1 223.1.8.5
223.1.2.6 223.1.3.27
9
Some Special IP address forms
Prefix Suffix Type & Meaning
(network) (host)
all zeros all zeros this computer 0.0.0.0
network address all zeros identifies network x.0.0.0 x.x.0.0 x.x.x.0
Step-1 Check your IPv4 address from device settings Are they different?
Step-2 Check with Google: «My IP address» or whatismyip.com 11
Subnets (Departments, Divisions, etc.)
What’s a subnet ? 223.1.1.1
• To identify the network and host portions of an IPv4 address, the subnet mask is
compared to the IPv4 address bit for bit, from left to right.
• IP address 192.168.10.10 Subnet mask: 255.255.255.0
• Networks are most easily subnetted at the octet boundary of /8, /16, and /24.
• Notice that using longer prefix lengths decreases the number of hosts per subnet.
Prefix
Subnet Mask Subnet Mask in Binary (n = network, h = host) # of hosts
Length
nnnnnnnn.hhhhhhhh.hhhhhhhh.hhhhhhhh
/8 255.0.0.0 11111111.00000000.00000000.00000000 16,777,214
nnnnnnnn.nnnnnnnn.hhhhhhhh.hhhhhhhh
/16 255.255.0.0 11111111.11111111.00000000.00000000 65,534
nnnnnnnn.nnnnnnnn.nnnnnnnn.hhhhhhhh
/24 255.255.255.0 11111111.11111111.11111111.00000000 254
Subnet on an Octet Boundary (Cont.)
• In the first table 10.0.0.0/8 is subnetted using /16 and in the second table, a /24 mask.
Subnet Address Host Range Subnet Address
Host Range
(256 Possible (65,534 possible hosts per Broadcast (65,536 Possible Broadcast
(254 possible hosts per subnet)
Subnets) subnet) Subnets)
20
144.122.0.0
• 144.122.0.0/?
• How many IP numbers?
• I want to distribute addresses to
departments (subnets)
nnnnnnnn.nnnnnnnn.nnnnnnnn.hhhhhhhh
11111111.11111111.11111111.00000000
21
CEng wanted to have 4 networks, solution?
• 144.122.71.0
nnnnnnnn.nnnnnnnn.nnnnnnnn.hhhhhhhh
11111111.11111111.11111111.00000000
22
Ceng wanted to have 4 networks, solution?
• 144.122.71.0 / 25
nnnnnnnn.nnnnnnnn.nnnnnnnn.nnhhhhhh
11111111.11111111.11111111.11000000
23
CEng wanted to have 8 networks, solution?
• 144.122.71.0
nnnnnnnn.nnnnnnnn.nnnnnnnn.hhhhhhhh
11111111.11111111.11111111.00000000
• 192.228.17.0 /27
• 8 networks with 32 addresses
• LAN X : 192.228.17.32 – 192.228.17.63
• LAN Y: 192.228.17.64 – 192.228.17.95
• LAN Z:?
What if I want 3 x 64 and 2 x 32 networks
26
Subnet within an Octet Boundary
• Refer to the table to see six ways to subnet a /24 network (e.g. 192.165.8.x)
Prefix Subnet Mask in Binary # of
Subnet Mask # of hosts
Length (n = network, h = host) subnets
nnnnnnnn.nnnnnnnn.nnnnnnnn.nhhhhhhh
/25 255.255.255.128 11111111.11111111.11111111.10000000 2 126
nnnnnnnn.nnnnnnnn.nnnnnnnn.nnhhhhhh
/26 255.255.255.192 11111111.11111111.11111111.11000000 4 62
nnnnnnnn.nnnnnnnn.nnnnnnnn.nnnhhhhh
/27 255.255.255.224 11111111.11111111.11111111.11100000 8 30
nnnnnnnn.nnnnnnnn.nnnnnnnn.nnnnhhhh
/28 255.255.255.240 11111111.11111111.11111111.11110000 16 14
nnnnnnnn.nnnnnnnn.nnnnnnnn.nnnnnhhh
/29 255.255.255.248 11111111.11111111.11111111.11111000 32 6
nnnnnnnn.nnnnnnnn.nnnnnnnn.nnnnnnhh
/30 255.255.255.252 11111111.11111111.11111111.11111100 64 2
IP addresses: how to get one?
Q: how does network get subnet part of IP address?
A: gets allocated portion of its provider ISP’s address space
ISP's block 11001000 00010111 00010000 00000000 200.23.16.0/20
ISP can then allocate out its address space in smaller blocks:
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
• 128.140.168.1 10000000.10001100.10101000.00000001
• 128.140.175.254 10000000.10001100.10101111.11111110
• Using classless addresses to generate several subnetworks will also be explained in lab and you will
have a quiz on this.
29
Hierarchical addressing: route
aggregation
hierarchical addressing allows efficient advertisement of routing
information:
Organization 0
200.23.16.0/23
Organization 1
“Send me anything
200.23.18.0/23 with addresses
Organization 2 beginning
200.23.20.0/23 . Türk Telekom 200.23.16.0/20”
.
. . Internet
.
Organization 7 .
200.23.30.0/23
“Send me anything
Vodafone with addresses
beginning
199.31.0.0/16”
Hierarchical addressing: more
specific routes
Organization 1 moves from Türk Telekom to Vodafone
ISPs-R-Us now advertises a more specific route to Organization 1
Organization 0
200.23.16.0/23
Organization 1
“Send me anything
200.23.18.0/23 with addresses
Organization 2 beginning
200.23.20.0/23 . Türk Telekom 200.23.16.0/20”
.
. . Internet
.
Organization 7 .
200.23.30.0/23
“Send me anything
Vodafone with addresses
Organization 1 beginning
199.31.0.0/16”
200.23.18.0/23 “or 200.23.18.0/23”
Hierarchical addressing: more
specific routes
Organization 1 moves from Türk Telekom to Vodafone
Vodafone now advertises a more specific route to Organization 1
Organization 0
200.23.16.0/23
“Send me anything
with addresses
Organization 2 beginning
200.23.20.0/23 . Türk Telekom 200.23.16.0/20”
.
. . Internet
.
Organization 7 .
200.23.30.0/23
“Send me anything
Vodafone with addresses
Organization 1 beginning
199.31.0.0/16”
200.23.18.0/23 “or 200.23.18.0/23”
Q: How does a host get IP address within its network (host part of
address)?
hard-coded by sysadmin in config file (e.g., /etc/rc.config in UNIX)
DHCP: Dynamic Host Configuration Protocol: dynamically get address from as
server
• “plug-and-play”
DHCP: Dynamic Host Configuration Protocol
DHCP overview:
host broadcasts DHCP discover msg [optional]
DHCP server responds with DHCP offer msg [optional]
host requests IP address: DHCP request msg
DHCP server sends address: DHCP ack msg
DHCP client-server scenario
Typically, DHCP server will be co-
DHCP server located in router, serving all subnets
223.1.1.1
223.1.2.1
to which router is attached
223.1.2.5
223.1.1.2
223.1.1.4 223.1.2.9
223.1.1.3
223.1.3.27 arriving DHCP client needs
223.1.2.2 address in this network
223.1.3.1 223.1.3.2
DHCP offer
src: 223.1.2.5, 67
Broadcast: I’m a DHCP
dest: 255.255.255.255, 68
server!
yiaddr:Here’s an IP
223.1.2.4
transaction ID: 654
address you can use
lifetime: 3600 secs
The two steps above can
DHCP request be skipped “if a client
src: 0.0.0.0, 68 remembers and wishes to
dest:: 255.255.255.255, 67
Broadcast: OK. I would reuse a previously
yiaddr: 223.1.2.4
like to transaction
use this ID:IP 655
address! allocated network address”
[RFC 2131]
lifetime: 3600 secs
DHCP ACK
src: 223.1.2.5, 67
dest: 255.255.255.255, 68
Broadcast: OK. You’ve
yiaddr: 223.1.2.4
got that IPID:address!
transaction 655
lifetime: 3600 secs
Network Layer: 4-38
DHCP: more than IP addresses
DHCP can return more than just allocated IP address on
subnet:
address of first-hop router for client
name and IP address of DNS server
network mask (indicating network versus host portion of address)
10.0.0.1
138.76.29.7 10.0.0.4
10.0.0.2
10.0.0.3
all datagrams leaving local network have datagrams with source or destination in
same source NAT IP address: 138.76.29.7, this network have 10.0.0/24 address for
but different source port numbers source, destination (as usual)
NAT: network address translation
all devices in local network have 32-bit addresses in a “private” IP
address space (10/8, 172.16/12, 192.168/16 prefixes) that can only
be used in local network
advantages:
just one IP address needed from provider ISP for all devices
can change addresses of host in local network without notifying
outside world
can change ISP without changing addresses of devices in local
network
security: devices inside local net not directly addressable, visible
by outside world
NAT: network address translation
implementation: NAT router must (transparently):
outgoing datagrams: replace (source IP address, port #) of every
outgoing datagram to (NAT IP address, new port #)
• remote clients/servers will respond using (NAT IP address, new port
#) as destination address
remember (in NAT translation table) every (source IP address, port #)
to (NAT IP address, new port #) translation pair
incoming datagrams: replace (NAT IP address, new port #) in
destination fields of every incoming datagram with corresponding
(source IP address, port #) stored in NAT table
NAT: network address translation
NAT translation table
2: NAT router changes 1: host 10.0.0.1 sends
WAN side addr LAN side addr datagram to
datagram source address
138.76.29.7, 5001 10.0.0.1, 3345 128.119.40.186, 80
from 10.0.0.1, 3345 to
138.76.29.7, 5001, …… ……
updates table
S: 10.0.0.1, 3345
D: 128.119.40.186, 80
10.0.0.1
1
S: 138.76.29.7, 5001
2 D: 128.119.40.186, 80 10.0.0.4
10.0.0.2
138.76.29.7 S: 128.119.40.186, 80
D: 10.0.0.1, 3345
4
S: 128.119.40.186, 80 10.0.0.3
D: 138.76.29.7, 5001 3
3: reply arrives, destination
address: 138.76.29.7, 5001
Resources:
RIPE - Preparing an IPv6 Addressing Plan Manual
http://www.ripe.net/training/material/IPv6-for-LIRs-Training-Course/IPv6_addr_plan4.pdf
:
IPv6 Geçiş Eğitimi kapsamında TÜBİTAK ULAKBİM tarafından hazırlanan bu döküman Creative Commons
Attribution-NonCommercial-ShareAlike 3.0 lisansı veya seçiminize göre daha güncel sürümlerine göre kullanılabilir.
Driving Motivation to change IP
• Address space exhaustion
—Two level addressing (network and host) wastes space
—Growth of networks and the Internet
—Extended use of TCP/IP
• e.g. for POS terminals
• Wireless nodes
• Vehicles
• Current trend: Internet of Things
IPv6 Enhancements
IPv6 Geçiş Eğitimi kapsamında TÜBİTAK ULAKBİM tarafından hazırlanan bu döküman Creative Commons
Attribution-NonCommercial-ShareAlike 3.0 lisansı veya seçiminize göre daha güncel sürümlerine göre kullanılabilir.
Header Structure
IPv4 Header IPv6 Header
IPv6 Geçiş Eğitimi kapsamında TÜBİTAK ULAKBİM tarafından hazırlanan bu döküman Creative Commons
Attribution-NonCommercial-ShareAlike 3.0 lisansı veya seçiminize göre daha güncel sürümlerine göre kullanılabilir.
Driving Motivation to change IP
0010000000000001000011011011100000000000000000000000000000000000
0000001010101010000000001111111111111110001010001001110001011010
IPv6 Geçiş Eğitimi kapsamında TÜBİTAK ULAKBİM tarafından hazırlanan bu döküman Creative Commons
Attribution-NonCommercial-ShareAlike 3.0 lisansı veya seçiminize göre daha güncel sürümlerine göre kullanılabilir.
IPv6 Adresses
• An example IPv6 address
0010000000000001 0000110110111000 0000000000000000 0000000000000000
0000001010101010 0000000011111111 1111111000101000 1001110001011010
2001:0DB8:0000:0000:02AA:00FF:FE28:9C5A
IPv6 Geçiş Eğitimi kapsamında TÜBİTAK ULAKBİM tarafından hazırlanan bu döküman Creative Commons
Attribution-NonCommercial-ShareAlike 3.0 lisansı veya seçiminize göre daha güncel sürümlerine göre kullanılabilir.
IPv6 Address Representation
Rule 1 – Omit Leading Zero ***
The first rule to help reduce the notation of IPv6 addresses is to omit any leading 0s (zeros).
Examples:
• 01ab can be represented as 1ab
• 09f0 can be represented as 9f0
• 0a00 can be represented as a00
• 00ab can be represented as ab
Note: This rule only applies to leading 0s, NOT to trailing 0s, otherwise the address would be
ambiguous.
Type Format
A double colon (::) can replace any single, contiguous string of one or more
16-bit hextets consisting of all zeros.
Example:
• 2001:db8:cafe:1:0:0:0:1 (leading 0s omitted) could be represented as 2001:db8:cafe:1::1
Warning: The double colon (::) can only be used once within an address, otherwise there
would be more than one possible resulting address.
Type Format
Original 2001 : 0db8 : 0000 : 1111 : 0000 : 0000 : 0000 : 0200
Compressed 2001:db8:0:1111::200
Example (Hint:double colon (::) can only be used once within an address)
2001:0db8:0000:0000:b450:0000:0000:00b4
2001:db8::b450::b4
2001:db8::b450:0:0:b4
2001:db8::b45:0000:0000:b4
2001:db8:0:0:b450::b4
Conversion of IPv4 addresses to IPv6
IPv6 Geçiş Eğitimi kapsamında TÜBİTAK ULAKBİM tarafından hazırlanan bu döküman Creative Commons
Attribution-NonCommercial-ShareAlike 3.0 lisansı veya seçiminize göre daha güncel sürümlerine göre kullanılabilir.
IPv6 Extension Headers
• Hop-by-Hop Options
— special options that require hop-by-hop processing
• Routing
— Similar to source routing
• Fragment
— fragmentation and reassembly information
• Authentication
— Integrity and Authentication
• Encapsulating security payload
— Privacy and Confidentiality (plus optional authentication)
• Destination options
— Optional info to be processed at destination node
Migration to IPv6
• Not an overnight operation
—lots of investments in v4 networking equipment and software
—currently equipment and software are all IPv6 compatible
—however, turning the key on synchronously all around the world is not easy
• Specialized networks of small devices with IPv6 addresses
—e.g. a network of sensors that covers a large area for security protection
• Some co-existence strategies
—With prior negotiation IPv6 is used
IPv6 Enhancements (1)
•
IPv6 Enhancements (2)
• Support for resource allocation
—Labeling of packets for particular traffic flow
—Allows special handling
• e.g. real time video
IPv6 Header
IP v6 Header Fields (1)
• Version
— 6 (in binary: 0110)
• DS/ECN
—Previously, Traffic Class (Types of Service)
• Classes or priorities of packet
—Now interpretation is different as discussed in v4
• Flow Label
—Identifies a sequence of packets (a flow) that has special handling
requirements
• Payload length
—Length of all extension headers plus user data
IP v6 Header Fields (2)
• Next Header
— Identifies type of header
• Extension header or next layer up
• Hop Limit
— Remaining number of hops
— As in TTL of IPv4, decremented by one at each router
— Packet discarded if reaches zero
• Source Address
• Destination address
• Next Header
• Fragmentation offset
—as in v4
• More flag
—as in v4
• Identification
—as in v4
Routing Header
• Source routing method of IPv6
• List of intermediate nodes to be visited
• Next Header
• Header extension length
• Routing type
• Segments left
—i.e. number of nodes still to be visited
Routing Header
• Type 0 routing
— The only one defined in RFC
2460
• Base header contains the
address of next router
• Router examines the
routing header and
replaces the address in
the base header before
forwarding
Ultimate
destination
address
Destination Options
• Same format as Hop-by-Hop options header
• RFC 2460 defines Pad 1/Pad N as in hop-by-hop options header
Migration to IPv6
• Not an overnight operation
—lots of investments in v4 networking equipment and software
—currently equipment and software are all IPv6 compatible
—however, turning the key on synchronously all around the world is not
easy
• Specialized networks of small devices with IPv6 addresses
—e.g. a network of sensors that covers a large area for security protection
• Some co-existence strategies
—With prior negotiation IPv6 is used
IPv4 and IPv6 Security
• Section 16.6
• IPSec
• Security within the IP level
—so that all upper level applications will be secured
—Integrity, authentication and encryption
—End-to-end, although IP is not end to send
• A very brief summary is given next
IPSec Scope
• Authentication header (AH)
—Authentication and integrity
• Encapsulated Security Payload (ESP)
—encryption + optional (authentication + integrity)
• Key exchange
—Oakley, IKE, ISAKMP
• RFC 2401,2402,2406,2408,2409
Security Association
• Identifies security relationship between sender and receiver
• Details are at local databases
• Security Associations are identified by Security Parameter Indices
Authentication Header
ESP Packet