Friday, April 7, 2017

Cisco Router

Introduction to Router
Router is a device which route the packet across different networks.
Router works on layer3 (network layer).
Router performs four functions, which are packet filtering, packet switching, path selection and internetwork communication.
IOS: internetwork operating system. IOS is an operating system which runs CISCO routers and switches. It is CISCO proprietary IOS.
RAM: Current configurations are store in ram.
NVRAM: Startup configurations are store in nvram. (non volatile, non changeable).
FLASH: IOS are store in flash.
ROM: Minuring of IOS are store in rom.
Router boot process:
Step1: Post (power on self test).
Step2: Boot up/operating system or loading IOS from flash.
Step3: Stop for some time (checking nvram).
Step4: Setup mode/dialogue/auto configuration mode, starts yes no questions to configure.
Router configuration:

Console port + computer com port (communication, open putty software then select serial and open.
Router prompt modes:
Router>: user mode. Here we can’t give any commands only enable. Enable (from this command it come to privilege mode.
Router#: privilege mode. Here we check network connectivity and show command. Configure terminal (from this command it come to global configuration mode.
Router(config)#: global mode. Here we can give any configuration commands. To go pervious, CTRL+Z, exit or end.
  Password: 1. Plain password. 2. Secret password.
  • Plain password: stores password in plain text form
        Ex: Router(config)#enable password ccna
  • Secret password: store password in encrypted form
        Ex: Router(config)#enable secret ccna
To delete password: Router(config)#no enable secret or password.
Show commands:
Router# show running-configuration (shows current configurations).
Router# show startup configuration (shows nvram configurations).
Router# show clock (shows current time and date).
Router# show history (shows given command list).
Router# show version (shows version of IOS).
Router# show flash (shows where IOS are stored).
Router# show ip interface brief (shows given ip addresses to interface).
Router# show controllers (shows DTE and DCE sides clock rate).
Different lines use to configure Router:
Console line 0 = 1. Auxiary line (aux) 0 = 1. Virtual terminal (vty) 0 4 = 5.
  • Console line:
Router(config)# line console 0
Router(config-line)# password corvit
Router(config-line)# exec-timeout 10
Router(config)# login
  • Auxiliary line:

Router(config)# line aux 0
Router(config-line)# password ccna
Router(config)# login
Virtual terminal line (vty):
Router(config)# line vty 0 4
Router(config-line)# password ccnp
Router(config)# login
Note: all these passwords stores in plain text form so by service password-encryption command it will encrypt all running and future passwords. Ex: Router(config)# service password-encryption.
Routing
Routing is a process to define path toward destination network.
Router is responsible for routing. Routing process work on layer3 (network layer).
Routing table: In routing table network ID of networks are stores.
Types of routing: Static routing, Default routing, Dynamic routing.
 Static routing and default routing done by administrator.
Dynamic routing uses different routing protocols. Ex: RIP, IGRP, EIGRP, ISIS, OSPF, BGP, etc.
Static routing: in static routing administrator itself define the path toward destination network
Router1(config)# ip route 192.168.0.0 255.255.255.0 10.0.0.2
Router2(config)# ip route 192.168.1.0 255.255.255.0 10.0.0.1

Default routing: in default routing two routers are used, stub router and transit router.

  • Stub router: that router in which the next hope address is same for all destination networks is called stub router
  • Transit router: that router in which the next hope address is different for destination network is called transit router
Stub router1(config)# ip route 0.0.0.0 0.0.0.0 10.0.0.2
Transit router(config)# ip route 192.168.0.0 255.255.255.0 10.0.0.1
Transit router(config)# ip route 192.168.10.0 255.255.255.0 20.0.0.2
Stub router2(config)# ip route 0.0.0.0 0.0.0.0 20.0.0.1

Dynamic routing: that routing protocol which works on dynamic routing protocol, dynamic routing protocols are those which itself finds path its destination networks.
Three Categories of dynamic routing protocols:
  • Distance vector routing protocol (DVRP). Use: RIP, IGRP
  • Link state routing protocol. Use: OSPF
  • Hybrid routing protocol. Use: EIGRP
Distance vector routing protocol (DVRP):
DVRP exchange their routing table periodically to their neighbors.
DVRP broadcast the routing table, DVRP share their routing table on 255.255.255.255.
RIP (routing information protocol): RIP works on DVRP, global protocol. Calculate cost or metric by calculating no of hops.
Class full routing protocol so doesn’t support of VLSM. Maximum hops 15. RIP configures different routers. Ex: CISCO and Jenifer.
Router1(config)# router rip
Router1(config)# network 192.168.0.0
Router1(config)# network 10.0.0.0
Router2(config)# router rip
Router2(config)# network 192.168.10.0
Router2(config)# network 10.0.0.0
Router# show ip rip database or show ip route or show ip protocol.

Router# debug ip rip  , it is use for back command showing.
Rip timers:
  • Update time 30 seconds
  • Invalid time 180 seconds
  • Hold-down time 180 seconds
  • Flushed time 240 seconds

Comparison RIPv1 and RIPv2:
RIPv1:                                                                                 RIPv2:
Works on DVRP.                                                          Works on DVRP.
Global protocol.                                                                     =
Calculate cost or metric                                                       =
By gudging number of hops.                                               =
Maximum hop 15.                                                                 =
Broadcast on 255.255.255.255.                      Multicast on 224.0.0.9.
Classfull routing protocol.                                Classless routing protocol.
No support of discontigeous                           Support discontiogeous
Network.                                                              Network.

Show interface serial 0/0:
  1. Serial 0/0 is up, line protocol is down. (Means clock rate is not obtained)
  2. Serial 0/0 is down, line protocol is down. (Means remote interface is down)
  3. Serial 0/0 is administratively down, line protocol is down. (Means no shutdown command is not obtained)
  4. Serial 0/0 is up, line protocol is up. (Means ok)

IGRP (interior gateway routing protocol):
IGRP is a CISCO proprietary protocol, IGRP works on DVRP.
IGRP hop no 90 by default and maximum is 255.
IGRP calculate cost or metric by judging load, bandwidth, delay and reliability use only bandwidth and delay.
IGRP is classfull routing protocol so doesn’t support VLSM.
IGRP update time is 90 seconds.
IGP: Those routing protocol which works on same autonomous number is called IGP. Protocol: (IGRP, EIGRP, OSPF, and IS-IS).
EGP (exterior gateway protocol): Those routing protocol which works on different autonomous number is called EGP. Protocol: (BGP).
Bandwidth: The maximum transmission speed of a media is called bandwidth.
Load: The traffic in line is called load.
Delay: The time taken to traverse from path is called delay.
Reliability: Reliability means in which failure chances is less.
K1=1 (bandwidth). K3=1 (delay).
EIGRP (enhanced interior gateway routing protocol):
EIGRP is CISCO proprietary protocol, which works on hybrid routing protocol means both DVRP and Link State features.
It advertises change immediately (feature of link state).
It sends periodic update (feature of DVRP).
EIGRP makes adjacency with neighbor’s router by hello packet.
Hello packet is share by 224.0.0.10
EIGRP calculate cost or metric by load, bandwidth, delay, and reliability.
EIGRP create three tables. Ex: neighbor table, topology table and routing table.
EIGRP works on same autonomous number, EIGRP is classless routing protocol so support of VLSM.
EIGRP use algorithm called “DUAL” (diffusing update algorithm) for creating topology table.
EIGRP maximum hop 255, EIGRP also called PDM (protocol dependent module) which allow using multiple routed protocols.
Router ID: is an id which is use for router identification in EIGRP, OSPF, and BGP.
Routed protocol: IP, IPX, and Apple talk.
Routing protocol: RIP, IGRP, EIGRP, OSPF, IS-IS, BGP, etc.
Router1(config)# router eigrp 10
Router1(config-router)# network 10.0.0.0
Router1(config-router)# network 200.0.0.0
Router2(config)# router eigrp 10
Router2(config-router)# network 10.0.0.0
Router2(config-router)# network 192.168.1.0
Router(config-router)# eigrp router-id 4.4.4.4
Router# show ip eigrp interfaces , show ip eigrp neighbors , show ip eigrp topology , show ip eigrp traffic
OSPF (open shortest path first protocol):
OSPF is a global protocol, which works on link state routing protocol.
Advertise link state to their neighbor router. Advertise change immediately. Makes adjacency with neighbor router by sharing hello packet. Hello packet are share  by ip 224.0.0.5.
Contain information about router-id, autonomous no.
OSPF calculate cost or metric by 108 /bandwidth.
In OSPF “DISJKSTRA” algorithm is use, work on same autonomous number. Maximum hops unlimited.
Routers are divided into different logical area, area 0 is called the backbone of router and all the areas must be connected to area 0.
Classless routing protocols, so support of VLSM.
Wild card mask bits are used instead of subnet mask.
Loopback interface: It is a logical interface which is not use for physical connectivity, only for practice purposes.
Also use for router-id, router take loopback address as id.
ABR-Router(config)# router ospf 10
ABR-Router(config-router)# network 192.168.0.0 0.0.0.255 area 10
ABR-Router(config-router)# network 10.0.0.0 0.255.255.255 area 0
BIR-Router(config)# router ospf 10
BIR-Router(config-router)# network 10.0.0.0 0.255.255.255 area 0
BIR-Router(config-router)# network 20.0.0.0 0.255.255.255 area 0
BIR-Router(config-router)# network 192.168.10.0 0.0.0.255 area 0
ABR-Router(config)# router ospf 10
ABR-Router(config-router)# network 20.0.0.0 0.255.255.255 area 0

ABR-Router(config-router)# network 200.0.0.0 0.0.0.255 area 20
DHCP: DHCP stand for dynamic host configuration protocol which is use for assigning IPs to clients and it solve all problems which are in RARP and Bootp so now days DHCP is practically implemented and we can configure router as a DHCP server.
Router(config)# interface f0/0
Router(config-if)# ip address 10.0.0.1 255.0.0.0
Router(config-if)# no shutdown
Router(config)# ip dhcp pool corvit
Router(dhcp-config)# network 10.0.0.0 255.0.0.0
Router(dhcp-config)# default-router 10.0.0.50
Router(dhcp-config)# dns-server 10.0.0.100
Router# show ip dhcp binding
Access control list (ACL):
ACL is a group of statements which defines policies on incoming and outgoing traffic or ACL provide security which are use to filter unwanted traffics in CISCO routers.
Two types of ACL: Standard ACL and Extended ACL or Name ACL.
Traffic in router:
  • Inbound traffic: The traffic entering the device is called inbound traffic
  •  Outbound traffic: The device leaving the device is called outbound traffic

Standard ACL (1-99)(1300-1999): In standard ACL we can define only source host, source network.
Router1(config)# access-list 10 deny 200.0.0.2 0.0.0.0
Router1(config)# access-list 10 permit any
Router1(config)# interface f0/0
Router1(config-if)# ip access-group 10 out
Router1# show access-list or show ip interface or to delete no access-list 10
To block telnet on a machine: first of all we must give password to privilege mode and password to telnet startup mode.
Router(config)# access-list 30 deny 200.0.0.4 0.0.0.0
Router(config)# access-list 30 permit any
Router(config)# line vty 0 4
Router(config)# access-class 30 in
Extended ACL (100-199)(2000-2699): In extended ACL we can define source host, source network, destination network, protocol as well as port.
Router(config)# access-list 120 deny ip 200.0.0.10 0.0.0.0 192.168.0.3 0.0.0.0
Router(config)# access-list 120 permit ip any any
Router(config)# interface f0/0
Router(config-if)# ip access-group 120 out
To block FTP server on a machine:
Router1(config)# access-list 130 deny tcp 200.0.10.2 host 10.0.0.8 eq www
Router1(config)# access-list 130 permit tcp any host 10.0.0.8 eq www or 80
Router1(config)# access-list 130 permit ip any any
Router1(config)# interface f0/0
Router1(config-if)# ip access-group 130 out

Name ACL (standard or extended):
Router(config)# ip access-list stand corvit
Router(config)# deny 200.0.0.3 0.0.0.0
Router(config-stand)# permit any
Router(config)# interface f0/0
Router(config-if)# ip access-group corvit out

NAT (network address translator): NAT is use to translate private IPs into Public IPs. Why we use NAT? To reduce the usage of public IPs and to hide internal IPs.
Basic setting:
Router(config)# interface f0/0
Router(config-if)# ip nat inside
Router(config)# interface serial 0/0
Router(config-if)# ip nat outside
NAT Types: Static NAT, Dynamic NAT, PAT/NAT overload.
Static NAT: in static NAT all private IPs are equal to public IPs. All configuration and translation are done by administrator.
Router(config)# ip nat inside source static 192.168.0.2 200.0.0.3
Router(config)# ip nat inside source static 192.168.0.3 200.0.0.4

Dynamic NAT: in dynamic NAT all private IPs are equal to public IPs. In dynamic NAT all configuration or translations are done automatically.
Router(config)# access-list 10 permit 192.168.1.0 0.0.0.31
Router(config)# ip nat pool corvit 200.0.0.1 200.0.0.15 netmask 255.255.255.224
Router(config)# ip nat inside source list 10 pool corvit overload
Router# show ip nat translations or show ip nat statistics or show run
PAT/NAT overload: PAT stand for port address translation.
In PAT private IPs are greater than public IPs. i.e. DSL
Means you can use one public IP for many private IPs.
In PAT by one IP we can translate 65535 users.
Router(config)# access-list 20 permit 192.168.1.0 0.0.0.31
Router(config)# ip nat pool kabul 200.0.0.1 200.0.0.1 netmask 255.255.255.252
Router(config)# ip nat inside source list 20 pool Kabul overload
IPv6 configuration in RIP: First basic setting on both routers.
Router1(config)# interface f0/0
Router1(config-if)# ipv6 address 2001::0001 /64
Router1(config-if)# no shutdown
Router1(config)# interface s0/0/0
Router1(config-if)# ipv6 address 2002::0001 /64
Router1(config-if)# clock rate 64000
Router1(config-if)# no shutdown basic setting also on router2.
RIP: 2800 series router
Router(config)# ipv6 unicast-routing
Router(config)# interface f0/0
Router(config-if)# ipv6 rip 1 enable
Router1(config)# interface s0/0/0
Router1(config)# ipv6 rip 1 enable also on router2 same as router1.
Note: 1 is process ID and it will be same on both sides.
To delete: no router rip 1 or no ipv6 router rip 1
Configuring EIGRP on IPv6: first basic setting and the below routing.
Router1(config)# ipv6 unicast-routing
Router1(config)# interface f0/0
Router1(config-if)# ipv6 eigrp 10
Router1(config)# interface s0/0/0
Router1(config-if)# ipv6 eigrp 10
Router1(config)# ipv6 router-eigrp 10
Router1(config)# no shutdown (by default EIGRP is down)
Configuring OSPF on IPv6:
Router(config)# ipv6 unicast-routing
Router(config)# ipv6 router ospf 10
Router(config-if)# router-id 1.1.1.1 (router-id will be different)
Router(config)# interface f0/0
Router(config-if)# ipv6 ospf 10 area 0
Router(config)#  interface s0/0/0
Router(config-if)# ipv6 ospf 10 area 0
Administrative distance: AD is a distance of routing protocol by which router select best path toward destination network.
Protocol:                       Administrative distance:                                                 
Directly connected router                                                  0
Static router                                                                       1
EIGRP summary route                                                      5
External BGP                                                                    20
Internal EIGRP                                                                 90
IGRP                                                                                 100
OSPF                                                                                 110

IS-IS                                                                                  115
RIP                                                                                    120
EGP                                                                                   140
ODR                                                                                  160
External EIGRP                                                                 170
Internal BGP                                                                      200
DHCP-learned                                                                    254
Unknown                                                                            255


No comments:

Post a Comment