Tuesday, April 23, 2024

Cisco 112 - Trick for searching output: BEGIN

I miss piping output to 'less'

Ex)

show running-config | less

^ Does not work

My co-worker gave me this tip:

show running-config | begin ASDF

Shows the output from the running-config but starts ("begins") it at search string ASDF

Looks like it might accept regular expressions, too.  So:

show running-config | begin Gi2\/0\/3

Would begin output at Gi2/0/3



Friday, April 19, 2024

Cisco 111 - Dynamic Routes and Floating Static Routes

Administrative Distance costs

Administrative Distance <-- Route protocol/type
0 <-- Directly connected
1 <-- Static
20 <-- External BGP (eBGP)
90 <--  EIGRP
100 <-- IGRP
110 <-- OSPF
115 <-- IS-IS
120 <-- RIP
170 <-- EIGRP (external)
200 <-- Internal BGP (iBGP)
255 <-- Unusable route

Floating Static Routes

This is useful to configure a backup route that should not be used unless the normal path goes down.

#show ip route
^
Displays existing routes

(config)#ip route <network> <subnet> <ip of alternate next hop> <metric higher than usual path>
(config)#ip route 10.0.2.0 255.255.255.0 203.0.113.1 111

#show ip route
^You won't see the new route because its administrative cost is higher than the better path

Here's a way:
#show running-config | incl route

[These are my notes from Jeremy's excellent CCNA course which can be viewed here.]

Tuesday, April 16, 2024

Cisco 110 - EtherChannel

Conceptually, EtherChannel combines (aggregates) multiple linked ports into a single aggregate connection.

#show etherchannel load-balance
^Displays current load balancing method

#conf t
(config)#port-channel load-balance <mode>
(config)#port-channel load-balance src-dst-mac
(conifg)#show etherchannel load-balance
^
Change load balancing method to load balance based on source and destination IP address


Modes:
dst-ip    Destination IP address
dst-mac    Destination MAC address
src-dst-ip    Source & destination IP address
src-dst-mac    Source & destination MAC address
src-ip    Source IP address
src-mac    Source MAC address

Methods to create an EtherChannel:
1) Static = Manual config
    Don't do this because you want the switch to automatically remove a link when it goes down
2) Dynamic = Automatic
    A) PAgP (Port Aggregation Protocol) = Cisco proprietary
    B) LACP (Link Aggregation Control Protocol) = IEEE standard and preferred

(config)#interface range g0/0 - 3
(config-if-range)#channel-group 1 mode desirable
modes:
active = Enable LACP unconditionally
passive = Enable LACP only if a LACP device is detected
auto = Enable PAgP only if a PAgP device is detected
desirable = Enable PAgP unconditionally
on = Enable etherchannel only

For PAgP:
auto + auto = No EtherChannel
desirable + auto = EtherChannel
desirable + desirable = EtherChannel

For LACP:
passive + passive = No EtherChannel
active + passive = EtherChannel
active + active = EtherChannel

To config the aggregate etherchannel as a VLAN trunk, do this on both switches:
(config)#interface port-channel 1
(config-if)#switchport trunk encapsulation dot1q
(config-if)#switchport mode trunk
(config-if)#do show interfaces trunk

#show etherchannel summary
^
Displays port aggregates, protocol, and which ports are being used in each

#show etherchannel port-channel
^
Displays more details including the channel group mode

Layer 3 EtherChannel
(config)#int range g0/0 - 3
(conifg-if-range)#no switchport
(conifg-if-range)#channel group 1 mode active
(config-if-range)#int po1
(config-if)#ip address 10.0.0.1 255.255.255.252


[These are my notes from Jeremy's excellent CCNA course which can be viewed here.]

Saturday, April 13, 2024

Cisco 109 - Rapid Spanning Tree Protocol

SW3(config)#spanning-tree mode ?
mst    - Multiple Spanning Tree mode
pvst    - Per-Vlan Spanning Tree mode (classic mode)
rapid-pvst    - Rapid Per Vlan Spanning Tree mode (new & improved)

SW3(config)#spanning-tree mode rapid-pvst
^This is the default and we probably won't need to execute this.

SW1(config-if)#spanning-tree portfast
^
This command will tell a port it is connected to a PC or end host, not a switch or a hub.  Because there is no risk of creating a loop, they can move straight to the forwarding state without the negotiation process.  The port is the "edge" of the network, so they are called "edge ports".  They function like a classic STP port with PortFast enabled.

SW4(config-if)#spanning-tree link-type point-to-point
^This command tells the port it is connected to a switch

Costs:

Speed - STP Cost - RSTP Cost

10 Mbps - 100 - 2,000,000
100 Mbps - 19 - 200,000
1 Gbps - 4 - 20,000
10 Gbps - 2 - 2,000
100 Gbps - X - 200
1 Tbps - X - 20



[These are my notes from Jeremy's excellent CCNA course which can be viewed here.]

Friday, April 12, 2024

Cisco 108 - Spanning Tree Protocol

This is the feature that prevents infinite layer 2 loops among redundant links leading to broadcast storms.

SW3#show spanning-tree
VLAN0001


^Show who the root bridge is, this switch/bridge's priority, root status, role (designated, non-designated), and port cost for each interface.


SW3#show spanning-tree vlan 1
^Filter the output to only show vlan 1

SW3#show spanning-tree detail
Reveal
more details

Shorter overall view but displays number of ports in various states:
SW3#show spanning-tree summary
NAME    Blocking    Listening    Learning    Forwarding    STP Active
VLAN0001    0        0            0            4            4

Portfast is a feature that lets a a switch interface skip the listening/learning stages and go straight to forwarding state.  The idea here is that the interface is connected to a PC, not a switch.  If it isn't connected to a switch, there is no danger of a layer 2 infinite loop.

[Seems risky]


SW1(config-if)#spanning-tree portfast
^Enables portfast

SW1(config)#spanning-tree portfast default
^Enables portfast on all access ports by default

BPDU Guard makes this less risky.  If an interface enabled with BPDU guard receives a BPDU from another switch, the interface will be shut down to prevent a loop from forming:

SW1(config)#int g0/2
SW1(config-if)#spanning-tree bpduguard enable
^Turns on BPDU guard for a single interface

SW1(config)#spanning-tree portfast bpduguard default
^Turns on BPDU guard by default

SW1(config)#spanning-tree mode ?
^
Configures which spanning-tree mode the switch uses:
mst     Multiple spanning tree mode
pvst     Per-Vlan spanning tree mode (Classic with Cisco's per Vlan addition)
rapid-pvst     Per-vlan rapid spanning tree mode (Modern and improved per-Vlan spanning tree mode)

Rig a specific switch to act as the root bridge for vlan 1:

SW3(config)#spanning-tree vlan 1 root primary
^This command figures out the next lower priority (4096 less) for you so you don't have to calculate it.

SW2(config)#spanning-tree vlan 1 root secondary
^
Rig up a specific switch to act as a secondary.

Spanning Tree Costs:
STP - Cost    
10 Mbps - 100
100 Mbps - 19
1 Gbps - 4
10 Gbps - 2



[These are my notes from Jeremy's excellent CCNA course which can be viewed here.]


Sunday, April 7, 2024

Cisco 107 - Inter-VLAN Routing via SVI (Switch Virtual Interface)

Jeremy introduces the concept of an "SVI" = Switch Virtual Interface in this video.  This is useful on a Layer 3 (Multilayer) Switch -- a switch that can also do layer 3 work (incluing routing).

First Jeremy removes VLAN config from router R1:

Remove the sub-interfaces:
R1(config)#no interface g0/0.10
R1(config)#no interface g0/0.20
R1(config)#no interface g0/0.30

R1(config)#default interface g0/0
^Resets the interface to its defaults

R1(config)#do show ip interface brief
^
View the config of R1 interfaces

R1(config)#interface g0/0
R1(config-if)#ip address 192.168.1.194 255.255.255.252
^Sets an IP address on R1's g0/0 interface

---

Now Jeremy reconfigures switch 2 (SW2) as a multi-layer switch and configures it to do VLAN routing.

SW2(config)#default interface g0/1
^Reset interface g0/1 to defaults

SW2(config)#ip routing
^Enables layer 3 routing on the multilayer switch

SW2(config)#interface g0/1
SW2(config-if)#no switchport
^These two commands change int g0/1 from a layer 2 switched port to a layer 3 routed port.

SW2(config-if)#ip address 192.168.1.193 255.255.255.252
^Since the interface is now a routed port, it needs a layer 3 IP address

SW2(config-if)#exit
SW2(config)#ip route 0.0.0.0 0.0.0.0 192.168.1.194
^
These two commands tell SW2 to use R1 as its default route.
The IP address 192.168.1.194 is SW2's "next hop" and that IP address matches the one assigned to R1's connected interface up above

SW2(config)#do show ip route
^V
iews the route config on SW2

We can also see how an interface is configured to route with the command below.  Instead of showing a VLAN ID, the VLAN column will show "routed":

SW2#show interfaces status

Now we need to configure the SVIs (switch virtual interfaces) on SW2.
Create 3 SVIs and assign an IP address to each.  These IP addresses act as the "default gateways" to the PCs in the corresponding VLANs:

SW2(config)#interface vlan10
SW2(config-if)#ip address 192.168.1.62 255.255.255.192
SW2(config-if)#no shutdown
^This creates an SVI called "vlan10"
SVIs are shut down by default, so we have to turn them on

SW2(config-if)#interface vlan20
SW2(config-if)#ip address 192.168.1.126 255.255.255.192
SW2(config-if)#no shutdown
SW2(config-if)#interface vlan30
SW2(config-if)#ip address 192.168.1.190 255.255.255.192
SW2(config-if)#no shutdown

Recall that access or trunk ports on SW2 were already assigned to VLANs 10, 20, and 30.  So the switch has already created VLANs 10, 20, and 30.

 

[These are my notes from Jeremy's excellent CCNA course which can be viewed here.]


Cisco 106 - Configure native VLAN on a router

Two methods to configure native VLAN on a router:

1)Set the VLAN ID on a sububinterface:
(config)#int g0/0.10
(config-subif)#encapsulation dot1q 10 native

2)Config the IP address for the native VLAN on the router's physical interface. The encapsulation dot1q command is not necessary with this option.
First remove the subinterface:
(config)#no interface g0/0.10
Then configure the IP address of the physical interface:
(config)#interface g0/0
(config-if)#ip address 192.168.1.62 255.255.255.192

Here is the running config of a router with the physical interface using the native VLAN and two sub-interfaces configured for other VLANs:

!
interface GigEthernet0/0
 ip address 192.168.1.62 255.255.255.192
!
interface GigEthernet0/0.20
 encapsulation dot1Q 20
 ip address 192.168.1.126 255.255.255.192
!
interface GigEthernet0/0.30
 encapsulation dot1Q 30
 ip address 192.168.1.190 255.255.255.192
!


[These are my notes from Jeremy's excellent CCNA course which can be viewed here.]