Sunday, November 30, 2014

Working with IPv6 address Part 1(Exam topic 3-E)

IPv6 may seem bit and scary. I know  that I wasn't too thrilled about IPv6 at first, in fact i hated it. That was until I understood its simplicity.
I will try to simplify and explain IPv6 as best as I can. I will try to brake down structure, and rules with close comparison to IPv4. Understanding IPv6 will require a understanding of submitting, binary and hexadecimal.

First lest start with the basics. 

  • IPv6 is written out in  hexadecimal format 
  • An IPv6 address is 128 bits long 
  • An IPv6 address is broken into 8 16 bit groups (IPv4 uses 4 8 bit groups, a group in IPv4 world is called an octet
  • IPv6 uses only CIDR for the network bits 
Now Lets review the foundation Base 2, base 10 and base 16 numeral system 

Base 10 (decimal)
The very first numeral system we learn as a child. which is based on the powers of 10. In the below screenshot you see 255 written out in base 10.






As you can see 10 to the power of 0 equals 1, and 10^1 = 10, and so forth. 
Now we need to add up to 255, to we need 2 100, 5 10, and 5 1. I know this seems too fundamental but we need to take a steep back and take a look back so its easier to understand binary and hex.

Base 2 (Binary) 
Base 2 is introduced when you learn binary. Base 2 is based on the powers.....of you guessed it 2. Based 2 only use a 1 or an 0 to represent which bit is on or off to equal a decimal number. The max for in 8 digit binary (which is all we are concerned with) is 255. In the screenshot below we will write out 158 in binary. 






We see that in binary 158 is written out as 10011110. If you do the math we simply subtract 128 from 158 and turned that bit on we did did not need 64 so we left that bit off. You continue down until you get you reach 0. The best way to learn binary numeral system is to practice, practice converting decimal numbers to binary, you can convert 201, 75, and 103, and post your answers. 

Base 16 (Hexadecimal)
Base 16 is what MAC addresses and IPv6 uses, IPv6 relays heavily on your MAC address you will see why I made that statement when you dive deeper into IPv6. Base 16 is based on the power of 16, and is written out as 0123456789ABCDF where A=10, B=11, C=12, and so fort. Since were using this numeral system for IPv6 we will only go up to 4 places. Each place contains 8 bits. in this example we will write out 179 in hexadecimal. 







We see that we need (11x16)+(3x1) to get 179 which is written out in hex as 0xB3 (B=11)
Seems simple enough, we applied the same concept used from decimal and binary. 

Conversion (Hex to Binary)
Finally we will convert hexadecimal to binary. We will jump straight to the shortcut on how to convert. Each hexadecimal character is represented by 4 bits which is also called a nibble. In the example I will be converting 0xB3 to binary. 











Since we know each hex is 4 bit long we can split our 8 bit binary conversion chart to 4 bits, or we can solve for the entire binary number. does not matter in the end it is the same amount of bits. This trick however will save you tons of time without the need to convert hex to decimal first. I the example above we know that B=11 so we turn on the necessary bits for 11 and then the second hex character we are converting would be 3 so we turn on the bits necessary for 3.
So in binary B=1011 and 3=0011 so 0xB3 = 179 in dec and 10110011 in binary. 

Below is a chart that you an draw up to help you convert quickly 


Now that we have the foundation down lets take a look at some of the rules.   

What do we know so far
So far we know that IPv6 is 128 bits long separated into 8 groups 4 hex characters each with each character equaling 4 bits each 

Rules of IPv6
There are a few rules that will make your live a lot easier when handling IPv6, because lets face there is no way we can remember all IPv6 address the same way we did with IPv4. We are talking about 24 characters below is the IPv6 address we will apply some of the basic rules to 
2014:00B0:0000:0000:0000:B4A0:F63C:00AB

First rule - consecutive 0s can be represented by "::" keep in mind this can only be done once IOS is smart enough to know your writing a shorthand version of an IPv6 address. See example below.
2014:00B0::B4A0:F63C:00AB 
Now that's a lot easier to read and its the same exact address as previously mentioned. Again this can only be done once per address. 

Second rule- All leading 0s can be omitted. As you ca see below I've omitted all leading 0s from our example IPv6 address
2014:B0::B4A0:F63C:AB
Now that we've brought our IPv6 address down to size it doesn't look so scary 

Link Local
Link local is enabled by default when IPv6 is enabled. Link local is similar to Microsoft's automatic addressing. In which network communication is enabled without any administrative interference. You can ping local devices within your link local network. You can not set a gateway to a link local address, so you can not reach outside of your link local network (which means no internet) The prefix for a link local address will always be an FE80 prefix 


Working with network bits
Rather than using the familiar 255.x.x.x format IPv6 uses CIDR notation which counts the bits used for a network. The most common network you will come across is /64 
Here is a link to an article that covers IPv6 subnetting

Types of traffic  
In the chart below we see the types of traffic available in IPv6





Broadcast no longer exist instead we use multicast 
Multicast is used by services such as DHCP to receive a multicast you must be in listening mode 
Unicast is commonly used for 1 to 1 communication 
Anycast is useful in a globally dispersed environment where you will have multiple servers configured with the same IP and the client will connect to the serve with the lowest cost. 

Types of addresses 

Global
Gloabal addresses are provided by ISP to each subscriber. Usually this address will begin with 2000: 
each provider as their global prefix which is 16 bits then they would add the additional 48 bits when given to the customer 

Site local 
Site local is similar to the common unique address or an internal address for example 192.168.10.0/24 

Link local 
Automatic address or loopback address 



No comments:

Post a Comment