IP-Forwarding
Download
Report
Transcript IP-Forwarding
IP Forwarding Procedure
(Read Forouzan Chapters 6 and 7))
172.16.96.165
172.16.96.129
Example Network:
B
172.16.96.240/28
RA
eth1
172.16.96.226
172.16.96.225
172.16.96.128/26
RC
172.16.96.224/28
172.16.96.67
172.16.96.193
RB
172.16.96.65
eth0
172.16.96.64/27
172.16.96.192/27
172.16.96.66
RD
A
172.16.96.214
172.16.96.96/27
IP Addresses Identify an
Interface not a machine
(Reference :
“ IP Fundamentals” by Maufer Part II)
In Sending An IP Packet From A to B
A
B
172.16.96.214
172.16.96.165
STEP 1:
Since B 172.16.96.165 [ 10101100.00010000.01100000.101]00101
and A’s network 172.16.96.192/27 [10101100.00010000.01100000.110]00000
do not match in masked off significant part (Prefix):
A must send IP packet to a default gateway which A must know (by set up) to be R B
A must send Address Resolution Protocol (ARP) request to find out RB MAC.
A then sends
IP SA
IPA
MAC DA
…
MAC SA
RB ( MAC)
MACA
0X0800
Ether
Type
STEP
IP Destination Address
IPB
IP Packet
IP packet data
…
FCS
MAC Frame
Frame Control
Sequence ( CRC )
2:
At RB IP frame is extracted and IP Destination Address is examined and compared for longest match
in a forwarding table.
For Example:
Known Prefixes
172.16.96.64/27
172.16.96.96/27
172.16.96.128/26
172.16.96.192/27
172.16.96.224/28
172.16.96.240/28
Next – Hop Gateway
Interface
172.16.96.67
172.16.96.66
172.16.96.65
172.16.96.193
172.16.96.225
172.16.96.226
Metric
eth0
Later
The destination prefix that has the most leading bits in common with the IP DA 172.16.96.165 is
172.16.96.128/26
172.16.96.165 =
10101100.00010000.01100000.10100101
172.16.96.128/26 = [10101100.00010000.01100000.10]000000
Prefix
STEP 2 :
This means we need to forward the packet to whoever has 172.16.96.65 as an IP address.
CAUTION: we want to forward at the MAC layer so need to use ARP to find MAC address
for 172.16.96.65.
DO NOT CHANGE IP DA!!!!!
New time to live => new IP
header check sum
IP SA IP DA
IP
IPA
MAC DA
MAC
RC
MAC
IPB
IP Packet Data
Different value
from step 1
MAC SA
RB MAC
0x0800
ether
Type
FCS
Frame Control
Sequence (CRC)
STEP 3 :
At RC IP frame is extracted and IP destination address is examined and compared for longest
match in a forwarding table.
For Example:
Known Prefixes
172.16.96.64/27
172.16.96.96/27
172.16.96.128/26
172.16.96.192/27
172.16.96.224/27
Next – Hop Gateway
172.16.96.65
172.16.96.66
172.16.96.165
172.16.96.67
172.16.96.67
Interface
Metric
eth1
Later
Longest prefix match of same old IP DA is with 172.16.96.128/26
Difference from before - since RC is directly connected to destinations subnetwork, the subnetwork
layer destination MAC address MACB and IP destination address ( IPB ) are for the same machine.
IP SA
IPA
IP DA
IP
B
MAC DA
MAC SA
MAC B
RC (MAC)
0X0800
IP Packet
Data
FCS
Ether
Type
Aside: Routing protocols ( RIP or OSPF ) build forwarding tables (or can do by hand )
What is the difference between routing and switching?
LAN interconnection devices operate a “ OSI ” (Open Systems Interconnection Reference Model)
Layers:
Layer 1 :
Layer 2:
Layer 3:
Physical Layer
Data Link Layer
Network Layer
Application
Presentation
Application
Session
Transport
Transport
Internet
Network
Subnetwork
Data Link
Physical
Internet Protocol
Stack
Open Systems
Interconnection
Reference Model
Layer 1:
Repeaters
HUBS
( Not too common now)
( Very common )
HUB
To Backbone
Four HUB rule - only 4 hub hops allowed in a
“ Collision Domain ”
Hubs are physical layer devices that just “Repeat” what they see, errored frames and all.
Endstation
1 -- TD+
2 -- TD-
3 -- RD+
4
5
6 -- RD-
7
8
10 Base-T pinout and
HUB attachment
Hub Side
1 -TD+
2 -TD3 -RD+
4
5
6 -RD7
8
Endstation
1 -- TD+
2 -- TD-
3 -- RD+
4
5
6 -- RD-
7
8
Endstation
1
TD+
2
TD3
RD+
4
5
6
RD7
8
Crossover cable
Functionality
Layer 2:
Bridges
Switches
Layer - 2 switches
( Not common now )
( What we call bridges now )
( Way cool marketing term)
Forwarding decisions based only on data link layer header, that is the MAC DA. Use a table made from
observing which addresses are seen on each port.
No more than 7 bridges in diameter.
Today’s ethernet environments use lots of ethernet switches, reducing the collision domain.
Collision domain is the set of ethernet segments that can directly hear each others frames.
Worst case is all inputs want to go out on the same output. Must have some buffering
and some sort of fairness algorithm inside
Layer 3: routers
( Historically Called a Gateway When Different Protocols Were Involved )
Routers forward packets based on the destination address at network layer ( Layer 3 )
3
2
LAN 1
1
LAN 2
May see “Layer - 3 switching” term this just means Routing !
Early Routing
Initially called gateways ( Gateway From One Network To Another ) and later called routers.
Used to connect different physical networks into larger unified network.
Packets contain a destination address, router attempts to match with one of many possible entries
in a table of destination networks, sends out appropriate interface.
First generation router architecture:
Processor
Shared Bus
Interface
Interface
Interface
Processor runs routing protocols and maintains forwarding table of next HOP routers
Packets flow from interface up to processor then back down to correct interface
Performance limited by speed of the bus and processing capability of CPU.
Second generation router:
Distribute the forwarding computations out to the media interface adapters.
Input adapter performs forwarding computation and directs the packet over bus to appropriate output
adapter.
Performance still limited by speed of the bus.
Third Generation Router:
Replace bus with a switch. All ports connected by nonblocking switch fabric.
Processor
Forwarding
Cache
Forwarding
Cache
Adapter
Adapter
Forwarding
Cache
Adapter
Forwarding
Cache
Adapter
Reference: “IP switching protocols and architectures” by Metz Chapter 1