Network Fundamentals · Topic 8 of 17
IPv6 Addressing and Prefixes
Learn how IPv6 addresses are written and shortened, how prefixes work, and how to configure and verify IPv6 addressing on a Cisco router interface.
- 6 min
- Exam objective 1.8
- An IPv6 address is 128 bits, written as eight groups of four hex digits.
- Shorten by dropping leading zeros and using
::once for a run of zero groups. - The prefix length shows the network part. A /64 is standard for a LAN.
What it is
IPv6 is the newer version of the Internet Protocol, and its main change is a 128-bit address instead of 32 bits.
That gives an enormous number of addresses, so every device can have its own globally unique one without the workarounds IPv4 needs.
IPv6 addresses are written in hexadecimal, as eight groups of four hex digits separated by colons:
2001:0DB8:0000:0001:0000:0000:0000:0001
Each group is 16 bits. The prefix length, written after a slash, says how many leading bits identify the network.
For most LANs it is /64: the first 64 bits are the network, and the last 64 bits identify the interface.
How it works
You shorten addresses with two rules, read the prefix as the network part, and configure it on an interface.
Shortening an address
Long addresses are shortened with two rules:
- Drop leading zeros in each group. 0DB8 becomes DB8, and 0001 becomes 1.
- Replace one run of consecutive all-zero groups with
::. You can do this only once in an address, otherwise it would be unclear how many groups each::stands for.
Applying both rules to the address above gives:
2001:DB8:0:1::1
To expand a short address, put back the leading zeros and replace :: with enough zero groups to reach eight groups in total.
Hex digits are not case sensitive. Addresses are usually written in lowercase in practice.
Drop zeros only from the front of a group, and use :: once. If you see two, the address is invalid.
Prefixes
The prefix length works the same way as in IPv4. For 2001:db8:1:1::/64, the first 64 bits, four groups, are the network, and the rest are host bits.
A common site plan gives each organisation a larger block, such as a /48, and then splits it into many /64 subnets, one per VLAN. 2001:db8::/32 is reserved for documentation, which is why you see it in examples.
To see how much room that gives, think of a /48 site block. The 16 bits between /48 and /64 form the subnet ID, so one site can create 65,536 separate /64 subnets.
Because /64 is the standard LAN size, you do not need to calculate host counts the way you do in IPv4. You simply number the subnets, for example 2001:db8:1:1::/64, 2001:db8:1:2::/64 and so on.
Prefixes are also used in routing. A route to 2001:db8:1::/48 covers every /64 subnet inside that block, in the same way an IPv4 summary route covers smaller subnets.
There is no broadcast in IPv6. Functions that IPv4 handled with broadcast use multicast instead.
Configuring an interface
Routing for IPv6 must be switched on before the router forwards IPv6 packets:
ipv6 unicast-routing
interface GigabitEthernet0/0
ipv6 address 2001:db8:1:1::1/64
no shutdown
You can also let the router build the interface part of the address from its MAC address, with the EUI-64 method:
interface GigabitEthernet0/0
ipv6 address 2001:db8:1:1::/64 eui-64
A link-local address is created automatically once IPv6 is enabled on an interface, for example by configuring a global address or with ipv6 enable. You can set your own, which is easier to read:
interface GigabitEthernet0/0
ipv6 address fe80::1 link-local
How hosts get addresses
A host can get its address in several ways:
- Static: configured by hand.
- SLAAC (Stateless Address Autoconfiguration): the host listens for a router advertisement that contains the prefix, then builds its own interface part. No server holds a record of the address.
- DHCPv6: a server hands out the address (stateful), or only extra information such as DNS servers (stateless).
Routers also help hosts find each other with the Neighbor Discovery Protocol (NDP), which replaces ARP. NDP uses ICMPv6 messages.
Verifying
show ipv6 interface brief
show ipv6 interface GigabitEthernet0/0
show ipv6 route
ping 2001:db8:1:1::2
show ipv6 interface brief lists each interface with its link-local address and its global address. show ipv6 route shows IPv6 routes, where connected networks are labelled C and local addresses are labelled L.
What to remember for the exam
Eight facts cover IPv6 addressing.
- An IPv6 address is 128 bits, written as eight groups of four hex digits.
- Shorten by dropping leading zeros and using
::once for a run of zero groups. - The prefix length shows the network part. A /64 is standard for a LAN.
- IPv6 has no broadcast. It uses multicast instead.
ipv6 unicast-routingmust be enabled for a router to route IPv6.ipv6 address ADDRESS/PREFIXsets a static address. Addeui-64to build the host part from the MAC.- Hosts can use static addressing, SLAAC or DHCPv6.
- NDP, using ICMPv6, takes over the role ARP plays in IPv4.
Without ipv6 unicast-routing, a router has IPv6 addresses on its interfaces but will not forward IPv6 packets between them.
Common mistakes
These five slips are the usual ones.
Using :: twice. An address can have only one ::. Using it twice makes the address ambiguous and invalid.
Removing zeros from the wrong end. You can drop leading zeros in a group, never trailing ones. The group 0100 shortens to 100, not to 1.
Forgetting ipv6 unicast-routing. Without it, a router can have IPv6 addresses on its interfaces yet will not forward IPv6 packets between them.
Mixing up the prefix and the host part. In 2001:db8:1:1::1/64, the /64 is the length of the network part. It is not part of the host identity.
Assuming IPv6 needs a different cable or switch. Switches carry IPv6 frames without any special setup, since they work at Layer 2.
Check yourself
Work through these three prompts.
What is the shortest form of 2001:0DB8:0000:0000:0000:0000:0000:0001, and which steps give it?
It is 2001:DB8::1. First drop the leading zeros in each group, then replace the one run of all-zero groups with a double colon, which may be used only once.
What does SLAAC do, and how does it differ from DHCPv6?
With SLAAC the host listens for a router advertisement that contains the prefix and builds its own interface part, so no server holds a record of the address. DHCPv6 uses a server to hand out the address (stateful), or only extra information such as DNS servers (stateless).
Which command must be enabled before a router forwards IPv6, and what does
show ipv6 interface brieftell you?ipv6 unicast-routingmust be enabled.show ipv6 interface brieflists each interface with its link-local address and its global address.
Topic 8 of 17 in Network Fundamentals
Test yourself on Network Fundamentals
The full Cisco CCNA 200-301 question bank has 1,206 questions, with timed practice exams and an explanation for every answer.
This study guide is independent and is not affiliated with, endorsed by, or sponsored by Cisco. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.