CCN Lab Manual Full
CCN Lab Manual Full
CCN Lab Manual Full
Lab Manual
Computer Communication and Networks
Submitted by:
Asma Ali
Registration #
2016-BSE-031
Submitted to:
Sir. Ayyaz Mehmood Khan
Date of Submission
26-December-2018
Lab #01
4. Use tracert command to access Department of Computer Science of your university and discuss the
results?
Lab #02
Task1:
What is Difference between Straight Through & Cross-over cables?
In straight cable connectivity is like as follow In cross cable connectivity is like as follows
Ping Result:
Lab #03
Version 4 (IPv4)
Version 6 (IPv6)
Version 4 (IPv4): Decimal conversion of 32-bit binary no.
Version 6 (IPv6): Hexadecimal conversion of 128-bit binary no.
There are limited no of valid IP addresses in IPv4. Due to growing no of users in world we need more IP
addresses, so IPv4 was developed. IPv6 has large no valid IP addresses.
Structure of IP: Binary= 11111111. 11111111. 11111111. 11111111
Virtual Lans
Issues with LANs
This arrangement gets the job done in that each device can communicate with any other device, but as the
size of the network grows, several problems will occur. What if the organization’s security policy dictates
that sensitive data on computers in the Accounting department should not be accessible by other
departments? In this design, we have no easy way to enforce that policy.
Another problem that will occur as this network grows is excessive broadcast traffic. Do the computers in
the Marketing department really need to process network broadcasts that occur when computers in the
Accounting and Human Resources departments attempt to communicate with the printers? No they don’t,
but in this design, we have no way to isolate broadcast traffic.
One approach to resolving these issues would be to divide our network into multiple LANs, as shown in
Figure 2. By connecting the devices in each department to their own switch, we have created additional
broadcast domains that isolate broadcast traffic within each department. We have also addressed security
concerns by making sure that computers in one department cannot access sensitive data in another
department. We may have addressed our security concern a little too well, because now computers in one
department can never access computers in another department and the folks in the Marketing department
cannot access a printer. That’s not ideal either. Notice also that we now would have to purchase, install, and
maintain three separate pieces of hardware where one might do the job.
A solution to these and other problems is the Virtual Local Area Network, or VLAN. VLAN technology is
included in the feature sets of most modern Ethernet switches. A VLAN behaves just like a LAN in all
respects but with additional flexibility. By using VLAN technology, it is possible to subdivide a single
physical switch into several logical switches. VLANs are implemented by using the appropriate switch
configuration commands to create the VLANs and assign specific switch interfaces to the desired VLAN.
In Figure we see a network in which VLANs have been implemented. This network is logically equivalent
to the network shown in Figure 2, but only one physical switch is required. Switch interfaces for devices in
the Accounting department have been assigned to VLAN 10, devices in the Marketing department are
connected to switch interfaces in VLAN 20, and the HR department uses VLAN 30.
Switches implement VLANs by adding a VLAN tag to the Ethernet frames as they enter the switch. The
VLAN tag contains the VLAN ID and other information, which is determined by the interface from which
the frame enters the switch. The switch uses VLAN tags to ensure that each Ethernet frame is confined to
the VLAN to which it belongs based on the VLAN ID contained in the VLAN tag. The VLAN tags are
removed as the frames exit the switch on the way to their destination.
This topic describes the features that VLAN Trunking Protocol (VTP) offers to support VLANs. To help
you understand the basic concept, this is a summary of what VTP is:
“VTP allows a network manager to configure a switch so that it will propagate VLAN configurations
to other switches in the network”
VTP minimizes misconfigurations and configuration inconsistencies that can cause problems, such as
duplicate VLAN names or incorrect VLAN-type specifications. VTP helps you simplify management of the
VLAN database across multiple switches.VTP is a Cisco-proprietary protocol and is available on most of
the Cisco switches.
Task:
Topology:
Configuration of Switches:
Switch 1:
Switch>enable
Switch#confter
Switch#conf terminal
Enter configuration commands, one per line.
Switch(config)#vlan 10
Switch(config-vlan)#name sara
Switch(config-vlan)#exit
Switch(config)#vlan 20
Switch(config-vlan)#name asma
Switch(config-vlan)#exit
Switch(config)#vlan 30
Switch(config-vlan)#name tamsal
Switch(config-vlan)#exit
Switch(config)#exit
Switch#conf terminal
Enter configuration commands, one per line.
Switch(config)#vtp domain admin
Switch(config)#vtp mode server
Device mode already VTP SERVER.
Switch(config)#interface fa0/1
Switch(config-if)#switchport mode trunk Ping Results:
Switch(config-if)#switchport trunk allowed vlan 10,20,30
Switch(config-if)#exit
Switch#conf terminal
Enter configuration commands, one per line.
Switch(config)#interface range fa0/2-7
Switch(config-if-range)#switchport mode access
Switch(config-if-range)#switchport access vlan 10
Switch(config-if-range)#exit
Switch(config)#interface range fa0/8-12
Switch(config-if-range)#switchport mode access
Switch(config-if-range)#switchport access vlan 20
Switch(config-if-range)#exit
Switch(config)#interface range fa0/13-16
Switch(config-if-range)#switchport mode access
Switch(config-if-range)#switchport access vlan 30
Switch(config-if-range)#exit
Switch(config)#exit
Switch 2:
Switch>enable
Switch#confter
Switch#conf terminal
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#vtp domain admin
Domain name already set to admin.
Switch(config)#vtp mode client
Setting device to VTP CLIENT mode.
Switch(config)#interface range fa0/2-6
Switch(config-if-range)#switchport mode access
Switch(config-if-range)#switchport access vlan 10
Switch(config-if-range)#exit
Switch(config)#interface range fa0/7-10
Switch(config-if-range)#switchport mode access
Switch(config-if-range)#switchport access vlan 20
Switch(config-if-range)#exit
Switch(config)#interface range fa0/11-15
Switch(config-if-range)#switchport mode access
Switch(config-if-range)#switchport access vlan 30
Switch(config-if-range)#exit
Switch(config)#exit
Switch 4:
Switch>enable
Switch#conf term
Switch#conf terminal
Enter configuration commands, one per line
Switch(config)#vtp domain admin
Changing VTP domain name from NULL to admin
Switch(config)#vtp mode client
Setting device to VTP CLIENT mode.
Switch(config)#interface
Switch(config)#interface fast
Switch(config)#interface fastEthernet
Switch(config)#interface fastEthernet 0/18
Switch(config-if)#switchport mode trunk
Switch(config-if)#switchport trunk allowed vlan 10,20,30
Switch(config-if)#exit
Switch(config)#interface range fa0/2-6
Switch(config-if-range)#switchport mode access
Switch(config-if-range)#switchport access vlan 10
Switch(config-if-range)#exit
Switch(config)#interface range fa0/7-10
Switch(config-if-range)#switchport mode access
Switch(config-if-range)#switchport access vlan 20
Switch(config-if-range)#exit
Switch(config)#interface range fa0/11-15
Switch(config-if-range)#switchport mode access
Switch(config-if-range)#switchport access vlan 30
Switch(config-if-range)#exit
Switch(config)#exit
Switch#
Switch 5:
Switch>enable
Switch#conf term
Switch#conf terminal
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#vtp domain admin
Changing VTP domain name from NULL to admin
Switch(config)#vtp mode client
Setting device to VTP CLIENT mode.
Switch(config)#interface
Switch(config)#interface fast
Switch(config)#interface fastEthernet
Switch(config)#interface fastEthernet 0/18
Switch(config-if)#switchport mode trunk
Switch(config-if)#switchport trunk allowed vlan 10,20,30
Switch(config-if)#exit
Switch(config)#interface range fa0/2-6
Switch(config-if-range)#switchport mode access
Switch(config-if-range)#switchport access vlan 10
Switch(config-if-range)#exit
Switch(config)#interface range fa0/7-10
Switch(config-if-range)#switchport mode access
Switch(config-if-range)#switchport access vlan 20
Switch(config-if-range)#exit
Switch(config)#interface range fa0/11-15
Switch(config-if-range)#switchport mode access
Switch(config-if-range)#switchport access vlan 30
Switch(config-if-range)#exit
Switch(config)#exit
Switch#
Lab #05
Inter Vlan Routing
Inter-VLAN routing as a process of forwarding network traffic from one VLAN to another VLAN using a
router or layer3 device (e.g; Router or L3 Switch).
In the previous labs, we learned about how to configure VLANs on a network switch. To allow devices
connected to the various VLANs to communicate with each other, you need to connect a router.
As we’ve learned that each VLAN is a unique broadcast domain, so, computers on separate VLANs are, by
default, not able to communicate. There is a way to permit these computers to communicate; it is called
inter-VLAN routing.
One of the ways of the ways to carry out inter-VLAN routing is by connecting a router to the switch
infrastructure. VLANs are associated with unique IP subnets on the network.
This subnet configuration enables the routing process in a multi-VLAN environment. When using a router
to facilitate inter-VLAN routing, the router interfaces can be connected to separate VLANs. Devices on
those VLANs communicate with each other via the router.
Task:
Configuration:
Switch 1:
Switch>enable
Switch#confter
Switch#conf terminal
Switch(config)#vlan 10
Switch(config-vlan)#name sara
Switch(config-vlan)#exit
Switch(config)#
Switch(config)#vlan 20
Switch(config-vlan)#name asma
Switch(config-vlan)#exit
Switch(config)#
Switch(config)#vlan 30
Switch(config-vlan)#name tamsal
Switch(config-vlan)#exit
Switch(config)#
Switch(config)#exit
Switch#conf terminal
Switch(config)#vtp domain admin
Changing VTP domain name from NULL to admin
Switch(config)#vtp mode server
Device mode already VTP SERVER.
Switch(config)#interface fa0/1
Switch(config-if)#switchport mode trunk
Switch(config-if)#switchport trunk allowed vlan 10,20,30
Switch(config-if)#exit
Switch#confter
Switch#conf terminal
Switch(config)#interface range fa0/2-7
Switch(config-if-range)#switchport mode access
Switch(config-if-range)#switchport access vlan 10
Switch(config-if-range)#exit Ping Result:
Switch(config)#interface range fa0/8-12 Ping Vlan 20 PC from Vln 10 Pc
Switch(config-if-range)#switchport mode access
Switch(config-if-range)#switchport access vlan 20
Switch(config-if-range)#exit
Switch(config)#interface range fa0/13-16
Switch(config-if-range)#switchport mode access
Switch(config-if-range)#switchport access vlan 30
Switch(config-if-range)#exit.
Switch 2:
Switch>enable
Switch#confter
Switch#conf terminal
Enter configuration commands, one per line.
Switch(config)#vtp domain admin
Domain name already set to admin.
Switch(config)#vtp mode client
Setting device to VTP CLIENT mode.
Switch(config)#interface range fa0/2-6
Switch(config-if-range)#switchport mode access
Switch(config-if-range)#switchport access vlan 10
Switch(config-if-range)#exit
Switch(config)#interface range fa0/7-10
Switch(config-if-range)#switchport mode access
Switch(config-if-range)#switchport access vlan 20
Switch(config-if-range)#exit
Switch(config)#interface range fa0/11-15
Switch(config-if-range)#switchport mode access
Switch(config-if-range)#switchport access vlan 30
Switch(config-if-range)#exit
Switch(config)#exit
Switch 3:
Same as like in switch 2.
Switch 5:
Switch>enable
Switch#conf term
Switch#conf terminal
Switch(config)#vtp domain admin
Changing VTP domain name from NULL to admin
Switch(config)#vtp mode client
Switch(config)#interface
Switch(config)#interface fast
Switch(config)#interface fastEthernet
Switch(config)#interface fastEthernet 0/18
Switch(config-if)#switchport mode trunk
Switch(config-if)#switchport trunk allowed vlan 10,20,30
Switch(config-if)#exit
Switch(config)#interface range fa0/2-6
Switch(config-if-range)#switchport mode access
Switch(config-if-range)#switchport access vlan 10
Switch(config-if-range)#exit
Switch(config)#interface range fa0/7-10
Switch(config-if-range)#switchport mode access
Switch(config-if-range)#switchport access vlan 20
Switch(config-if-range)#exit
Switch(config)#interface range fa0/11-15
Switch(config-if-range)#switchport mode access
Switch(config-if-range)#switchport access vlan 30
Switch(config-if-range)#exit
Switch(config)#exit
Router:
Router>enable
Router#confter
Router#conf terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#interface fa0/0
Router(config-if)#no shutdown
Router(config-if)#interface fa0/0.10
Router(config-subif)#encapsulation dot1Q 10
Router(config-subif)#ip address 192.168.10.2 255.255.255.0
Router(config-subif)#exit
Router(config)#interface fa0/0.20
Router(config-subif)#encapsulation dot1Q 20
Router(config-subif)#ip address 192.168.20.2 255.255.255.0
Router(config-subif)#exit
Router(config)#
Router(config)#interface fa0/0.30
Router(config-subif)#encapsulation dot1Q 30
Router(config-subif)#ip address 192.168.30.2 255.255.255.0
Router(config-subif)#exit
Router(config)#exit
Lab #06
Switching (Switch Port Security & Spanning Tree Protocol)
Port Security
By default, all interfaces on a Cisco switch are turned on. That means that an attacker could connect to your
network through a wall socket and potentially threaten your network. If you know which devices will be
connected to which ports, you can use the Cisco security feature called port security. By using port security,
a network administrator can associate specific MAC addresses with the interface, which can prevent an
attacker to connect his device. This way you can restrict access to an interface so that only the authorized
devices can use it. If anunathorized device is connected, you can decide what action the switch will take, for
example discarding the traffic and shutting down the port.
1. define what action the switch will take when receiving a frame from an unathorized device by using
the port security violation {protect | restrict | shutdown} interface subcommand. All three options
discards the traffic from the unauthorized device. The restrict and shutdown options send a log
messsages when a violation occurs. Shut down mode also shuts down the port.
2. define the maximum number of MAC addresses that can be used on the port by using the switchport
port-security maximum NUMBER interface submode command
Switchport port-security mac address
We have two options static and dynamic to associate mac address with interfaces
In static method we have to manually define exact host mac address with switchport port-security mac-
address MAC_address command. This is the most secure method but it needs a lot of manual works. We
need to enter all mac addresses manually that is too much tedious job.
In dynamic mode we use sticky feature that allows interface to learn mac address automatically. Interface
will learn mac addresses until it reaches maximum number of allowed hosts.
We need to specify what action; it should take in security violation. Three possible modes are available:
Protect: - This mode will only work with sticky option. In this mode frames from non-allowed address
would be dropped. It will not make log entry for dropped frames. Interface will learn address until it reach
maximum allowed number. Any additionally learned addresses would be dropped while keeping interface
operational.
Restrict: - In restrict mode frames from non-allowed address would be dropped. But in this mode, switch
will make a log entry and generate a security violation alert.
Shutdown: - In this mode switch will generate the violation alert and disable the port. Only way to re-
enable the port is to manually enter no shutdown command. This is the default violation mode.
Lab Task:
FOR PC1
Switch(config)#interface fastEthernet 0/1 Topology:
Switch(config-if)#swit
Switch(config-if)#switchport mode
Switch(config-if)#switchport mode acc
Switch(config-if)#switchport mode access
Switch(config-if)#swityc
Switch(config-if)#swit
Switch(config-if)#switchport port
Switch(config-if)#switchport port-security sec
Switch(config-if)#switchport port-security po
Switch(config-if)#switchport port-security
Switch(config-if)#switchport port-security mac
Switch(config-if)#switchport port-security mac-address 0090.21AC.1531
Switch(config-if)#do write
Building configuration...
[OK]
Switch(config-if)#exit
FOR PC2
Switch(config)#interface fastEthernet 0/2
Switch(config-if)#swit
Switch(config-if)#switchport mode
Switch(config-if)#switchport mode acc
Switch(config-if)#switchport mode access
Switch(config-if)#switc
Switch(config-if)#switchport port
Switch(config-if)#switchport port-security
Switch(config-if)#switchport port-security mac
Switch(config-if)#switchport port-security mac-address 00E0.F912.4911
Switch(config-if)#switchport port-security vio
Switch(config-if)#switchport port-security violation shut
Switch(config-if)#switchport port-security violation shutdown
WHEN PC REPLACE
Lab #07
When you run the Wireshark program, the Wireshark graphical user interface shown in Figure 2 will be
displayed. Initially, no data will be displayed in the various windows. The Wireshark interface has five
major components:
The command menus are standard pull down menus located at the top of the window. Of interest to
us now are the File and Capture menus. The File menu allows you to save captured packet data or
open a file containing previously captured packet data, and exit the Wireshark application. The
Capture menu allows you to begin packet capture.
The packet-listing window displays a one-line summary for each packet captured, including the
packet number (assigned by Wireshark; this is not a packet number contained in any protocol’s
header), the time at which the packet was captured, the packet’s source and destination addresses,
the protocol type, and protocol-specific information contained in the packet. The packet listing can
be sorted according to any of these categories by clicking on a column name.
The packet-header details window provides details about the packet selected (highlighted) in the
packet listing window. (To select a packet in the packet listing window, place the cursor over the
packet’s one-line summary in the packet listing window and click with the left mouse button.).
These details include information about the Ethernet frame (assuming the packet was sent/received
over an Ethernet interface) and IP datagram that contains this packet. The amount of Ethernet and
IP-layer detail displayed can be expanded or minimized by clicking on the plus-or-minus boxes to
the left of the Ethernet frame or IP datagram line in the packet details window. If the packet has been
carried over TCP or UDP, TCP or UDP details will also be displayed, which can similarly be
expanded or minimized. Finally, details about the highest level protocol that sent or received this
packet are also provided.
The packet-contents window displays the entire contents of the captured frame, in both ASCII and
hexadecimal format.
Task: Watch the traffic of searching something on internet
Lab #08
Static Routing
Task:
Router 0:
Router>enable
Router#config ter
Router#config terminal
Router(config)#interface gigabitEthernet 0/0
Router(config-if)#ip address 192.168.2.200 255.255.255.0
Router(config-if)#no shutdown
Router(config-if)#exit
Router(config)#interface gigabitEthernet 0/1
Router(config-if)#ip address 192.168.3.200 255.255.255.0
Router(config-if)#no shutdown
Router(config)#ip route 192.168.1.0 255.255.255.0 gigabitEthernet 0/0
%Default route without gateway, if not a point-to-point interface, may impact performance
Router(config)#ip route 192.168.4.0 255.255.255.0 giga
Router(config)#ip route 192.168.4.0 255.255.255.0 gigabitEthernet 0/1
%Default route without gateway, if not a point-to-point interface, may impact performance
Router(config)#exit
Router 1:
Router>enable
Router#config ter
Router#config terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#interface gigabitEthernet 0/0
Router(config-if)#ip address 192.168.1.100 255.255.255.0
Router(config-if)#no shutdown
Router(config-if)#exit
Router(config)#interface giga
Router(config)#interface gigabitEthernet 0/1
Router(config-if)#ip address 192.168.2.100 255.255.255.0
Router(config-if)#no shutdown
Router(config-if)#exit
Router(config)#ip route 192.168.3.0 255.255.255.0 giga
Router(config)#ip route 192.168.3.0 255.255.255.0 gigabitEthernet 0/1
%Default route without gateway, if not a point-to-point interface, may impact performance
Router(config)#ip route 192.168.4.0 255.255.255.0 giga
Router(config)#ip route 192.168.4.0 255.255.255.0 gigabitEthernet 0/1
%Default route without gateway, if not a point-to-point interface, may impact performance
Router(config)#exit
Router#exit
Router 2:
Router>enable
Router#config terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#interface gigabitEthernet 0/1
Router(config-if)#ip address 192.168.3.300 255.255.255.0\
% Invalid input detected at '^' marker.
Router(config-if)#ip address 192.168.3.300 255.255.255.0
% Invalid input detected at '^' marker.
Router(config-if)#ip address 192.168.3.20 255.255.255.0
Router(config-if)#no shutdown
Router(config-if)#exit
Router(config)#interface giga
Router(config)#interface gigabitEthernet 0/0
Router(config-if)#ip address 192.168.4.20 255.255.255.0
Router(config-if)#no shutdown
Router(config-if)#exit
Router(config)#ip route 192.168.2.0 255.255.255.0 gigabitEthernet 0/1
%Default route without gateway, if not a point-to-point interface, may impact performance
Router(config)#ip route 192.168.1.0 255.255.255.0 gigabitEthernet 0/1
%Default route without gateway, if not a point-to-point interface, may impact performance
Router(config)#exit
Output:
Lab # 09
Dynamic Routing
A dynamic routing table is created, maintained, and updated by a routing protocol running on the router.
Examples of routing protocols include RIP (Routing Information Protocol), EIGRP (Enhanced Interior
Gateway Routing Protocol), and OSPF (Open Shortest Path First). Specific dynamic routing protocols are
covered in great detail in other guides.
Routers do share dynamic routing information with each other, which increases CPU, RAM, and bandwidth
usage. However, routing protocols are capable of dynamically choosing a different (or better) path when
there is a change to the routing infrastructure.
Do not confuse routing protocols with routed protocols:
A routed protocol is a Layer 3 protocol that applies logical addresses to devices and routes data
between networks (such as IP)
A routing protocol dynamically builds the network, topology, and next hop information in routing
tables (such as RIP, EIGRP, etc.) Static vs. Dynamic Routing v1.21 – Aaron Balchunas
The following briefly outlines the advantages and disadvantages of dynamic routing:
Advantages of Dynamic Routing
Simpler to configure on larger networks
Will dynamically choose a different (or better) route if a link goes down
Ability to load balance between multiple links
Disadvantages of Dynamic Routing
Updates are shared between routers, thus consuming bandwidth
Routing protocols put additional load on router CPU/RAM
The choice of the “best route” is in the hands of the routing protocol, and not the network
administrator
Dynamic Routing Categories
There are two distinct categories of dynamic routing protocols:
Distance-vector protocols
Link-state protocols
Examples of distance-vector protocols include RIP and IGRP. Examples of link-state protocols include
OSPF and IS-IS.
EIGRP exhibits both distance-vector and link-state characteristics, and is considered a hybrid protocol.
Distance-vector Routing Protocols
All distance-vector routing protocols share several key characteristics:
Periodic updates of the full routing table are sent to routing neighbors.
Distance-vector protocols suffer from slow convergence, and are highly susceptible to loops.
Some form of distance is used to calculate a route’s metric.
The Bellman-Ford algorithm is used to determine the shortest path.
A distance-vector routing protocol begins by advertising directly-connected networks to its neighbors.
These updates are sent regularly (RIP – every 30 seconds; IGRP – every 90 seconds).
Neighbors will add the routes from these updates to their own routing tables. Each neighbor trusts this
information completely, and will forward their full routing table (connected and learned routes) to every
other neighbor. Thus, routers fully (and blindly) rely on neighbors for route information, a concept known
as routing by rumor.
There are several disadvantages to this behavior. Because routing information is propagated from neighbor
to neighbor via periodic updates, distance-vector protocols suffer from slow convergence. This, in addition
to blind faith of neighbor updates, results in distance-vector protocols being highly susceptible to routing
loops.
Distance-vector protocols utilize some form of distance to calculate a route’s metric. RIP uses hopcount as
its distance metric, and IGRP uses a composite of bandwidth and delay.
Link-State Routing Protocols
Link-state routing protocols were developed to alleviate the convergence and loop issues of distance-vector
protocols. Link-state protocols maintain three separate tables:
Neighbor table – contains a list of all neighbors, and the interface each neighbor is connected off of.
Neighbors are formed by sending Hello packets.
Topology table – otherwise known as the “link-state” table, contains a map of all links within an
area, including each link’s status.
Shortest-Path table – contains the best routes to each particular destination (otherwise known as the
“routing” table”)
Link-state protocols do not “route by rumor.” Instead, routers send updates advertising the state of their
links (a link is a directly-connected network).
All routers know the state of all existing links within their area, and store this information in a topology
table. All routers within an area have identical topology tables.
The best route to each link (network) is stored in the routing (or shortest-path) table. If the state of a link
changes, such as a router interface failing, an advertisement containing only this link-state change will be
sent to all routers within that area. Each router will adjust its topology table accordingly, and will calculate a
new best route if required.
By maintaining a consistent topology table among all routers within an area, link-state protocols can
converge very quickly and are immune to routing loops.
Additionally, because updates are sent only during a link-state change, and contain only the change (and not
the full table), link-state protocols are less bandwidth intensive than distance-vector protocols. However, the
three link-state tables utilize more RAM and CPU on the router itself.
Link-state protocols utilize some form of cost, usually based on bandwidth,to calculate a route’s metric. The
Dijkstra formula is used to determine the shortest path.
Task1: Implement RIPv1 on last lab topology.
ROUTER 1:
Router#en
Router#conf ter
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#int fa0/0
Router(config-if)#no shutdown
Router(config-if)#ip address 192.168.1.254 255.255.255.0
Router(config-if)#exit
Router(config)#int fa0/1
Router(config-if)#no shutdown
Router(config-if)#ip address 192.168.2.1 255.255.255.0
Router(config-if)#exit
Router(config)#router rip
Router(config-router)#version 1
Router(config-router)#network 192.168.1.0
Router(config-router)#network 192.168.2.0
ROUTER 2:
Router>en
Router#conf ter
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#int fa0/0
Router(config-if)#no shutdown
Router(config-if)#ip address 192.168.2.2 255.255.255.0
Router(config-if)#exit
Router(config)#int fa0/1
Router(config-if)#no shutdown
Router(config-if)#ip address 192.168.3.1 255.255.255.0
Router(config-if)#exit
Router(config)#router rip
Router(config-router)#version 1
Router(config-router)#network 192.168.2.0
Router(config-router)#network 192.168.3.0
Router(config-router)#do write
Building configuration...
[OK]
ROUTER 3:
Router>en
Router#conf ter
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#int fa0/0
Router(config-if)#no shutdown
Router(config-if)#ip address 192.168.4.254 255.255.255.0
Router(config-if)#exit
Router(config)#int fa0/1
Router(config-if)#no shutdown
Router(config-if)#ip address 192.168.3.2 255.255.255.0
Router(config-if)#exit
Router(config)#router rip
Router(config-router)#version 1
Router(config-router)#network 192.168.3.0
Router(config-router)#network 192.168.4.0
Output:
PC 0 :192.168.1.1 PC1:192.168.4.1
PC0: PC1:
Router(config-router)#network 192.168.1.64
Router(config-router)#network 192.168.1.196
Router(config-router)#network 192.168.1.192
Router(config)#exit
Lab #10
OSPF(Open Shortest Path First)
OSPF (Open Shortest Path First) is a link state routing protocol. Because it is an open standard, it is
implemented by a variety of network vendors. OSPF will run on most routers that doesn’t necessarily have
to be Cisco routers (unlike EIGRP which can be run only on Cisco routers).
Each OSPF router stores routing and topology information in three tables:
Routers R1 and R2 are directly connected. After OSFP is enabled both routers send Hellos to each other to
establish a neighbor relationship. You can verify that the neighbor relationship has indeed been established
by typing the show ipospf neighbors command.
In the example above, you can see that the router-id of R2 is 2.2.2.2. Each OSPF router is assigned a router
ID. A router ID is determined by using one of the following:
By default, OSPF sends hello packets every 10 second on an Ethernet network (Hello interval). A dead
timer is four times the value of the hello interval, so if a routers on an Ethernet network doesn’t receive at
least one Hello packet from an OSFP neighbor for 40 seconds, the routers declares that neighbor to be
down.
OSPF neighbor states
Before establishing a neighbor relationship, OSPF routers need to go through several state changes. These
states are explained below.
1. Init state – a router has received a Hello message from the other OSFP router
2. 2-way state – the neighbor has received the Hello message and replied with a Hello message of his own
3. Exstart state – beginning of the LSDB exchange between both routers. Routers are starting to exchange
link state information.
4. Exchange state – DBD (Database Descriptor) packets are exchanged. DBDs contain LSAs headers.
Routers will use this information to see what LSAs need to be exchanged.
5. Loading state – one neighbor sends LSRs (Link State Requests) for every network it doesn’t know
about. The other neighbor replies with the LSUs (Link State Updates) which contain information about
requested networks. After all the requested information have been received, other neighbor goes through the
same process
6. Full state – both routers have the synchronized database and are fully adjacent with each other.
OSPF areas
OSPF uses the concept of areas. An area is a logical grouping of contiguous networks and routers. All
routers in the same area have the same topology table, but they don’t know about routers in the other areas.
The main benefits of creating areas is that the size of the topology and the routing table on a router is
reduced, less time is required to run the SPF algorithm and routing updates are also reduced.
Each area in the OSPF network has to connect to the backbone area (area 0). All router inside an area must
have the same area ID to become OSPF neighbors. A router that has interfaces in more than one area (area 0
and area 1, for example) is called Area Border Router (ABR). A router that connects an OSPF network to
other routing domains (EIGRP network, for example) is called Autonomous System Border Router
(ASBR).
NOTE
In OSPF, manual route summarization is possible only on ABRs and ASBRs.
To better understand the concept of areas, consider the following example.
All routers are running OSPF. Routers R1 and R2 are inside the backbone area (area 0). Router R3 is an
ABR, because it has interfaces in two areas, namely area 0 and area 1. Router R4 and R5 are inside area
Router R6 is an ASBR, because it connects OSFP network to another routing domain (an EIGRP domain in
this case). If the R1’s directly connected subnet fails, router R1 sends the routing update only to R2 and R3,
because all routing updates all localized inside the area.
LSA, LSU and LSR
The LSAs (Link-State Advertisements) are used by OSPF routers to exchange topology information. Each
LSA contains routing and toplogy information to describe a part of an OSPF network. When two neighbors
decide to exchange routes, they send each other a list of all LSAs in their respective topology database. Each
router then checks its topology database and sends a Link State Request (LSR) message requesting all LSAs
not found in its topology table. Other router responds with the Link State Update (LSU) that contains all
LSAs requested by the other neighbor.
After configuring OSPF on both routers, routers exchange LSAs to describe their respective topology
database. Router R1 sends an LSA header for its directly connected network 10.0.1.0/24. Router R2 check
its topology database and determines that it doesn’t have information about that network. Router R2 then
sends Link State Request message requesting further information about that network. Router R1 responds
with Link State Update which contains information about subnet 10.0.1.0/24 (next hop address, cost…).
Router 0:
Router>enable
Router#configter
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#int serial 0/0/0
Router(config-if)#ip address 10.1.1.2 255.255.255.252
Router(config-if)#no shutdown
Router(config-if)#exit
Router(config)#int serial 0/0/1
Router(config-if)#ip address 10.2.2.1 255.255.255.252
Router(config-if)#no shutdown
Router(config-if)#clock rate 64000
Router(config-if)#exit
Router(config)#router ospf 1
Router(config-router)#network 10.1.1.0 0.0.0.3 area 0
Router(config-router)#network 10.2.2.0 0.0.0.3 area 0
Router(config-router)#exit
Router 1:
Router>enable
Router#config terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#intgiga 0/1
Router(config-if)#ip address 192.168.1.2 255.255.255.0
Router(config-if)#no shutdown
Router(config-if)#exit
Router(config)#inter serial 0/0/0
Router(config-if)#ip address 10.1.1.1 255.255.255.252
Router(config-if)#no shutdown
Router(config-if)#clock rate
Router(config-if)#clock rate 64000
Router(config-if)#exit
Router(config)#router ospf 1
Router(config-router)#network 192.168.1.0 0.0.0.255 area 1
Router(config-router)#network 10.1.1.0 0.0.0.3 area 0
Router(config-router)#exit
Router 2:
Router>
Router>enable
Router#configter
Router#config terminal
Enter configuration commands, one per line.
Router(config)#interface serial 0/0/1
Router(config-if)#ip address 10.2.2.2 255.255.255.252
Router(config-if)#no shutdown
Router(config-if)#exit
Router(config)#interface gigabitEthernet 0/1
Router(config-if)#ip address 172.16.1.33 255.255.255.224
Router(config-if)#no shutdown
Router(config-if)#exit
Router(config)#router ospf 1
Router(config-router)#network 172.16.1.32 0.0.0.31 area 2
Router(config-router)#network 10.2.2.0 0.0.0.3 area 0
Router(config-router)#exit
Router 3:
Router>enable
Router#configter
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#interface gigabitEthernet 0/0
Router(config-if)#ip address 192.168.2.2 255.255.255.0
Router(config-if)#no shutdown
Router(config-if)#exit
Router(config)#interface gigabitEthernet 0/1
Router(config-if)#ip address 192.168.1.1 255.255.255.0
Router(config-if)#no shutdown
Router(config)#router ospf 1
Router(config-router)#network 192.168.2.0 0.0.0.255 area 1
Router(config-router)#network 192.168.1.0 0.0.0.255 area 1
Router(config-router)#network 192.168.3.0 0.0.0.255 area 1
Router 4:
Ping Results:
Router>enable
Router#configter Router 0:
Router(config)#interface gigabitEthernet 0/0
Router(config-if)#ip address 172.16.1.65 255.255.255.224
Router(config-if)#no shutdown
Router(config-if)#exit
Router(config)#interface giga 0/1
Router(config-if)#ip address 172.16.1.34 255.255.255.224
Router(config-if)#no shutdown
Router(config-if)#exit
Router(config)#router ospf 1 Router 6:
Router(config-router)#network 172.16.1.64 0.0.0.31 area 2
Router(config-router)#network 172.16.1.32 0.0.0.31 area 2
Router 5:
Router>enable
Router#config terminal
Enter configuration commands, one per
Router(config)#intgigabitEthernet 0/0
Router(config-if)#ip address 192.168.2.1 255.255.255.0
Router(config-if)#no shutdown
Router(config-if)#exit
Router(config)#interface loopback 0
Router(config-if)#ip address 192.168.4.1 255.255.255.0
Router(config-if)#exit
Router(config)#router ospf 1
Router(config-router)#network 192.168.2.0 0.0.0.255 area 1
Router(config-router)#network 192.168.4.0 0.0.0.255 area 1
Router(config-router)#exit
Router 6:
Router#config terminal
Router(config)#intgiga 0/0
Router(config-if)#ip address 172.16.1.67 255.255.255.224
Router(config-if)#no shutdown
Router(config-if)#exit
Router(config)#interface loopback 0
Router(config-if)#ip address 172.16.1.97 255.255.255.224
Router(config-if)#no shutdown
Router(config-if)#exit
Router(config)#router ospf 1
Router(config-router)#network 172.16.1.64 0.0.0.31 area 2
Router(config-router)#network 172.16.1.9 0.0.0.31 area 2
Router(config-router)#network 172.16.1.96 0.0.0.31 area 2
Router(config-router)#exit
Lab #11
Enhanced Interior gateway Routing Protocol
EIGRP (Enhanced Interior Gateway Routing Protocol)is an advanced distance vector routing protocol.
This protocol is an evolution of an earlier Cisco protocol called IGRP, which is now considered obsolete.
EIGRP supports classless routing and VLSM, route summarization, incremental updates, load balacing and
many other useful features. It is a Cisco propriatery protocol, so all routers in a network that is running
EIGRP must be Cisco routers.
Routers running EIGRP must become neighbors before exchanging routing information. To dynamically
discover neighbors, EIGRP routers use the multicast address of 224.0.0.10. Each EIGRP router stores
routing and topology information in three tables:
Administrative distance of EIGRP is 90, which is less than both the administrative distance of RIP and the
administrative distance of OSPF, so EIGRP routes will be preferred over these routes. EIGRP uses Reliable
Transport Protocol (RTP) for sending messages.
EIGRP calculates its metric by using bandwidth, delay, reliability and load. By default, only bandwidth and
delay are used when calulating metric, while reliability and load are set to zero.
EIGPR uses the concept of autonomous systems. An autonomous system is a set of EIGRP enabled routers
that should become EIGRP neighbors. Each router inside an autonomous system must have the same
autonomous system number configured, otherwise routers will not become neighbors.
EIGRP Neighbors
EIGRP must establish neighbor relationships with other EIGRP neighboring routers before exchanging
routing information. To establish a neighbor relationships, routers send hello packets every couple of
seconds. Hello packets are sent to the multicast address of 224.0.0.10.
NOTE
On LAN interfaces hellos are sent every 5 seconds. On WAN interfaces every 60 seconds.
The following fields in a hello packet must be the identical in order for routers to become neighbors:
Routers send hello packets every couple of seconds to ensure that the neighbor relationship is still active. By
default, routers considers the neighbor to be down after a hold-down timer has expired. Hold-down timer is,
by default, three times the hello interval. On LAN network the hold-down timer is 15 seconds.
Feasible distance (FD) – the metric of the best route to reach a network. That route will be listed in
the routing table.
Reported distance (RD) – the metric advertised by a neighboring router for a specific route. It other
words, it is the metric of the route used by the neighboring router to reach the network.
To better understand the concept, consider the following example.
EIGRP has been configured on R1 and R2. R2 is directly connected to the subnet 10.0.1.0/24 and advertises
that subnet into EIGRP. Let’s say that R2’s metric to reach that subnet is 28160. When the subnet is
advertised to R1, R2 informs R1 that its metric to reach 10.0.1.0/24 is 10. From the R1’s perspective that
metric is considered to be the reported distance for that route. R1 receives the update and adds the metric
to the neighbor to the reported distance. That metric is called the feasible distance and is stored in R1’s
routing table (30720 in our case).
The feasible and reported distance are displayed in R1’s EIGRP topology table:
Another two terms that appear often in the EIGRP world are successor and feasible successor. A successor
is the route with the best metric to reach a destination. That route is stored in the routing table. A feasible
successor is a backup path to reach that same destination that can be used immediately if the successor route
fails. These backup routes are stored in the topology table.
the neighbor’s advertised distance (AD) for the route must be less than the successor’s feasible
distance (FD).
EIGRP topology table
EIGRP toplogy table contains all learned routes to a destination. The table holds all routes received from a
neighbor, successors and feasible successors for every route, and interfaces on which updates were received.
The table also holds all locally connected subnets included in an EIGRP process.
Best routes (the successors) from the topology table are stored in the routing table. Feasible successors are
only stored in the topology table and can be used immediately if the primary route fails.
Configuring EIGRP 1
EIGRP configuration closely resembles RIP configuration. Only two steps are required:
The network depicted above consists of only two routers. Each router has a directly connected subnet that
needs to be advertised through EIGRP. The following figure show the EIGRP configuration on R1 and R2:
You can verify that routers have become neighbors by using the show ip eigrp neighbors command on
either router:
The command above lists all EIGRP neighbors. The address field lists the neighboring router RID (router
ID). The interface field shows on which local interface the neighbor relationship has been formed.
You can verify that routes are indeed being exchanged by using the show ip route command on both routers:
R1:
R2:
NOTE
The D character at the beginning of a line in a routing table indicates that the route has been learned via
EIGRP.
Configuring EIGRP 2
By default, the network command uses a classful network as the parameter. All interfaces inside that classful
network will participate in the EIGRP process.To enable EIGRP only on specific interfaces, a wildcard
mask can be used. The syntax of the command is:
By using the command show ip protocols, you can verify that only the network 10.0.0.0/24 is included in
EIGRP:
TASK:
Router 0:
Router>enable
Router#config terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#interface fastEthernet 0/1
Router(config-if)#no shutdown
Router(config-if)#exit
Router#ping 192.168.1.254
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.254, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 0/6/33 ms
Router#config ter
Router#config terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#interface fast
Router(config)#interface fastEthernet 0/1
Router(config-if)#no shutdown
Router(config-if)#exit
Router(config)#exit
Router 1:
Router>enable
Router#config ter
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#interface serial 0/0/0
Router(config-if)#ip address 192.168.1.246 255.255.255.252
Router(config-if)#no shutdown
Router(config-if)#exit
Router(config)#interface serial 0/0/1
Router(config-if)#ip address 192.168.1.249 255.255.255.252
Router(config-if)#no shutdown
Router(config-if)#exit
Router(config)#router eigrp 1
Router(config-router)#network 192.168.1.244 0.0.0.3
Router(config-router)#network 192.168.1.248 0.0.0.3
Router(config-router)#exit
Router 2:
Router>enable
Router#config terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#interface serial 0/0/1
Router(config-if)#ip address 192.168.1.250 255.255.255.252
Router(config-if)#no shutdown
Router(config)#inter serial 0/0/0
Router(config-if)#ip address 192.168.1.253 255.255.252.252
Bad mask 0xFFFFFCFC for address 192.168.1.253
Router(config-if)#ip address 192.168.1.253 255.255.255.252
Router(config-if)#no shutdown
Router(config-if)#exit
Router(config)#router eigrp 1
Router(config-router)#network 192.168.1.248 0.0.0.3
Router(config-router)#network 192.168.1.252 0.0.0.3
Router(config-router)#exit
Router(config)#do wr
Building configuration...
[OK]
Router 3:
Router>enable
Router#config ter
Router(config)#interface fastEthernet 0/0
Router(config-if)#ip address 192.168.1.2 255.255.255.252
Router(config-if)#no shutdown
Router(config-if)#exit
Router(config)#interface fastEthernet 0/1
Router(config-if)#ip address 192.168.1.5 255.255.255.252
Router(config-if)#no shutdown
Router(config-if)#exit
Router(config)#router eigrp 1
Router(config-router)#network 192.168.1.0 0.0.0.3
Router(config-router)#network 192.168.1.4 0.0.0.3
Router(config-router)#exit Ping Results:
Router(config)#do wr Router 5:
Building configuration... Router#ping 10.0.0.2
[OK] Router#ping 10.0.0.1
Router 4:
Router>enable Type escape sequence to abort.
Router#config terminal Sending 5, 100-byte ICMP Echos to 10.0.0.1,
Enter configuration commands, one per line. End with CNTL/Z. timeout is 2 seconds:
Router(config)#interface fastEthernet 0/0 .....
Router(config-if)#ip address 192.168.1.9 255.255.255.252 Success rate is 0 percent (0/5)
Router(config-if)#no shutdown
Router(config-if)#exit Router#ping 192.168.1.5
Router(config)#interface fast 0/1
Router(config-if)#ip address 192.168.1.6 255.255.255.252 Type escape sequence to abort.
Router(config-if)#no shutdown Sending 5, 100-byte ICMP Echos to 192.168.1.5,
Router(config)#router eigrp 1 timeout is 2 seconds:
Router(config-router)#network 192.168.1.4 0.0.0.3 !!!!!
Router(config-router)#network 192.168.1.8 0.0.0.3 Success rate is 100 percent (5/5), round-trip
Router(config-router)#exit min/avg/max = 0/0/1 ms
Router(config)#do wr
Building configuration... Router 0:
[OK] Router#ping 192.168.1.254
Router 5: Type escape sequence to abort.
Router>enable Sending 5, 100-byte ICMP Echos to
Router#config terminal 192.168.1.254, timeout is 2 seconds:
Enter configuration commands, one per line. End with CNTL/Z. !!!!!
Router(config)#interface fastEthernet 0/0 Success rate is 100 percent (5/5), round-trip
Router(config-if)#ip address 192.168.1.10 255.255.255.252 min/avg/max = 0/2/9 ms
Router(config-if)#no shutdown Router#ping 192.168.1.9
Router(config-if)#exit Type escape sequence to abort.
Router(config)#interface serial 0/0/0 Sending 5, 100-byte ICMP Echos to 192.168.1.9,
Router(config-if)#ip address 192.168.1.254 255.255.255.252 timeout is 2 seconds:
Router(config-if)#no shutdown !!!!!
Router(config)#interface fast 0/1 Success rate is 100 percent (5/5), round-trip
Router(config-if)#ip address 20.0.0.2 255.0.0.0 min/avg/max = 0/0/2 ms
Router(config-if)#no shutdown
Router(config-if)#exit
Router(config)#router eigrp
Router(config)#router eigrp 1
Router(config-router)#network 192.168.1.8 0.0.0.3
Router(config-router)#network 192.168.1.252 0.0.0.3
Router(config-router)#network 20.0.0.0
Router(config-router)#exit
Router(config)#do wr
Building configuration...
[OK]
Router(config)#exit
Lab 12
Router Distribution
R1:
R1>en
R1#conf ter
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#int fa0/0
R1(config-if)#ip add 172.168.12.1 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#exit
R1(config)#ip add 172.168.13.1 255.255.255.0
R1(config)#int fa0/1
R1(config-if)#ip add 172.168.13.1 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#exit
R1(config)#int loopback 0
R1(config-if)#ip add 10.10.10.1 255.255.255.0
R1(config-if)#exit
R1(config)#router eigrp 100
R1(config-router)#network 172.168.12.0 0.0.0.255
R1(config-router)#network 172.168.13.0 0.0.0.255
R1(config-router)#network 10.10.10.0 0.0.0.255
R1(config-router)#no auto-summary
R1(config-router)#exit
R1(config)#do write
Building configuration...
[OK]
R2:
R2>en
R2#conf ter
Enter configuration commands, one per line. End with CNTL/Z.
R2(config)#int fa0/0
R2(config-if)#ip add 172.168.12.2 255.255.255.0
R2(config-if)#no shutdown
R2(config-if)#
R2(config-if)#exit
R2(config)#int fa0/1
R2(config-if)#ip add 172.168.23.1 255.255.255.0
R2(config-if)#no shutdown
R2(config-if)#exit
R2(config)#router eigrp 100
R2(config-router)#exit
R2(config)#int loopback 0
R2(config-if)#ip add 10.10.20.1 255.255.255.0
R2(config-if)#exit
R2(config)#router eigrp 100
R2(config-router)#network 172.168.12.0 0.0.0.255
R2(config-router)#network 172.168.23.0 0.0.0.255
R2(config-router)#network 10.10.20.0 0.0.0.255
R2(config-router)#exit
R2(config)#do write
Building configuration...
[OK]
R3:
R3>en
R3#conf ter
Enter configuration commands, one per line. End with CNTL/Z.
R3(config)#int fa0/0
R3(config-if)#ip add 172.168.13.2 255.255.255.0
R3(config-if)#no shutdown
R3(config-if)#exit
R3(config)#int fa0/1
R3(config-if)#ip add 172.168.23.2 255.255.255.0
R3(config-if)#no shutdown
R3(config-if)#exit
R3(config)#int loopback 0
R3(config-if)#ip add 10.10.30.1 255.255.255.0
R3(config-if)#exit
R3(config)#int loopback 1
R3(config-if)#ip add 10.10.40.1 255.255.255.0
R3(config-if)#exit
R3(config)#int loopback 2
R3(config-if)#ip add 10.10.50.1 255.255.255.0
R3(config-if)#exit
R3(config)#int se0/0/0
R3(config-if)#clock rate 72000
R3(config-if)#ip add 192.168.2.1 255.255.255.0
R3(config-if)#no shutdown
%LINK-5-CHANGED: Interface Serial0/0/0, changed state to down
R3(config-if)#exit
R3(config)#router eigrp 100
R3(config-router)#network 172.168.13.0 0.0.0.255
R3(config-router)#
%DUAL-5-NBRCHANGE: IP-EIGRP 100: Neighbor 172.168.13.1 (FastEthernet0/0) is up: new adjacency
R3(config-router)#network 172.168.23.0 0.0.0.255
R3(config-router)#
%DUAL-5-NBRCHANGE: IP-EIGRP 100: Neighbor 172.168.23.1 (FastEthernet0/1) is up: new adjacency
R3(config-router)#network 10.10.30.0 0.0.0.255
R3(config-router)#network 10.10.40.0 0.0.0.255
R3(config-router)#network 10.10.50.0 0.0.0.255
R3(config-router)#no auto-summary
R3(config)#router ospf 1
R3(config-router)#router-id 3.3.3.3
R3(config-router)#network 192.168.2.0 0.0.0.255 area 0
R3(config-router)#exit
R3(config)#router eigrp 100
R3(config-router)#redistribute ospf 1 metric 1544 20000 255 1 1500
R3(config-router)#
R3(config-router)#exit
R3(config)#router ospf 1
R3(config-router)#redistribute eigrp 100 subnets
R3(config-router)#exit
R3(config)#do write
Building configuration...
[OK]
R4:
R4>en
R4#conf ter
Enter configuration commands, one per line. End with CNTL/Z.
R4(config)#int se0/0/0
R4(config-if)#ip add 192.168.2.2 255.255.255.0
R4(config-if)#no shutdown
R4(config-if)#int loopback 0
R4(config-if)#ip add 192.168.100.1 255.255.255.0
R4(config-if)#exit
R4(config)#int loopback 1
R4(config-if)#ip add 192.168.200.1 255.255.255.0
R4(config-if)#exit
R4(config)#int loopback 2
R4(config-if)#ip add 4.4.4.4 255.255.255.255
R4(config-if)#exit
R4(config)#router ospf 1
R4(config-router)#router-id 4.4.4.4
R4(config-router)#network 192.168.2.0 0.0.0.255 area0
R4(config-router)#network 192.168.2.0 0.0.0.255 area 0
R4(config-router)#network 192.168.100.0 0.0.0.255 area 0
R4(config-router)#network 192.168.200.0 0.0.0.255 area 0
R4(config-router)#exit
R4(config)#exit
Output