Professional Documents
Culture Documents
IP Address Classes: Lecture 8 - IP Addressing & Packets
IP Address Classes: Lecture 8 - IP Addressing & Packets
Network ID Host ID
15-441 8 16 24 32
15-441 Computer Networking Class A 0 Network ID Host ID
15-641
Class B 10
Lecture 8 – IP Addressing & Packets
Class C 110
Peter Steenkiste
Class D 1110 Multicast Addresses
3 4
1
Outline IP Address Problem (1991)
2
CIDR Example IP Addresses: How to Get One?
• But how do routers know Organization 2 11001000 00010111 00010100 00000000 200.23.20.0/23
size of network address? 3 bits ... ….. …. ….
• Routing protocols must carry Organization 7 11001000 00010111 00011110 00000000 200.23.30.0/23
prefix length with address
9 10
11 12
3
CIDR Implications Outline
• IPv6
15 16
4
Routing Within the Subnet Routing Within the Subnet
H1 H2 H1 H2
• Matches 10.1.0.0/23 10.1.1/24
• Matches 10.1.1.1/31 10.1.1/24
17 18
Data
20 21
5
IPv4 Header Fields IPv4 Header Fields
0 4 8 12 16 19 24 28
3 • Version: IP Version • Identifier, flags, fragment offset used for fragmentation
1
ver-
sio
n
HLe
n
TOS
Fl
Length
• 4 for IPv4 • Time to live
Identifier ag Offset
TTL Protocol
s
Checksum
• Must be decremented at each router
Source Address • HLen: Header Length • Packets with TTL=0 are thrown away
Destination Address
Options (if any) • 32-bit words (typically 5) • Ensure packets exit the network
3
Data • Protocol 0
ver-
4
HLe
8 12 16 19 24 28
1
Offset
TTL Protocol Checksum
• Priority information • TCP = 6, ICMP = 1, UDP = 17… Source Address
22 23
6
Fragmentation Related Fields IP Fragmentation Example #1
• Length
router
• Length of IP fragment host
MTU = 4000
• Identification
• To match up with other fragments
Length = 3820, M=0
• Flags
IP IP
• Don’t fragment flag Header Data
26 27
3800 bytes
1980 bytes
• Path MTU discovery protocol determines minimum
Length = 1840, M=0, Offset = 1980 MTU along route
• Uses ICMP error messages
IP IP
Header Data • Common theme in system design
• Assure correctness by implementing complete protocol
1820 bytes
• Optimize common cases to avoid full complexity
28 29
7
Internet Control Message Protocol
IP MTU Discovery with ICMP
(ICMP)
• Short messages used to send error & other control information
MTU =
• Examples 2000 host
router
• Ping request / response router MTU = 1500
• Can use to check whether remote host reachable host
• Destination unreachable MTU = 4000
• Indicates how packet got & why couldn’t go further • Typically send series of packets from one host to another
• Flow control • Typically, all will follow same route
• Slow down packet delivery rate • Routes remain stable for minutes at a time
• Redirect • Makes sense to determine path MTU before sending real packets
• Suggest alternate routing path for future messages
• Operation
• Router solicitation / advertisement
• Send max-sized packet with “do not fragment” flag set
• Helps newly connected host discover local router
• If encounters problem, ICMP message will be returned
• Timeout
• “Destination unreachable: Fragmentation needed”
• Packet exceeded maximum hop limit
• Usually indicates MTU problem encountered
30 31
ICMP ICMP
Frag. Needed Frag. Needed
MTU = 2000 MTU = MTU = 1500 MTU =
2000 host 2000 host
router router
router MTU = 1500 router MTU = 1500
host host
MTU = 4000 MTU = 4000
IP IP
Packet Packet
32 33
8
IP MTU Discovery with ICMP Important Concepts
34 35
Outline IPv6
• “Next generation” IP.
• CIDR addressing • Most urgent issue: increasing
address space.
• 128 bit addresses V/Pr Flow label
36 37
9
IPv6 Addressing IPv6 Autoconfiguration
• Do we need more addresses? Probably, long term
• Big panic in 90s: “We’re running out of addresses!”
• Serverless (“Stateless”). No manual config at all.
• Big worry: Devices. Small devices. Cell phones, toasters,
everything. • Only configures addressing items, NOT other host things
• 128 bit addresses provide space for structure (good!) • If you want that, use DHCP.
• Hierarchical addressing is much easier • Link-local address
• Assign an entire 48-bit sized chunk per LAN – use Ethernet • 1111 1110 10 :: 64 bit interface ID (usually from Ethernet addr)
addresses
• (fe80::/64 prefix)
• Different chunks for geographical addressing, the IPv4 address
space, • Uniqueness test (“anyone using this address?”)
• Perhaps help clean up the routing tables - just use one huge chunk • Router contact (solicit, or wait for announcement)
per ISP and one huge chunk per customer. • Contains globally unique prefix
Sub • Usually: Concatenate this prefix with local ID globally unique IPv6 ID
010 Registry Provider Subscriber Host
Net • DHCP took some of the wind out of this, but nice for “zero-conf”
(many OSes now do this for both v4 and v6)
38 39
40 41
10
IPv6 Header Cleanup IPv6 Fragmentation Cleanup
• IPv4: Small
• No checksum Large
MTU MTU
• Why checksum just the IP header? • IPv6: Router must fragment
• Discard packets, send ICMP “Packet Too Big”
• Efficiency: If packet corrupted at hop 1, don’t • Similar to IPv4 “Don’t Fragment” bit handling
waste b/w transmitting on hops 2..N. • Sender must support Path MTU discovery
• Receive “Packet too Big” messages and send smaller packets
• Useful when corruption frequent, b/w expensive • Increased minimum packet size
• Link must support 1280 bytes;
• Today: Corruption rare, b/w cheap • 1500 bytes if link supports variable sizes
42 43
44 45
11
Private Network Accessing
Altering the Addressing Model
Public Internet
W: Workstation
• Original IP Model: Every host has unique IP address S: Server Machine
• Implications W S
NAT Internet
• Any host can communicate with any other host Corporation X
46 47
W Corporation X
W
C 10.3.3.3
10.2.2.2 C
12
NAT: Opening Client Connection NAT: Client Request
Firewall has valid IP address C: Client
C: Client S: Server
S: Server
243.4.4.4 10.5.5.5 243.4.4.4
source: 198.2.4.5 source: 198.2.4.5 • Use port mapping to make servers available
dest: 10.2.2.2 dest: 243.4.4.4
src port: 80 src port: 80 Int Addr Int Port NAT Port
dest port: 1000 dest port: 5000
10.3.3.3 80 80
Int Addr Int Port NAT Port
• Manually configure NAT table to include entry for well-known port
• Firewall acts as proxy for client 10.2.2.2 1000 5000 • External users give address 243.4.4.4:80
• Acts as destination for server messages • Requests forwarded to server
• Relabels destination to local addresses
52 53
13
NAT Considerations
• NAT has to be consistent during a session.
• Set up mapping at the beginning of a session and maintain it during the
session
• Recall 2nd level goal 1 of Internet: Continue despite loss of networks or gateways
• What happens if your NAT reboots?
• Recycle the mapping that the end of the session
• May be hard to detect
• NAT only works for certain applications.
• Some applications (e.g. ftp) pass IP information in payload
• Need application level gateways to do a matching translation
• Breaks a lot of applications.
• Example: Let’s look at FTP
• NAT is loved and hated
- Breaks many apps (FTP)
- Inhibits deployment of new applications like p2p (but so do firewalls!)
+ Little NAT boxes make home networking simple.
+ Saves addresses. Makes allocation simple.
54
14