11/28/2014
Course Reference Model 7
Application
4
Transport
Provides end-to-end delivery
3
Network
Sends packets over multiple links
2
Link
1
Physical
Provides functions needed by users
Computer Networks Zhang, Xinyu Fall 2014
School of Software East China Normal University
Sends frames over one or more links Sends bits as signals
IPv4 Addressing
IP Addressing
Payload (e.g., TCP segment)
Topic
IP Addresses
• What do IP address look like?
• IPv4 uses 32-bit addresses – IPv6 uses 128-bit addresses
– IP prefixes – IPv4 and IPv6
• Written in “dotted quad” notation – Four 8-bit numbers separated by dots To: 128.0.32.4 From: 18.31.0.67
8 bits
8 bits
8 bits
8 bits
aaaaaaaabbbbbbbbccccccccdddddddd
↔ A.B.C.D
00010010000111110000000000000001
↔
18.31.0.67
1
11/28/2014
IP Addresses
IP Prefixes
• IPv4 uses 32-bit addresses
• Addresses are allocated in blocks called prefixes
– IPv6 uses 128-bit addresses
– Addresses in an L-bit prefix have the same top L bits – There are 232-L addresses aligned on 232-L boundary
• Written in “dotted quad” notation – Four 8-bit numbers separated by dots 8 bits
8 bits
8 bits
8 bits
aaaaaaaabbbbbbbbccccccccdddddddd
↔ A.B.C.D
00010010000111110000000000000001
↔ 18.31.0.1
18
31
0
1
IP Prefixes (2)
?
Quiz
• Written in “address/length” notation – Address is lowest address in the prefix, length is prefix bits – E.g., 128.13.0.0/16 is 128.13.0.0 to 128.13.255.255 – So a /24 (“slash 24”) is 256 addresses, and a /32 is one address
000000101001111100001011xxxxxxxx
↔ ↔ 192.168.0.0/16
000100100001111100000000xxxxxxxx
↔ ↔ 128.13.0.0/16
IP Prefixes
Classful IP Addressing
• More specific prefixes
• Originally, IP addresses came in fixed size blocks with the class/size encoded in the high-order bits
– Has longer prefix, hence a smaller number of IP addresses
– They still do, but the classes are now ignored
• Less specific prefixes – Has shorter prefix, hence a larger number of IP addresses Prefix length
/0
/8
/16
/24
/32
0
8
16
24
32 bits Class A, 224 addresses
1
Class B, 216 addresses
10
232
224
less specific
216
28 more specific
20 Addresses in prefix
Class C, 28 addresses
110
Network portion
Host portion
2
11/28/2014
Public/Private IP Addresses
Allocating Public IP Addresses
• Public IP addresses, e.g. 18.31.0.1
• Follows a hierarchical process
– Valid destination on the global internet – Must be allocated to you before use – Mostly exhausted
ARIN (US, Canada)
• Private IP addresses – Can be used freely within private networks (home, small company) 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, …. – Need public IP addresses and NAT (Network Address Translate) to connect to global Internet
APNIC (Asia Pacific)
IANA (All IPs)
ISPs
RIPE (Europe)
Companies
LACNIC (Latin Amer.) AfriNIC (Africa)
Routing vs. Forwarding • Routing is the process of deciding in which direction to send traffic – Network wide (global) and expensive
IP Forwarding Which way?
Which way?
Which way?
Routing vs. Forwarding (2) • Forwarding is the process of sending a packet on its way
Topic • How do routers forward packets?
– Node process (local) and fast forward
packet
Forward! packet
3
11/28/2014
IP Forwarding
Longest Matching Prefix
• All addresses on one network belong to the same prefix • Node uses a table that lists the next hop for prefixes
• Prefixes in the table might overlap! – Combines hierarchy with flexibility
• Longest matching prefix forwarding rule: Prefix 192.24.0.0/18
Next Hop D
192.24.12.0/22
B A B
– For each packet, find the longest prefix that contains the destination address, i.e., the most specific entry – Forward the packet to the next hop router for that prefix D
C
Longest Matching Prefix (2)
Longest Matching Prefix (2)
192.24.63.255
Prefix 192.24.0.0/18
Next Hop D
192.24.12.0/22
B
192.24.63.255
More specific /18 192.24.15.255 /22
Prefix 192.24.0.0/18
Next Hop D
192.24.12.0/22
B
192.24.12.0
192.24.6.0 192.24.14.32 192.24.54.0
192.24.0.0
192.24.6.0 D 192.24.14.32 B 192.24.54.0 D
IP address
?
192.24.12.0/22
B
/18
More specific
192.24.0.0
IP address
Host/Router Distinction – Routers do the routing – Hosts send remote traffic to the nearest router
192.24.15.255 /22
Not for my network? Send it to the router
192.24.12.0
192.24.3.1 ? 192.24.63.1 ? 192.24.11.255 ? 192.24.12.1 ? 192.24.15.255 ?
/22
• In the Internet:
192.24.63.255
Next Hop D
192.24.15.255
192.24.12.0
Quiz Prefix 192.24.0.0/18
More specific
/18
192.24.0.0
It’s my job to know which way to go …
IP address
4
11/28/2014
Host Forwarding Table
Longest Matching Prefix
• Give using longest matching prefix 255.255.255.255
– 0.0.0.0/0 is a default route that catches all IP addresses Prefix Prefix My network prefix
Next Hop Send to that IP
0.0.0.0/0
Send to my router
Next Hop
192.24.0.1
That IP
0.0.0.0/0
My router 192.24.0.1
192.24.6.0 192.24.0.1 192.24.54.0
Longest Matching Prefix Next Hop
192.24.0.1
That IP
0.0.0.0/0
My router
IP address
Flexibility of Longest Matching Prefix
255.255.255.255
Prefix
0.0.0.0
• Can provide default behavior, with less specifics – To send traffic going outside an organization to a border router
192.24.0.1
192.24.6.0 my router 192.24.0.1 192.24.0.1 192.24.54.0 my router
• Can special case behavior, with more specifics – For performance, economics, security, … 0.0.0.0
IP address
Flexibility of Longest Matching Prefix • Uses hierarchy for a compact table
Other Aspects of Forwarding • It’s not all about addresses …
– Relies on use of large prefixes
• Lookup more complex than table – Used to be a concern for fast routers – Not an issue in practice these days
Payload (e.g., TCP segment)
5
11/28/2014
Other Aspects • Decrement TTL value – Protects against loops
• Checks header checksum – To add reliability
• Fragment large packets – Split to fit it on next link
• Send congestion signals – Warns hosts of congestion
• Generates error messages – To help mange network
• Handle various options
6