Hurricane Electric's IPv6 Tunnel Broker Forums

General IPv6 Topics => IPv6 Basics & Questions & General Chatter => Topic started by: jollino on December 12, 2010, 08:18:06 AM

Title: What is the prefixlen used for when assigning an IP?
Post by: jollino on December 12, 2010, 08:18:06 AM
Hello all,
this is porbably a very stupid question, but please bear with me. :)

I have a routed /64 (and actually a routed /48, and boy do I feel guilty for getting it assigned just for tests...), and on my main machine I have set up a "static" address to immediately recognize it when it comes up. Following the guides, I configure it by passing a prefixlen of 64, ie.: ifconfig en0 inet6 2001:470:26:2ad::1984 prefixlen 64.
The question is: does it serve any practical purpose, other than reminding that the network block it belongs to is a /64? I'm asking because if I use "prefixlen 128", ie. one host, it works just as fine.

Also, as a side note, what if I wanted to assign a whole bunch of addresses to a given interface, without going through them individually? Let's say I want to have everything from 2001:470:26:2ad:aaaa:bbbb:cccc:0 to 2001:470:26:2ad:aaaa:bbbb:cccc:ffff (ie. 2001:470:26:2ad:aaaa:bbbb:cccc::/112) to one machine, for some reason. Is there a way to quickly do it?

Thanks!
Title: Re: What is the prefixlen used for when assigning an IP?
Post by: cholzhauer on December 12, 2010, 08:21:58 AM
Quote
The question is: does it serve any practical purpose, other than reminding that the network block it belongs to is a /64? I'm asking because if I use "prefixlen 128", ie. one host, it works just as fine.

Someone please correct me if I'm wrong, but I would imagine it would affect routing.  If you told the machine that it was a /128, it wouldn't know that the rest of the /64 lived on the same interface.
Title: Re: What is the prefixlen used for when assigning an IP?
Post by: jimb on December 12, 2010, 12:14:30 PM
The whole /64 vs. /128 thing is something that has been debated  a lot.  The current recommendation is to just use /64s.  Fretting about how much address space you are using is considered "IPv4 thinking".  The IPv6 address range is simply vast.  Using /64s on a p-t-p interface is perfectly acceptable.

I don't know of a way to assign an entire range of IPv6s to a NIC without adding them individually. 
Title: Re: What is the prefixlen used for when assigning an IP?
Post by: jollino on December 14, 2010, 04:55:15 PM
Quote from: cholzhauer on December 12, 2010, 08:21:58 AM
Someone please correct me if I'm wrong, but I would imagine it would affect routing.  If you told the machine that it was a /128, it wouldn't know that the rest of the /64 lived on the same interface.

Well, that's something handled by the routing table... I'm talking about the actual interface. Perhaps operating systems use that as a hint to automatically configure the routing table? I'll have to make some tests.
Title: Re: What is the prefixlen used for when assigning an IP?
Post by: kcochran on December 14, 2010, 05:31:52 PM
Quote from: jollino on December 14, 2010, 04:55:15 PM
Well, that's something handled by the routing table... I'm talking about the actual interface. Perhaps operating systems use that as a hint to automatically configure the routing table? I'll have to make some tests.

Interface IPs wind up as connected routes.  Ultimately there are three families of routes: connected, static and dynamic.  Connected are what the system knows it is directly attached to, and will always win.  Statics are deliberately configured, and dynamic are learned via RIP, OSPF, IS-IS, BGP, etc. and will usually be the least preferred.
Title: Re: What is the prefixlen used for when assigning an IP?
Post by: cholzhauer on December 14, 2010, 05:51:40 PM
Quote from: kcochran on December 14, 2010, 05:31:52 PM
Quote from: jollino on December 14, 2010, 04:55:15 PM
Well, that's something handled by the routing table... I'm talking about the actual interface. Perhaps operating systems use that as a hint to automatically configure the routing table? I'll have to make some tests.

Interface IPs wind up as connected routes.  Ultimately there are three families of routes: connected, static and dynamic.  Connected are what the system knows it is directly attached to, and will always win.  Statics are deliberately configured, and dynamic are learned via RIP, OSPF, IS-IS, BGP, etc. and will usually be the least preferred.

Right, the system uses the connected routes to help set up the overall routing table