Showing posts with label CCNA. Show all posts
Showing posts with label CCNA. Show all posts

Friday, April 29, 2016

Why doesn't my RF signal get through?

All of us who have to manage wireless signal, especially when trying to support a 802.11 network, have to overcome the initial challenge of understanding why the signal being emitted doesn't get to its destination like we thought it would. Radio Frequency (RF) signal travels (or "propagates") in waves. Therefore all of the things that cause disrupt waves in other formats, like a water wave or an earthquake shock-wave, will cause disruption in our wireless RF waves.

Here are some of those issues:

Free Path Loss:

In a perfect vacuum, you might think that with nothing to block an RF signal that it could keep moving away from the transmitter forever. Unfortunately, due to the laws of physics, the signal will attenuate (lose strength) as it travels.  In a uniformly circular wave around a transmitter, the wave has a certain amount of energy that is traveling outward in a circle. After a second the circle will be a certain distance away, then after two seconds it will have traveled twice as far, and so on. 

The problem is that the waves are broadening over space as they radiate from the transmission point, and RF waves are 3-dimensional! So it really moving out over a sphere. Imagine the difference between the strength of a an deflated balloon vs one you have stretched to maximum size - it is bigger but weaker now isn't it? RF signals will lose their strength as they are forced to cover a larger surface area.

One quick way estimate free path loss is called the 6dB rule: doubling the distance will decrease amplitude by 6 dB!


Attenuation through Absorption and Loss:

When we think about why signal doesn't just get from point A to point B, we usually think of absorption - something must have gotten in the way of the invisible signal and the energy was absorbed by that something, reducing the amplitude of the signal until eventually it reaches zero, and there is no effective communication. This is just like a wave crashing against a seawall, keeping people on the other side dry.
  • Cubicle Walls : -2 dB
  • Wooden Doors, Glass, Sheetrock, or Drywall : -3 dB
  • Open Metal Rack : -6 dB
  • Elevator and other metal obstacles : -10 dB
  • Brick, Concrete, Concrete Blocks, Foundation Walls : -15 dB

Reflection:

When we look into a smooth polished mirror, or plane of glass, or even water we can see a reflection of ourselves. Why is this? When the wave (light waves in this case) hits a larger smooth surface it may bounce in a new direction. 

With dealing with RF waves some of the initial energy that strikes the surface ("the incident ray") is going to bounce off at an equal angle in the opposite direction ("the reflected ray"). The amount of reflection depends on the smoothness and the material itself. Some of the RF energy will still pass through ("the transmitted ray"). We can expect to see this kind of reflection of our Microwave RF signals when hitting things like a metal door or file cabinet, or outdoors when hitting other buildings or a body of water.

Scattering:

The idea of scattering is similar to that of reflection, but occurring multiple times at a smaller level. When the wavelength is larger than the reflecting surface, rather than smaller we get scattering rather than reflection. Think of a nice smooth wave in the ocean that hits a smaller rock - The wave will have to split around the rock, a tiny bit of the energy is absorbed and the rest of the wave is reflected in different directions around it. Of course, the wave as a whole isn't disrupted, right? But now imagine a ton of rocks lining the shore, and how when the wave hits those rocks the energy is being scattered off of all of those rocks, interfering with each other, and basically mucking up the wave, dissipating some energy and making it ugly. 

Another way to think of Scattering is thinking of a laser pointer.
Light, even laser light, travels in waves - but a laser is a very tight wave that should just travel from point to point in the direction it is intended - you should see the dot on a wall or screen when using a laser pointer. But what if you are in a smoky room? Then the laser light gets scattered among the smoke particles and bounces in all sorts of directions. You can see the laser pointers light from the side as a "beam", but the signal will be weaker when it eventually hits the wall. (Pink Floyd laser light show fans, rejoice!)

In the world of wireless RF, the same thing can happen at a very minute level when encountering smog or a dust storm over longer point-to-point links. In a WLAN environment we could see this effect from the leaves of trees, rocky ground, or even chain link fences. The signal gets ugly, scattered, nonsensical, and can degrade it to a point of complete loss.

Refraction

We know that some signal strength is reflected or scattered and some is absorbed when a wireless RF signal encounters a material. But what the energy that manages not to bounce off or be absorbed by the material - is the transmitted ray still the same? Sort of. It can also be just a little bent (no offense, RF) by the process of Refraction. 

Refraction (changing the angle of the transmitted ray) occurs because of changes in the density of the material through which it is passing. You see this when you observe a straw in a glass filled with liquid. The straw appears to be split because you are seeing the light of the straw without the liquid with one angle, and with the liquid at a refracted angle. 

In a wireless environment Refraction is usually due to changes in pressure, temperature, or water vapor in the air. With that said, in an outdoor setting the small change in angle can have a large effect over a distance, and some types of glass 
The difference between the angle of the transmitted ray and the and the original angle the ray would have taken is called the angle of refraction

Multipath

We have described a lot of ways that signal can be altered from its original transmission beyond the simple free path loss or absorption. It might reflect, scatter, or refract, right? Or even all of the above. Plus some portion of the original energy may transmit unchanged from the source to the destination. 

What happens when some of the original signal AND the refracted signal AND the reflected signal AND the scattered signal all (eventually) get to the receiver? It depends, but most of the time there will be downfade. Downfade is when the signal is degraded because the same message is being heard but out of phase. If you've ever tried to sing with someone who knew the song but was always half a beat late to jump in then you've experienced this problem. It makes for poor karaoke and poor wireless too because the signal is distorted. If two signals arrive far enough out of phase then the uptick of the wave can occur at the same time as the downtick of a reflected wave, causing the signal to be nullified, just like noise cancelling headphones! It is also possible for there to be upfade where the signals arrive at the same time and build each other back up again, like a sweet duet!

Multipath on its own is considered a bad thing, but modern WiFi protocols like 802.11ac use multipath along with multiple antennas to improve WiFi transmissions and signalling!

I know that if I was taking a Cisco CCNA wireless exam, I would want to know all of the above. :)


Monday, April 18, 2016

Majorbacon's Breakdown on Spanning Tree Protocol and Variants Part 1: The Problem

First, the Problem

Spanning Tree Protocol is one answer to a specific problem that occurs at a layer 1 & 2 levels - redundant connections between switches cause problems!

No Redundancy, No Problems


Now we've added a redundant connection enabling multiple paths for switch to switch communication

If a broadcast is sent out it will flood normally, but it will eventually also enter through the "back door" of the original switch that forwarded the broadcast, acting like a "new" message that needs further flooding, causing infinite flooding (remember this is layer 2, there is no time to live on a frame)

Worse yet, the broadcast actually went out both directions at the beginning of the flood, which means we actually have two broadcasts circulating the network infinitely!
The results of the unmanaged switching loop includes:
  • Broadcast storms - no room for valid traffic - packets will keep getting forwarded until the switches run out of memory and start dropping frames.
  • MAC Table Instability - remember that the source MAC address of a packet is used to update the switch's MAC address table - this means that eventually the first switch, the one connected to the broadcasting Server, will eventually believe that the server is attached to one of the other switches, since it will receive a broadcast from them with the Server's MAC address listed at the source. The switch will lose track of its own devices!
  • Redundant Frames - both broadcasts and unicasts may be received multiple times by destination endpoints, bogging down intermediate services like TCP and higher level application services

So now we know the problem... see the Spanning Tree Protocol and Variants Part 2 to start seeing the solution!


Thursday, October 29, 2015

Majorbacon's 6 steps guide to easy IPv4 Subnetting

Subnetting is a process that you just have to practice. Here's what I do so that I can quickly work through subnetting test questions (or real life situations... there's a reason these are on tests you know)

THE PROCESS:

  1. Read the question.  Know what network ID you are starting with and what your GOAL is: Do you need to obtain a certain number of subnets out of your original network or do you need to ensure a certain number of hosts are available in each subnet?
  2. Write your binary table on your paper.  If you can multiply by two, you can do this
  3.  Use one of two magic formulas to determine the number of bits that will be used in the new subnet mask
    • 2n  >= your desired number of subnets, where n is the number of new ones in the new subnet mask.  The rest of the subnet mask will be composed of binary zeros.
    • 2h-2 >= your desired number of hosts, where h is the number of zeros left in the new subnet mask.  The rest of the subnet mask will be composed of binary ones.

  4. Based on this, write out your new subnet mask (in binary, counting ones or zeros as necessary).
  5. In order to figure out the number of hosts you have in each subnet, use 2h-2, where h is the number of zeros in your subnet mask. 
  6. In order to figure out the total number of subnets you have, use 2n, where n is the number of new ones (not total ones) in your subnet mask.
  7. In order to determine your subnet IDs we need to find the block value. Start with your original network ID for the first subnet, but remember it has a new subnet mask. Your next subnet will be one block value away.  How much is your block value?  It’s determined by the “least significant bit”, the last one in the subnet mask.  Look up the column value for this bit in the table because this bit will be the increment from one network to the next, in that same octet!  
    • Or Skip the table and use this trick: 256 minus the last positive octet will also yield the block value of the networks

WORK THE EXAMPLE:


1.    You have a Class C network, 202.5.4.0 that you want to subnet into 6 subnets.
2.    We write down the all-important table:


3.    2n  >= your Goal, therefore 23 = 8 >= 6 desired subnets.


4.    A Class C subnet mask is 255.255.255.0, so if we add 3 ones, it will be 255.255.255.11100000 or 255.255.255.224 - that's 27 binary ones in the subnet mask, so our CIDR notation will be /27. (If you remember that a class C address starts as a CIDR /24 then you could just do /24+3 bits = /27)

5.    We have five zeros in the subnet mask, so 25-2=30 hosts per subnet, and we have added 3 ones to the subnet mask, so 23=8 new subnets


6.    Our increment is based on the least significant bit in the subnet mask, which in binary was 255.255.255.11100000.  If we examine the last octet compared to our table we see that the last one is in the thirty-two column.  (Also, 256-224=32)


That was 6 steps - so we should be done! Let's review:
  • So, our network started as 202.5.4.0/24 (the /24 being CIDR notation for a 24-bit 255.255.255.0 subnet mask). 
  • Now we have a new subnet mask 255.255.255.224, CIDR notation /27
  • Our first subnet ID is the same as the original network ID but with a new subnet mask: 205.5.4.0/27
  • We determined our block value is by 32 in the fourth octet
    • Therefore our second subnet would be: 202.5.4.32/27, 
    • Third: 202.5.4.64/27
    • Fourth: 202.5.4.92/27
    • Fifth: 202.5.4.128/27
    • Sixth: 202.5.4.160/27
    • Seventh: 202.5.4.192/27
    • and finally Eighth: 202.5.4.224/27
  • So there are the 8 subnets that each have 30 hosts per subnet, as expected!

Please note that if you count all of those subnets up, you have 8 of them.  The amount we predicted back in step 3. Great job!

More subnetting examples and practice to come:
Keep practicing - here are some random subnetting question generators:
http://david.clauss.us/Subneting/
http://www.subnettingquestions.com/

Have fun!

Thursday, October 22, 2015

Resetting your Cisco Router Password via ROMMON

How to perform password recovery on your Cisco IOS router

Here's the tools you will need
1) Router/Switch
2) Rollover cable
3) Terminal Emulator Program such as Tera Term or Putty
4) Knowledge of Register values


  1. Connect the rollover cable's RJ-45 interface to your device and the serial or USB interface into to your computer
  2. Picture thanks to: https://es.wikibooks.org/wiki/Planificaci%C3%B3n_y_Administraci%C3%B3n_de_Redes/Tema_6/Texto_complete
  3. Fire up your terminal emulator
  4. Connect to the appropriate COM port (remember the appropriate serial settings)
    • 9600 baud rate
    • No parity
    • 8 data bits
    • 1 stop bit
    • No flow control
  5. Reboot the Router
  6. Send the break signal to the Router - the keystroke to signal break varies by terminal emulator
  7. The break signal drops you into ROMMON mode instead of booting the IOS in this low level mode (kind of like booting to BIOS/CMOS on a desktop) you get different options such as configuring the boot register (like changing the boot order or hardware in BIOS)
  8. To tell the system to boot normally, except without loading the startup configuration type:
    • ROMMON>confreg 0x2142
  9. To reboot type:
    • ROMMON>reset
  10. When the system boots you may be prompted to configure setup using the prompts - if so type:
    • no
  11. You have an un-configured system - log on by typing:
    • Router#enable
  12. Now load your startup configuration by typing:
    • Router#copy start run
    • (DO NOT DO THE OPPOSITE (copy run start) OR YOU WILL LOSE THE STARTUP CONFIG!!!)
    • Yes, I did that once. Thank God for TFTP backups.
  13. Now your configuration has loaded but you're already in, without having to have typed the official password! Sneaky! Now you can set the password to access privileged mode by typing:
    • Router#conf t
    • Router(config)#enable secret <enter your secret here>
  14. Reset the device to boot normally instead of skipping the startup config by typing:
    • Router(config)#config-register 0x2102 
    • Router(config)#end
  15. Backup your current configuration to survive rebooting by typing:
    • Router#copy run start
    • (if you type the opposite you will lose all your hard work and it will revert to the unknown secret)
  16. Reboot the device to prove correct configuration and trigger all interfaces to return to an up / up status by typing
    • Router#Reload
And that's how I get into all those systems where no one knows the password because it was set by a contractor who emailed the password to the guy who quit six months ago!

Hope it helps!

Cisco Spanning Tree Portfast and BPDUGuard

There are two powerful tools available for those of us (the majority I believe) that are still relying on Spanning Tree Protocol (STP) for our switch loop protection. They are Portfast! and BPDUGuard! (Don't the sound impressive with those exclamation points?)

Portfast!

Enabling PortFast on a switchport skips the listening and learning states when a device is plugged in (you know, that annoying wait time with the amber light?). From an STP perspective the port is set to a forwarding state immediately, This works out great for most accessthat are trustworthy to be connected only to a single device such as a server or workstation

Here are a couple of key commands related to basic portfast:

To globally set PortFast on all NON-Trunking ports:
Switch (config)#spanning-tree portfast default

To locally set PortFast on a particular interface:
Switch (config-if)#spanning-tree portfast

BPDUGuard!

PortFast is designed for access ports that do not receive Switch to Switch BPDU packets from STP. It is possible to have non-trunking ports that connect two switches, however, which can then cause spanning tree loops. With BPDUGuard enabled on top of PortFast the receipt of a BPDU packet over a PortFast interface triggers the port to move into an err-disabled state instead of configuring the port in an STP blocking port configuration which would look like this:
Switch#show interfaces gigabitethernet 1/1 status
Port    Name               Status       Vlan       Duplex  Speed Type
Gi1/1                      err-disabled 100          full   1000 1000BaseSX

This security measure then leads a network administrator to either:
a) unplug the switch from this port and move it to a correct port
b) change the port to a trunking port rather than an access port so that STP can function normally

 Here are a couple of key commands related to basic BPDUGuard:

To globally set BPDUGuard on all NON-Trunking ports:
Switch (config)#spanning-tree portfast bpduguard default

To locally set BPDUGuard on a particular interface:
Switch (config-if)#spanning-tree bpduguard enable

To recover from the err-disabled state:
Switch(config-if)#spanning-tree portfast disable

TestTakers!

  1. Note the similarities and differences between the PortFast and BPDUGuard commands
  2. Consider the order in which you would set them (Portfast first!)
  3. Recognize Err-Disabled as a possibly a BPDUGuard issue
Err-Disabled triggers include:
  • BPDU guard violation
  • Duplex mismatch
  • Port channel misconfiguration
  • UniDirectional Link Detection (UDLD) condition
  • Late-collision detection
  • Link-flap detection
  • Security violation
  • Port Aggregation Protocol (PAgP) flap
  • Layer 2 Tunneling Protocol (L2TP) guard
  • DHCP snooping rate-limit
  • Incorrect GBIC / Small Form-Factor Pluggable (SFP) module or cable
  • Address Resolution Protocol (ARP) inspection
  • Inline power
 Hope that keeps it all straight in your head!

Wednesday, October 21, 2015

Understanding Recursive Lookups in Cisco routing tables


First, the term "Recursive"

While recursion can just refer generically to repetition, the term in Information Systems and Technology contexts almost always refers to using a tool to enable the use of the same tool. Think of using a mirror to reflect a mirror (an example of infinite recursion).
Examples: 

1) A DNS server receives a DNS query for which it doesn't know the answer. It performs recursion by sending it's own DNS query to root DNS server to discover the answer for the client.

  • DNS uses DNS to answer DNS.


2) In a Microsoft SQL database server there is a database called Master that is recursively used by SQL to find and reference the high level properties of all the other attached databases that are used by end-users.

  • SQL uses SQL to manage SQL.


Now for understanding Cisco routing recursion:

A Recursive lookup refers to routes for which the router must look up the connected route to a next-hop gateway in order to route the packet to its ultimate destination.

  • The Router uses Routes to 
    • a) find the next router in the route path and 
    • b) to Route to the next Router

This is because in a routing table the gateway for a routed network can be defined as an interface or as an IP address.

Using an interface works great when the router is referring to directly connected routes like this:
Router4#show ip route
Gateway of last resort is not set

     172.16.0.0/30 is subnetted, 1 subnets
C       172.16.100.0 is directly connected, Serial0/0
C    192.168.1.0/24 is directly connected, FastEthernet0/0 

or to point-to-point links in which there is only one possible intended destination:

Router5(config)#ip route 192.168.0.0 255.255.0.0 se 0/0
Router5(config)#end
%SYS-5-CONFIG_I: Configured from console by console
Router5#show ip route

Gateway of last resort is not set

     172.16.0.0/16 is variably subnetted, 2 subnets, 2 masks
C       172.16.1.0/24 is directly connected, FastEthernet0/0
C       172.16.100.0/30 is directly connected, Serial0/0
S    192.168.0.0/16 is directly connected, Serial0/0

However, routes that reference an endpoint on multi-access networks like Ethernet or Frame Relay need a logical destination, since the physical interface could connect to many devices. This is where we see our standard routing entries that indicate an IP address as the gateway value:

Router4(config)#ip route 172.16.1.0 255.255.255.0 172.16.100.1
Router4(config)#end
%SYS-5-CONFIG_I: Configured from console by console
Router4#show ip route

Gateway of last resort is not set

     172.16.0.0/16 is variably subnetted, 2 subnets, 2 masks
S       172.16.1.0/24 [1/0] via 172.16.100.1
C       172.16.100.0/30 is directly connected, Serial0/0
C    192.168.1.0/24 is directly connected, FastEthernet0/0

So now you need to think like a router
1) You receive an incoming packet destined for 172.16.1.5
2) You find that the best route is the static route 172.16.1.0/24 (remember to always choose the longest subnet mask / slash notation that is a match)
3) You discover the gateway for that route is 172.16.100.1
4) As a router, you have multiple interfaces. Which one should you use to contact 172.16.100.1?
5) You look up 172.16.100.1 in the routing table
6) You find that the best route is the connected route 172.16.100.0/30
7) You forward the packet over the Serial 0/0 interface

You just used your routing table to figure out how to route the packet to the gateway you found in your routing table - Recursion!!!

Test Tip: Watch out for how this could apply to a gateway of last resort - your 0.0.0.0/0 route!

Hope this helps clear things up for everyone!

Tuesday, April 15, 2014

Majorbacon's Quick Important Shortcuts for the Cisco CLI

I wanted to share four things that speed up my use of the Cisco CLI.

The first three tricks are associated with register context. In order to perform command you have to enter the correct context first. Global, Global Configuration, Specific Configuration (like VLAN, Router, Interface, Line, etc.) Sometimes being in the wrong context slows you down, and these tricks help speed you back up again.

1) Get Global

If you are in a sub-interface level command, you can enter a different sub-interface without returning to the parent interface.
For example:
(config)# interface fa 0/0
(config-if)#
ip address 192.168.1.1 255.255.255.0
(config-if)#
interface fa 0/1
(config-if)#
ip address 192.168.2.1 255.255.255.0
 - notice that there was no exit command between the second and third steps.
Another way to avoid the exit in a sub-interface mode is to type a global configuration command without exiting first - really that's what you did a moment ago - you called for a global config command to enter a sub-interface without leaving the interface first. But you can enter any global config command you want!
For example:
(config)# interface fa 0/0
(config-if)# 
ip address 192.168.1.1 255.255.255.0
(config-if)#
hostname Router1
(config)#
 - Notice that the router rip command, a global configuration was issued without leaving the sub-interface context, and then I was left at the global level. Be aware that tab-completion and ? help will not work across contexts.

2) Do the "Do"

If you are in any configuration mode and wish to issue a command from the enable mode, such as all the show and debug commands, you can do so with the "Do" command. You remain in your config mode, but get the results from the enable mode.
(config)# interface fa 0/0
(config-if)# 
ip address 192.168.1.1 255.255.255.0
(config-if)# 
no shutdown
(config-if)#
do show ip int briefInterface  IP-Address    OK?  Method    Status       Protocol
S0          unassigned   YES  unset     admin down    down
Fa0/0      192.168.1.1   YES  unset     up             up
(config-if)#
-notice that with the do command I was able to verify what I had done at the interface level, saving myself from typing the exit command, the configure terminal command, and the interface fa 0/0 command!

3) Sanity Check!

Translating "undegub"... domain server (255.255.255.255)

One of the more annoying behaviors on a Cisco device is when you completely fat-finger it and then the entire device pauses for a good minute as though to punish you for your error with a strange 255.255.255.255 message.
This also can happen when you are in the wrong context and it doesn't recognize your command there.

This is because by default, when you enter an unrecognized command the router believes that this must be a host name of a device you want to telnet to! Assuming you haven't defined a DNS server in the configuration the router will issue a broadcast for the command to be translated into an IP address. Waiting for broadcasts to fail takes several seconds for the router. (Waiting for broadcasts to fail has been the bane of administrators since the dawn of time).
The fixes: 
  1. Skip attempting look-ups altogether (you'll have to use the local hosts table if you want name resolution)
    (config)# no ip domain-lookup
  2. Or point to a valid dns server but disable dynamic lookup
    (config)#
    ip name-server 8.8.8.8

    (config)# line vty 0 15
    (config-line)# transport preferred none
 

4) Where do I "begin"?

When you show a long list, such as a mac-address-table or configuration file, it is often inconvenient to try and  find the particular place where an item is located that you want to verify. Fortunately, you can pipe your show command into a begin statement that will actually find what you are looking for and start your results there!
For example:

Router1# show running-config | begin line
Building configuration...
line con 0
  transport input none
line aux 0
line vty 0 15
!
no scheduler allocate
end


So - I hope these tools will help you use Cisco's CLI with greater speed and agility, so you can spend less time scanning and more time doing!