IPv6 general prefixes

Recently I read a post over at CCIE Pursuit about paying attention to typos on the IOS command line. His example illustrates a common mistake made when configuring an IPv6 address on an interface, but it also drew attention to an option I hadn't noticed before: IPv6 general prefixes.

As it turns out, general prefixes can be defined in IOS to act as shortcuts when assigning IPv6 addresses to interfaces. For example, if your organization was assigned the 2001:db8:42::/48 prefix, chances are all your routers would have the majority of their interfaces configured with addresses within this prefix. To make address assignment a bit less tedious, you can define a named general prefix pointing to 2001:db8:42::/48 and reference it at interface configuration.

First, we define the general prefix:

Router(config)# ipv6 general-prefix ?
  WORD  General prefix name

Router(config)# ipv6 general-prefix MyGlobal ?
  6to4                Create 6to4 prefix from IPv4 address
  X:X:X:X::X/  IPv6 prefix

Router(config)# ipv6 general-prefix MyGlobal 2001:db8:42::/48

Now when assigning an IPv6 address to an interface, we can reference the prefix by its much more memorable name instead of having to type out the entire address by hand. For example, if we wanted to assign the address 2001:db8:42:10::1/64:

Router(config-if)# ipv6 address ?
  WORD                General prefix name
  X:X:X:X::X          IPv6 link-local address
  X:X:X:X::X/  IPv6 prefix
  autoconfig          Obtain address using autoconfiguration

Router(config-if)# ipv6 address MyGlobal ?
  X:X:X:X::X/  IPv6 prefix

Router(config-if)# ipv6 address MyGlobal 0:0:0:10::1/64
Router(config-if)# do show ipv6 interface brief
FastEthernet0/0            [up/up]
FE80::C000:6AFF:FEC1:0
2001:DB8:42:10::1
FastEthernet0/1            [administratively down/down]

Notice that the first portion of the prefix (2001:db8:42::/48) was taken from our predefined MyGlobal prefix, and the rest was filled in with what we typed at interface configuration. In the above example, zeros were used to fill in the first 48 bits of the interface address; in practice, any values can be used, and will simply be overwritten by the referenced prefix.

General prefixes can also be used in conjunction with EUI-64 addresses as you might expect:

Router(config-if)# no ipv6 address MyGlobal 0:0:0:10::1/64
Router(config-if)# ipv6 address MyGlobal 0:0:0:10::/64 eui-64
Router(config-if)# do show ipv6 interface brief
FastEthernet0/0            [up/up]
FE80::C000:6AFF:FEC1:0
2001:DB8:42:10:C000:6AFF:FEC1:0
FastEthernet0/1            [administratively down/down]

However, it's important to pay close attention when defining general prefixes; IOS allows you to configure multiple prefixes with the same name. If multiple are prefixes are referenced by a common name, the interface will be configured with an address within each prefix. Here we define two unique local /48 prefixes, and the interface is assigned ::1/64 in both:

Router(config)# ipv6 general-prefix MyLocals fd00:1234:5678::/48
Router(config)# ipv6 general-prefix MyLocals fd00:8765:4321::/48
Router(config-if)# do show running-config | include MyLocals
ipv6 general-prefix MyLocals FD00:1234:5678::/48
ipv6 general-prefix MyLocals FD00:8765:4321::/48
Router(config)# interface f0/0
Router(config-if)# ipv6 address MyLocals ::1/64
Router(config-if)# do show ipv6 interface brief
FastEthernet0/0            [up/up]
FE80::C000:6AFF:FEC1:0
2001:DB8:42:10:C000:6AFF:FEC1:0
FD00:1234:5678::1
FD00:8765:4321::1
FastEthernet0/1            [administratively down/down]

Comments

That is cool. It's nice to see non-introductory information on IPv6. I look forward to seeing more IPv6 content in the future. Thanks.

Leave a Comment


Register to comment as a member. You'll look cooler.

Optional; will not be displayed publicly or given out.

Only personal (e.g. blog, Twitter, or LinkedIn) and/or on-topic links, please.