IP Forwarding and ICMP

Download Report

Transcript IP Forwarding and ICMP

CSEE W4140
Networking Laboratory
Lecture 3: IP Forwarding and ICMP
Jong Yul Kim
02.08.2010
Today’s topics
IP in Internet Protocol StackApplication
TCP
UDP
ICMP
IP
ARP
Network
Access
IGMP
Transport
Layer
Transport
Network
Network
Layer
Link
Link Layer
Media
Physical
IP: The waist of the hourglass
 IP is the waist of the
hourglass of the
Internet protocol
architecture
Applications
HTTP FTP SMTP
TCP UDP
 Multiple higher-layer
protocols
 Multiple lower-layer
protocols
 Only one protocol at the
network layer.
IP
Data link layer
protocols
Physical layer
protocols
IP network
205.35.293.4
128.59.16.1
Application protocol
IP is the highest layer protocol which
is implemented at both routers and
hosts
Application
Application protocol
Application
TCP
TCP protocol
TCP
IP
Data Link
Host
IP
IP protocol
Data
Link
Data
Link
IP
IP protocol
Data
Link
Router
Data
Link
Data
Link
IP protocol
Data
Link
Router
Data
Link
IP
Network
Access
Host
IP Service
 Delivery service of IP is minimal
 IP provide provides an unreliable connectionless best effort service
(also called: “datagram service”).
 Unreliable: IP does not make an attempt to recover lost packets
 Connectionless: Each packet (“datagram”) is handled independently. IP
is not aware that packets between hosts may be sent in a logical
sequence
 Best effort: IP does not make guarantees on the service (no throughput
guarantee, no delay guarantee,…)
 Consequences:
• Higher layer protocols have to deal with losses or with
packets
•
Packets may be delivered out-of-sequence
duplicate
Two functions of network layer
 Routing
“Collective interactions of all routers to
determine the paths that packets take on
their trips from source to destination”
 Forwarding
“The transfer of a packet from an incoming
link to an outgoing link within a single
router.”
IPv4 Datagram Format (RFC 791)
IP network
205.35.293.4
128.59.16.1
Classless Interdomain Routing
(RFC 4632)
 IP addresses have variable prefixes
 Addresses are interpreted to have a
hierarchy
Classless Interdomain Routing
(RFC 4632)
 Examples
 128.59.19.10
 One host on CS net
 128.59.16.0/21  CS wired net
 128.59.0.0/16  Columbia wired net
 Two parts to an address
 Network part (first 21 bits of CS wired)
 Host part (remaining 11 bits)
CIDR hierarchical address
allocation
ISP
128.1.0.0/16
128.2.0.0/16
128.0.0.0/8
128.59.0.0/16
University
Foo.com
Bar.com
Library
128.59.44.0/24





128.59.16.150
CS
128.59.16.0/24
IP addresses are hierarchically allocated.
An ISP obtains an address block from a Regional Internet Registry
An ISP allocates a subdivision of the address block to an organization
An organization recursively allocates subdivision of its address block to its
networks
A host in a network obtains an address within the address block assigned to
the network
Hierarchical address allocation
128.59.16.[0 – 255]
128.59.16.150
128.59.0.0 – 128.59.255.255
128.0.0.0 - 128.255.255.255




ISP obtains an address block 128.0.0.0/8  [128.0.0.0, 128.255.255.255]
ISP allocates 128.59.0.0/16 ([128.59.0.0, 128.59.255.255]) to the
university.
University allocates 128.59.16.0/24 ([128.59.16.0, 128.59.16.255]) to the
CS department’s network
A host on the CS department’s network gets one IP address 128.59.16.150
Route Aggregation
 Longest prefix match algorithm permits to
aggregate prefixes with identical next hop
address to a single entry
 This contributes significantly to reducing
the size of routing tables of Internet routers
Destination
Next Hop
Destination
Next Hop
10.1.0.0/24
10.1.2.0/24
10.2.1.0/24
10.3.1.0/24
20.2.0.0/16
20.1.1.0/28
R3
direct
direct
R3
R2
R2
10.1.0.0/24
10.1.2.0/24
10.2.1.0/24
10.3.1.0/24
20.0.0.0/8
R3
direct
direct
R3
R2
Regional Internet Registries
(RIRs)




Registration and management of IP address is done by Regional
Internet Registries (RIRs)
Where do RIRs get their addresses from: IANA maintains a high-level
registry that distributes large blocks to RIRs
RIR are administer allocation of:
 IPv4 address blocks
 IPv6 address blocks
 Autonomous system (AS) numbers
There are currently five RIRs worldwide:
 APNIC (Asia/Pacific Region),
 ARIN (North America and Sub-Sahara Africa),
 LACNIC (Latin America and some Caribbean Islands)
 RIPE NCC (Europe, the Middle East, Central Asia, and African
countries located north of the equator).
 AfriNIC (Africa) (100,663,296 IP addresses 5% of total IPv4
addresses!)
Subnet (RFC 950)
 Network within a domain
 General recipe
“Detach each interface from its host or
router, creating islands of isolated
networks, with interfaces terminating the
end points of the isolated networks.
Each of these isolated networks is called
a subnet.”
Subnet Exercise 1
Subnet Exercise 2
Similar to the configuration for Lab 2
Netmask
 Hosts and routers within a subnet use
netmask to determine whether the
other host is directly connected or not
Assigning IP address to a subnet

Every subnet has a network address assigned


Each interface inside this subnet is assigned an address
from the network address



PC1 = 128.59.19.18
PC2 = 128.59.19.19
Gateway address



Example: 128.59.19.0/24
One address is assigned as the default gateway (router)
Router = 128.59.19.1
Broadcast address


One address is assigned as the broadcast address
128.59.19.255
Assigning IP address to a subnet
 How many PCs can I support with the
following network address?
 128.59.19.0/24
 10.0.1.0/29
Router Architecture
Processor
Memory
CPU
Interconnection Network
Interface Card
Interface Card
Interface Card
Functional Components
routing
protocol
Routing
functions
routing
protocol
forwarding table
updates
Control
forwarding
table
Datapath:
forwardng table
lookup
incoming IP
datagrams
IP
Forwarding
per-packet
processing
outgoing IP
datagrams
Forwarding Table
Destination
Next Hop
10.1.0.0/24
10.1.2.0/24
10.2.1.0/24
20.1.0.0/16
20.2.1.0/28
eth0
eth1
10.0.1.1
10.0.1.1
10.0.1.1
IP datagrams can be directly delivered
(“eth0 or eth1”) or are sent to a router
(“10.0.1.1”)
Delivery with forwarding tables
to:
20.2.1.2
Longest Prefix Matching Rule
Destination
Next Hop
11001000
11011111
200.223.0.0/16
200.16.0.0/13
11001000
00010
200.22.0.0/15
11001000
0001011
R2
R4
Direct
 Where would this packet go?
Packet destination is: 200.23.146.51
11001000 00010111 10010010 00110011
PCs can be configured to forward
packets
 echo “1” > /proc/sys/net/ipv4/ip_forward
 route command
Kernel IP routing table
Destination
Gateway
165.91.168.200 0.0.0.0
128.59.16.0
0.0.0.0
165.91.0.0
165.91.168.201
0.0.0.0
128.59.16.1
* Works in Redhat / Fedora
Genmask
255.255.255.248
255.255.248.0
255.255.0.0
0.0.0.0
Flags
U
U
UG
UG
Iface
eth1
eth0
eth1
eth0
Sending a packet from Argon to
Neon
argon.tcpip-lab.edu
"Argon"
128.143.137.144
neon.tcpip-lab.edu
"Neon"
128.143.71.21
router137.tcpip-lab.edu
"Router137"
128.143.137.1
router71.tcpip-lab.edu
"Router71"
128.143.71.1
Router
Ethernet Network
Ethernet Network
Sending a packet
from Argon to
128.143.71.21 is not on my local network.
Therefore, I need to send the packet to my
Neon
128.143.71.21
on my local
network.
default
gateway withisaddress
128.143.137.1
ARP: What is the MAC
address
128.143.137.1?
ARP: TheofMAC
address of
Therefore, I can send the packet directly.
128.143.137.1 is 00:e0:f9:23:a8:20
argon.tcpip-lab.edu
"Argon"
128.143.137.144
ARP: What is the MAC
ARP:
TheofMAC
address of
address
128.143.71.21?
neon.tcpip-lab.edu
128.143.137.1 is 00:20:af:03:98:28
"Neon"
128.143.71.21
router137.tcpip-lab.edu
"Router137"
128.143.137.1
router71.tcpip-lab.edu
"Router71"
128.143.71.1
Router
frame
frame
Ethernet Network
Ethernet Network
ICMP (RFC 792)

Used to communicate network info



Error reporting
Router advertisement and discovery
Has type and code


Type 8, code 0 = echo request
Type 0, code 0 = echo reply

Replies have original sender’s IP header + 64 bits of data

Used by


ping
traceroute
Routing table manipulations
with ICMP
 When a router detects that an IP datagram should
have gone to a different router, the router (here
R2)
 forwards the IP datagram to the correct router
 sends an ICMP redirect message to the host
 Host uses ICMP message to update its routing table
(2) IP datagram
(3) ICMP redirect
(1) IP datagram
R1
IOS Command Mode Hierarchy
Read the Introduction part 4 in textbook
Main Points of Lab 3
 Setting up static routes on:
 Linux machines
 Cisco routers
 Routing packets using:
 Proxy ARP
 ICMP Route Redirect
 Netmasks
Homework
 Prelab 4 due on Friday (02.08.2010)
 Lab report 2 due this week
 Lab report 3 due by next week
 Review
 RIP for next class
Announcements
 In-class quiz next week
 Basic ARP, subnets, and IP forwarding