router and routing basics v1.2. objectives understand the function of router know the basic...
Post on 30-Dec-2015
237 Views
Preview:
TRANSCRIPT
Router and Routing Basics
V1.2
Objectives
Understand the function of router Know the basic conception in routing Know the working principle of router Understand IP routing process Understand the route between VLANs
Contents
Router definition and function Basic conception Working principle of router IP routing process VLAN route
Router definition(1)
Router——A kind of computer device used to interconnect networks
Router must have the following features: Multiple network layer interfaces to interconnect
different networks Implement the protocols up to the network layer Have the function of storing 、 forwarding 、 path-
finding
Router functions(2)
The core function of router is interconnecting networks and data forwarding. routing : building route table and refreshing switching : forwarding packet between networks. Insulate broadcast packets , define access rule. Connecting different kinds of networks. Rate adapting between networks.
Contents
Router definition and function Basic conception Working principle of router IP routing process VLAN route
Route table
The information that router need to forward data is stored in a table, called ’route table’
Router check the destination address of the packet, and choose the next hop based on the information in route table.
Route table is stored in RAM
Route table composition
Destination address ( Dest) Mask ( Mast) Next hop address (Gw) Forwarding physical interface ( interface) Source of the information (Owner) Route priority ( pri ) metric ( metric)
Route table composition
Example
172.16.8.0 -- Destination network address255.255.255.0 -- Destination network mask1.1.1.1 -- Next hop address fei_1/1 -- Route learning interface and forwarding interfacestatic -- how does router learns this entry1 -- route priority0 -- Metric
Dest Mask Gw Interface Owner pri metric
172.16.8.0 255.255.255.0 1.1.1.1 fei_1/1 static 1 0
Route table establishing and refreshing
How is route established at the beginning?
How to maintain the route table after it is established?
Route Types
Static route
Dynamic route
Directly connected route
192.168.0.1/30
192.168.0.2/30
10.0.0.1/24
172.16.0.1/24
Directly connected route
Directly connected route When network address is configured and the status of the
interface is valid, the network configured on this network will appear in the route table and associated with this interface , the route will change with the status of the interface.
BA
IPv4 Routing Table: Dest Mask Gw Interface Owner pri metric
10.0.0.0 255.255.255.0 10.0.0.1 fei_1/1 direct 0 010.0.0.1 255.255.255.255 10.0.0.1 fei_1/1 address 0 0192.168.0.0 255.255.255.252 192.168.0.1 e1_1 direct 0 0192.168.0.1 255.255.255.255 192.168.0.1 e1_1 address 0 0
fei_1/1e1_1
Static Route
The route manually set by the network administrator is not updated automatically with the change of network topology.
The route table takes effect under the condition that the next hop is reachable.
Advantage: It does not occupy the network resources or system resources.
Disadvantage: It needs to be configured by the administrator manually one by one, and does not automatically adjust with the change of network status.
Static Route Configuration
This is a unidirectional route, there should be an opposite route configured on the counterpart router.
ip route 10.0.0.0 255.0.0.0 172.16.2.2
Stub Network
172.16.2.1
SO
172.16.1.0
B172.16.2.2Network
10.0.0.0B A
Default Route
The default route is a route in the route table, used to transfer the data packets in the route table that does not have a specific route entry.
The default route can be a static route set by the administrator, or be automatically generated by the dynamic route protocol.
Advantage: It dramatically reduces the number of route entries in the route table.
Disadvantage: If the default route is not configured correctly, it will cause the route loop, or not the optimal route.
Example
Default Route Configuration
Stub Network
ip route 0.0.0.0 0.0.0.0 172.16.2.2
172.16.2.1
SO
172.16.1.0
172.16.2.2Network A B
RIPOSPF RIPOSPF
1.0.0.0/8 2.0.0.0/8 3.0.0.0/8
Dynamic route
Routing protocol is a software process running on the router. It will exchange routing information with other routers , studying route information of network not directly connected and adjusting the route information when topology changes.
RIP OSPF
Route table
10.0.0.0/16 fei_1/1
Notice : the comparison of route priority must be between identical routes.
10.0.0.0/16 fei_1/3
10.0.0.0/16 fei_1/3
Route priority
Select the route that has the highest priority to the route table。
Connected interface 0Static route 1External BGP 20OSPF 110IS-IS 115RIP v1, v2 120Internal BGP 200Special (For inner process) 255
Connected interface 0Static route 1External BGP 20OSPF 110IS-IS 115RIP v1, v2 120Internal BGP 200Special (For inner process) 255
Route SourceRoute SourceRoute SourceRoute Source Default priorityDefault priorityDefault priorityDefault priority
Default route priority
Float static route
How to configure static route when there are redundant links?
Network
10M
DDN
fei_1/1
178.1.1.1
177.1.1.1
Float static route
Network
10M
DDN
fei_1/1
178.1.1.1
177.1.1.1
ZXR10(config)#ip route 10.0.0.0 255.0.0.0 177.1.1.1ZXR10(config)#ip route 10.0.0.0 255.0.0.0 178.1.1.1 5 tag 200
Longest Prefix Match principle
10.1.1.1?
ZXR10#show ip routeIPv4 Routing Table: Dest Mask Gw Interface Owner pri metric
1.0.0.0 255.0.0.0 1.1.1.1 fei_1/1 direct 0 01.1.1.1 255.255.255.255 1.1.1.1 fei_1/1 address 0 02.0.0.0 255.0.0.0 2.1.1.1 fei_1/2 direct 0 02.1.1.1 255.255.255.255 2.1.1.1 fei_1/2 address 0 03.0.0.0 255.0.0.0 3.1.1.1 fei_1/3 direct 0 03.1.1.1 255.255.255.255 3.1.1.1 fei_1/3 address 0 010.0.0.0 255.0.0.0 1.1.1.1 fei_1/1 ospf 110 1010.1.0.0 255.255.0.0 2.1.1.1 fei_1/2 static 1 010.1.1.0 255.255.255.0 3.1.1.1 fei_1/3 rip 120 50.0.0.0 0.0.0.0 1.1.1.1 fei_1/1 static 1 0
Contents
Router definition and function Basic conception Working principle of router IP routing process VLAN route
Router working principle
Routing function: Study and exchange the network topology information
or route information, Produce and maintain route table.
Forwarding function: Data transferring and processing procedure. (Receiving
data on one interface, then choose an appropriate interface to send it out, including the work of frame encapsulation and decapsulation.)
Routing function
The functions of routing is to create and maintain route table, make it ready for the LPM check in the forwarding process. It requires several basic steps:
What kind of protocols to route? Is the destination network address in the route table? What is the next hop address? Which interface to send out the packet?
=Frame checking and cache the packet
Coming interface
Associate destination address with the next hop interface
Route table
Create the frame head with the physical address
ARP cache( LAN)
Packet encapsulation and forwarding
Out interface
=
=
=
Maintained by routing function
Maintained by ARP or RARP process
Mapping list( WAN)
Forwarding Function
Routing processRouting processRouting processRouting
processRoute table
Forwardingprocess
Search entry in route tableBased on destination address
Longest matchprinciples
Add route based on route priority
Routing protocol study possible route, select the
best route based on metric
Router working process summary
Contents
Router definition and function Basic conception Working principle of router IP routing process VLAN route
Communication in the same network—ARP Request
IP: 192.168.1.3MAC: 00:20:AF:00:00:03
IP: 192.168.1.1MAC: 00:20:AF:00:00:01
IP: 192.168.1.2MAC: 00:20:AF:00:00:02
A B C
Fei_1/1
Fei_1/2
Fei_1/3
Switch
Suppose A will communicate with B
A judges that it is on the same network segment with B
A searches for the MAC address of B in ARP table
A sends the ARP request packet to find the MAC address of B
Dest MAC: ff:ff:ff:ff:ff:ff
Source MAC:00:20:af:00:00:01
Dest IP: 192.168.1.2
Source IP: 192.168.1.1
ARP request
MAC Port00:20:af:00:00:01 fei_1/1
Communication in the same network—ARP Response
IP: 192.168.1.3MAC: 00:20:AF:00:00:03
IP: 192.168.1.1MAC: 00:20:AF:00:00:01
IP: 192.168.1.2MAC: 00:20:AF:00:00:02
A B C
Fei_1/1
Fei_1/2
Fei_1/3
Switch
Dest MAC:00:20:af:00:00:01
Source MAC:00:20:af:00:00:02
Dest IP: 192.168.1.1
Source IP: 192.168.1.2
ARP reply
MAC Port00:20:af:00:00:01 fei_1/100:20:af:00:00:02 fei_1/2
Communication in the same network—Packet Transfer
IP: 192.168.1.3MAC: 00:20:AF:00:00:03
IP: 192.168.1.1MAC: 00:20:AF:00:00:01
IP: 192.168.1.2MAC: 00:20:AF:00:00:02
A B C
Fei_1/1
Fei_1/2
Fei_1/3
Switch
Dest MAC:00:20:af:00:00:02
Source MAC:00:20:af:00:00:01
Dest IP: 192.168.1.2
Source IP: 192.168.1.1
MAC Port00:20:af:00:00:01 fei_1/100:20:af:00:00:02 fei_1/2
Communication between different networks
IP: 10.1.1.9G: 10.1.1.10 MAC:00:20:AF:00:00:03
IP:10.1.1.5/30G: 10.1.1.6MAC:00:20:AF:00:00:02
A B C
Router
IP: 10.1.1.1/30G: 10.1.1.2MAC:00:20:AF:00:00:01
Suppose A will communicate with B
1 A judges that B is on a different network segment
2 A searches for the MAC address of GW in ARP table
3 A sends packet to B, with the destination MAC address of the GW
fei_1/1:10.1.1.2/30MAC:00:20:AF:00:00:04
fei_1/2:10.1.1.6/30MAC:00:20:AF:00:00:05
fei_1/3:10.1.1.10/30MAC:00:20:AF:00:00:05
Dest MAC:00:20:af:00:00:04
Source MAC:00:20:af:00:00:01
Dest IP: 10.1.1.5
Source IP: 10.1.1.1
Dest network interface10.1.1.0 255.255.255.252 fei_1/110.1.1.4 255.255.255.252 fei_1/210.1.1.8 255.255.255.252 fei_1/3
Communication between different networks
IP: 10.1.1.9G: 10.1.1.10 MAC:00:20:AF:00:00:03
IP:10.1.1.5/30G: 10.1.1.6MAC:00:20:AF:00:00:02
A B C
Router
IP: 10.1.1.1/30G: 10.1.1.2MAC:00:20:AF:00:00:01
fei_1/1:10.1.1.2/30MAC:00:20:AF:00:00:04
fei_1/2:10.1.1.6/30MAC:00:20:AF:00:00:05
fei_1/3:10.1.1.10/30MAC:00:20:AF:00:00:05
Dest network interface10.1.1.0 255.255.255.252 fei_1/110.1.1.4 255.255.255.252 fei_1/210.1.1.8 255.255.255.252 fei_1/3
Dest MAC:00:20:af:00:00:02
Source MAC:00:20:af:00:00:05
Dest IP: 10.1.1.5
Source IP: 10.1.1.1
Whether in the same network
with peer
Is the peer MACaddress in ARP table?
Data link layerencapsulation
Send data at physical layer
Get peer MAC Address by ARP
YES
NO
YES
NO
Is gatewayconfigured?
YES Is the gateway MACaddress in ARP?
Data link layerencapsulation
Get gateway MACaddress by ARP
NO
Send error message
YES
NOEnd
Get peer IP address
Communication process
IP communication process
IP communication process KEY features: IP communication is hop by hop communication Source IP and destination IP address is unchanged Every time the packet passed a data link layer, there
will be a new encapsulation of the packet The return path is not related to the forwarding path
Routing process example
192.168.6.0 /24
192.168.2.0 /24
e1_1/1.1
e1_1/1.1
fei_1/1
192.168.2.3
192.168.1.0 /24
192.168.3.0 /24
192.168.3.3
192.168.4.0 /24
R1
R2
R3
R1 route table192.168.4.0 255.255.255.0 192.168.4.1 e1_1/1.1 direct 0 0 192.168.2.0 255.255.255.0 192.168.2.1 fei_1/1 direct 0 0192.168.1.0 255.255.255.0 192.168.4.2 e1_1/1.1 rip 120 1192.168.6.0 255.255.255.0 192.168.4.2 e1_1/1.1 rip 120 1 192.168.3.0 255.255.255.0 192.168.4.2 e1_1/1.1 rip 120 2
e1_2/1.1
e1_1/1.1
fei_1/1
fei_1/1
Destination address:192.168.3.3
A B
1.Destination address:192.168.3.3
192.168.6.0 /24
192.168.2.0 /24
192.168.2.3
192.168.1.0 /24
192.168.3.0 /24
192.168.3.3
192.168.4.0 /24
R1
R2
R3
R2 route table192.168.4.0 255.255.255.0 192.168.4.2 e1_1/1.1 direct 0 0 192.168.6.0 255.255.255.0 192.168.6.1 e1_2/1.1 direct 0 0192.168.1.0 255.255.255.0 192.168.1.1 fei_1/1 direct 0 0192.168.2.0 255.255.255.0 192.168.4.1 e1_1/1.1 rip 120 1192.168.3.0 255.255.255.0 192.168.6.2 e1_2/1.1 rip 120 1
e1_1/1.1
e1_1/1.1
fei_1/1
e1_2/1.1
e1_1/1.1
fei_1/1
fei_1/1
Destination Address:192.168.3.3
Routing process example
Routing process example
192.168.6.0 /24
192.168.2.0 /24
192.168.2.3
192.168.1.0 /24
192.168.3.0 /24
192.168.3.3
192.168.4.0 /24
R1
R2
R3
R3 route table192.168.3.0 255.255.255.0 192.168.3.1 fei_1/1 direct 0 0 192.168.6.0 255.255.255.0 192.168.6.2 e1_1/1.1 direct 0 0192.168.1.0 255.255.255.0 192.168.6.1 e1_1/1.1 rip 120 1192.168.4.0 255.255.255.0 192.168.6.1 e1_1/1.1 rip 120 1192.168.2.0 255.255.255.0 192.168.6.1 e1_1/1.1 rip 120 2
Return path ?
e1_1/1.1
e1_1/1.1
fei_1/1
e1_2/1.1
e1_1/1.1
fei_1/1
fei_1/1
Destination address:192.168.3.3
Contents
Router definition and function Basic conception Working principle of router IP routing process VLAN route
VL
AN
one
VL
AN
tw
o
VL
AN
three
Method 1: Normal route
Method 2: One-arm route
Method 3: L3 switch
VL
AN
one
VL
AN
tw
o
VL
AN
three
fei_1/1
fei_1/3
fei_1/2
VL
AN
one
VL
AN
tw
o
VL
AN
three
802.1Q trunkencapsulation
fei_1/1.1fei_1/1.2fei_1/1.3
Route Between VLANs
VL
AN
one
VL
AN
tw
o
VL
AN
three
fei_1/1
fei_1/3
Configuration: On the several physical interfaces of the router, configure the default gateway IP addresses of different VLANs. The port of the switch is configured as ACCESS PORT.
Feature: Several router physical interfaces are required; high cost; poor flexibility and expandability fei_1/2
Method 1: Normal Route
VL
AN
one
VL
AN
tw
o
VL
AN
three
802.1Q trunkencapsulation
fei_1/1.1fei_1/1.2 fei_1/1.3
ZXR10(config)#interface fei_1/1.1ZXR10(config-subif)#encapsulation dot1Q 1ZXR10(config-subif)#ip add 1.1.1.1 255.0.0.0
ZXR10(config)#interface fei_1/1.2ZXR10(config-subif)#encapsulation dot1Q 2ZXR10(config-subif)#ip add 2.1.1.1 255.0.0.0
ZXR10(config)#interface fei_1/1.3ZXR10(config-subif)#encapsulation dot1Q 3ZXR10(config-subif)#ip add 3.1.1.1 255.0.0.0
Method 2: One-arm Route
Feature: Only one router physical interface is required; low cost, good expandability; the router
needs to support the trunk encapsulation. Configuration:
On one physical interface of the router, configure several sub-interfaces, and encapsulate them by 802.1Q. Different sub-interfaces configure the default gateway IP addresses of different VLANs. The port of the switch is configured as 802.1Q trunk.
VL
AN
one
VL
AN
tw
o
VL
AN
three
ZXR10(config)#interface vlan 1ZXR10(config-if)#ip add 1.1.1.1 255.0.0.0
ZXR10(config)#interface vlan 2ZXR10(config-if)#ip add 2.1.1.1 255.0.0.0
ZXR10(config)#interface vlan 3ZXR10(config-if)#ip add 3.1.1.1 255.0.0.0
Method 3: L3 Switch
Feature: One device integrates the routing and switching functions.
The visible interfaces are all L2 ports, and the L3 interfaces needs to be created to be associated with VLAN.
Configuration: Each VLAN needs to be configured with the logical
interface. Its IP address is the default gateway address of the corresponding VLAN.
Review
Definition of router Router’s functions Basic concepts in routing Working principle of a router IP routing process within the same network IP routing process between different network Inter VLAN routing
Questions
What’s the two main functions of router? How is the route table established? What is the standard when a router is selecting
the route to route table? When forwarding IP packet, If there are many
matches, what will router do? Describe the encapsulation and decapsulation
during the process of IP routing .
top related