Topic4 Basic Routing
Topic4 Basic Routing
Basic Routing
(A) Router
Router>int fa0/0
^
Commands
% Invalid input detected at '^' marker.
at the “wrong”
prompt.
Router>en
Router#int fa0/0
^
% Invalid input detected at '^' marker.
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#int fa0/0
Router(config-if)#
Router Commands Hot-Keys
Some Examples of Cisco Commands
Turn on Telnet Service with Password
• To “remotely” telnet into the router via the data ports (e.g.
fa0/0)
• The following shows the commands that turn on the telnet
service of the router.
– vty = ( Virtual TeletYpe), treat this as telnet
– 0 4 = accepting channel 0 to channel 4, concurrently 5 telnet users
can log in.
uccn1003#conf t
uccn1003(config)#line vty 0 4
uccn1003(config-line)#password <password>
uccn1003(config-line)#login
uccn1003(config-line)#end
uccn1003#
Running-configuration
Choo#show run
Building configuration...
• The active configuration file !
version 12.4
of the router. !
hostname Choo
• Stored in RAM !
enable password uccn1003
– If the power is turned-off, the interface FastEthernet0/0
running-configuration will be ip address 192.168.1.254 255.255.255.0
!
GONE. interface FastEthernet0/1
no ip address
• Command “show run”. shutdown
!
– You need to view the interface Vlan1
running-config in order to no ip address
shutdown
troubleshoot the router. !
line con 0
line vty 0 4
password network
login
!
end
Choo#
Startup-configuration
• Stored in NVRAM. Choo#show start
startup-config is not present
• Load in as running-config during Choo#copy run start
Destination filename [startup-config]?
the router startup. Building configuration...
[OK]
• Command for viewing the Choo#show start
Using 508 bytes
startup-config: “show start” !
version 12.4
• Backing up running-config in !
hostname Choo
startup-config: “copy run start” !
enable password uccn1003
– Note, when you turn off switches or !
interface FastEthernet0/0
routers and then turn them back on, ip address 192.168.1.254
they will load their startup 255.255.255.0
!
configuration files. interface FastEthernet0/1
– If you do not backup the running no ip address
shutdown
configuration, it will be lost. !
end
Voiding or Canceling commands
• To remove a command from the configuration, Router#show run
simply go to the proper location or prompt and Building configuration...
type "no" followed by the command to be
removed. !
version 12.4
• The following example shows
!
– How to remove hostname hostname Router
– How to remove enable password !
– How to remove an IP address in int fa0/0 interface FastEthernet0/0
– Please compare the running-config on the right, no ip address
with the running-config at the previous two slides. !
interface FastEthernet0/1
no ip address
Choo# shutdown
Choo#conf t !
Choo(config)#no hostname Choo line con 0
Router(config)#no enable password line vty 0 4
password network
Router(config)#int fa0/0 login
Router(config-if)#no ip address !
Router(config-if)# end
Conclusion
• You have been shown the basic overview of Cisco
Router
– Cisco CLI and how to access it
– Console port and rollover cables
– CLI modes and prompts
– Some simple cisco commands
– Running-config & startup-config.
(B) Introduction to Routing
Introduction to Routing
• Routing is the process of “directing” data from one network to
another network.
• Definition of Forwarding:
– Placing a packet from a inbound interface to a outbound
interface.
Data come
through
this port.
Router “forwards”
the data to the outbound port
IP Routing Rule #1
• If there are 2 or more routers in a network, you
need to configure routes in the routers.
Checking Routing Table in Cisco
• The command to check routing table in cisco
– #show ip route or #sh ip ro
IP Routing Rule #2
• Routes can be set using static routes or dynamic
routes.
C = connected
Setting Static Routes - 3
Destination
network
gateway
Router0#conf t
Router0(config)#ip route 192.168.2.0 255.255.255.0 10.1.1.2
Router0(config)#
gateway
Destination
network
Router1#conf t
Router1(config)#ip route 192.168.1.0 255.255.255.0 10.1.1.1
Router1(config)#
Setting Static Routes - 6
• After the ip route command, Router1 knows the existence
of 192.168.1.0/24 via gateway IP 10.1.1.1
Routing protocols
Two types: distance vector and link state
Router1:
router ospf 1
network 172.16.1.0 0.0.0.255 area 0
network 172.16.2.0 0.0.0.255 area 0
why network 10.0.1.0 is not added?
Router2:
router ospf 1
network 172.16.3.0 0.0.0.255 area 0
network 172.16.4.0 0.0.0.255 area 0
network 10.1.0.0 0.0.0.255 area 0
network 10.1.1.0 0.0.0.255 area 0
IP Routing Rule #3
• In the routing table, the “connected” networks are
shown when we configure the IP address for the
router interfaces.
Router#show ip route
…
190.10.0.0/24 is subnetted, 1 subnets
C 190.10.10.0 is directly connected, FastEthernet0/1
C 192.168.1.0/24 is directly connected, FastEthernet0/0
C 198.8.8.0/24 is directly connected, FastEthernet1/1
Commands for the previous example
Router(config)#int fa0/0
Router(config-if)#ip addr 192.168.1.254 255.255.255.0
• Fa1/0 is NOT set with
Router(config-if)#no shut an IP, thus the routing
table does not show
Router(config-if)#int fa0/1 the subnet attached to
Router(config-if)#ip addr 190.10.10.254 255.255.255.0 it as “connected”
Router(config-if)#no shut – Though the interface
is turn “on” with “no
Router(config-if)#int fa1/0
shut”
Router(config-if)#no shut
Router(config-if)#int fa1/1
Router(config-if)#ip addr 198.8.8.254 255.255.255.0
Router(config-if)#no shut
Router#show ip int br
Interface IP-Address OK? Method Status Protocol
• Question:
– How do we set static routes in Router4 for this
network?
Example of Applying Default Route - 2
Router4(config)#ip route 190.1.1.0 255.255.255.0 200.1.1.1
Router4(config)#ip route 195.10.10.0 255.255.255.0 200.1.1.2
Router4(config)#ip route 202.188.5.0 255.255.255.0 200.1.1.3
Router4(config)#ip route 201.2.2.0 255.255.255.0 200.1.1.3
Router4(config)#ip route 201.3.3.0 255.255.255.0 200.1.1.3
Router4(config)#ip route 193.200.30.0 255.255.255.0 200.1.1.4
Router4(config)#
Router4#show ip route
………
Gateway of last resort is not set
Router4#show ip route
…………
Gateway of last resort is 200.1.1.3 to network 0.0.0.0
Router4#show ip route
……
Gateway of last resort is not set
Router4#show ip route
……….
Gateway of last resort is 200.1.1.3 to network 0.0.0.0
• After selecting the routing protocol (e.g. RIP), the router needs to “advertise”
all the subnets attached it.
• For example, in the above networks:
• Router3 has 4 subnets attached it
– network 201.2.2.0, network 201.1.1.0, network 201.3.3.0, network 202.188.5.0
• Router2 has 3 subnets attached it.
– network 192.180.1.0, network 202.188.5.0, network 200.1.1.0
• Router1 has 2 subnets attached it.
– Network 200.1.1.0, network 195.10.10.0
IP Routing Rule #6
• If there is a new subnet in the network, all the
routers need to have the routes that point to that
subnets.
• R
– A code indicating how the route entry was learned on this router. In this case,
the R stands for RIP (a form of dynamic routing).
• 175.21.0.0/16
– The network address and prefix length (number of bits set to 1 in the subnet
mask) of the destination network.
• [120
– The administrative distance of the route.
• /1]
– The metric of the route specific to the routing protocol used to determine the
route.
– RIP uses hop count as its metric. In this example, there is one router between
this router and the destination.
– Different routing protocols have different set of metrics
Routing Table Entry Explained - 2
• via 10.10.10.1
– The next-hop address (gateway) for the route.
– This is the IP address that the packet will exit from the LAN in order
for the packet to reach its destination.
• 00:00:18
– The length of time since the route has been updated in the routing
table. In this example, the route was updated 18 seconds ago.
• Serial0
– The interface the route was learned through.
– This is also the interface the packets will be switched to in order for
the packets to be forwarded toward its destination.
Windows Routing Table Example
C:\>route print
===========================================================================
Interface List
0x1 ........................... MS TCP Loopback interface
0x2 ...00 20 ed 78 85 31 ...... Realtek RTL8139 Family PCI Fast Ethernet NIC -
Packet Scheduler Miniport
===========================================================================
===========================================================================
Active Routes:
Network Destination Netmask Gateway Interface Metric
0.0.0.0 0.0.0.0 192.168.19.254 192.168.19.31 30
127.0.0.0 255.0.0.0 127.0.0.1 127.0.0.1 1
192.168.19.0 255.255.255.0 192.168.19.31 192.168.19.31 30
192.168.29.0 255.255.255.0 192.168.19.200 192.168.19.31 30
192.168.19.31 255.255.255.255 127.0.0.1 127.0.0.1 30
192.168.9.255 255.255.255.255 192.168.19.31 192.168.19.31 30
224.0.0.0 240.0.0.0 192.168.19.31 192.168.19.31 30
255.255.255.255 255.255.255.255 192.168.19.31 192.168.19.31 1
Default Gateway: 192.168.19.254
===========================================================================
Routing Table Explained - 1
• Windows routing table is displayed with the
command “route print”
• Metric
– shows how "expensive" it is to send the packet.
Windows Routing Table - 2
===========================================================================
Active Routes:
Network Destination Netmask Gateway Interface Metric
0.0.0.0 0.0.0.0 192.168.19.254 192.168.19.31 30
127.0.0.0 255.0.0.0 127.0.0.1 127.0.0.1 1
192.168.19.0 255.255.255.0 192.168.19.31 192.168.19.31 30
192.168.29.0 255.255.255.0 192.168.19.200 192.168.19.31 30
• The first line of this routing table is the default route. 0.0.0.0 0.0.0.0
• The second line is the loopback route.
• The third line defines the range of addresses on the local network
segment.
– This shows that any address in the 192.168.19.0 Class C network should
be found on the network segment connected to the interface with the
address 192.168.19.31.
• The fourth line defines the destination addresses of a remote network
that should not be sent to the default gateway.
– This shows that any address in the 192.168.29.0 Class C network should
be sent to the gateway 192.168.19.200
Windows Routing Table - 3
192.168.19.31 255.255.255.255 127.0.0.1 127.0.0.1 30
192.168.19.255 255.255.255.255 192.168.19.31 192.168.19.31 30
224.0.0.0 240.0.0.0 192.168.19.31 192.168.19.31 30
255.255.255.255 255.255.255.255 192.168.19.31 192.168.19.31 1
Default Gateway: 192.168.19.254
===========================================================================
• The fifth line is how a Microsoft routing table defines that 192.168.9.31
is an address for the local host.
– The 255.255.255.255 netmask identifies that this route applies to only to
packets addressed to the single address 192.168.19.31.
– The 127.0.0.1 Gateway and Interface addresses pass all packets for this
address to the local host.
• The sixed entry lists the broadcast address for the local network.
– This is another entry that is automatically added when an interface on a
Windows TCP/IP system is assigned an IP address.
• The seven line is the multi-cast address.
• The eight line is the broadcast IP address used in protocols such as
dhcp.
Linux Routing Table - 1