• Welcome to Hurricane Electric's IPv6 Tunnel Broker Forums.

Generate EUI-64 automatically when manually assigning prefix in Linux

Started by tedllewellyn, January 13, 2010, 09:52:36 AM

Previous topic - Next topic

tedllewellyn

  Is there a way to have Linux generate the EUI-64 portion of the local address when the prefix is manually assigned?  I am aware of the shell scripting tricks, but I'm looking for something that I could use in /etc/network/interfaces that would turn a static assignment of the prefix into the full link address.  The context is that the box is a router; all the other boxes autoconfigure.

cholzhauer

FreeBSD will do this if you give it the /64 it's supposed to use...what do you have in /etc/network/interfaces?

tedllewellyn

Quote from: cholzhauer on January 13, 2010, 09:57:24 AM
FreeBSD will do this if you give it the /64 it's supposed to use...what do you have in /etc/network/interfaces?

Nothing, yet (I'm using a script).  None of the docs I've seen seem to mention setting up anything but the tunnel interface.  I was trying to get more info.  Guess I'll just have to try it and see if they copied the functionality from FreeBSD and didn't bother to tell anyone about it.

cholzhauer


jimb

You can use ipv6calc.  Something like:

ipv6calc --in prefix+mac --action prefixmac2ipv6 --out ipv6addr 2001:db8::/64 00:01:02:6D:5A:A4
2001:db8::201:2ff:fe6d:5aa4/64


Just pull the MAC from ifconfig or ip link show or whatever.  I think there may be a way of specifying and interface and having it do it itself too.  EDIT: actually there isn't ... not sure where I got that idea from.  But it's fairly trivial to pull the mac and prefix out of whatever. 

tedllewellyn

Quote from: cholzhauer on January 13, 2010, 02:02:39 PM
i doubt they copied freebsd :)  what distro are you using?

Debian.

Quote from: jimb on January 13, 2010, 05:41:56 PM
You can use ipv6calc. 

I know about ipv6calc.  I'll have to look at whether it will work the way I want it to.  Right now I'm just using a modified version of HE's script in rc.local.  In Debian terms this is a kluge.  Using ipv6calc probably is to.
I've been playing with firewall rules so I haven't had time to mess with this.

jimb

Well, why do you want a EUI-64 address on a router?  Typically, most people use low IPv6 address (like ::1) for routers.  If you're statically assigning something like that, it's simple to do in interfaces.

But if you insist, you might want to look in /usr/share/doc/ifupdown/examples/ for pre-up scripts and stuff which could do this for you.  That'd be "proper".

snarked

Maybe he wants to hide the fact that it's a router?

When you see a "...::1", don't you think that there's something else behind it?

tedllewellyn

Quote from: jimb on January 13, 2010, 06:43:09 PM
Well, why do you want a EUI-64 address on a router?  Typically, most people use low IPv6 address (like ::1) for routers.  If you're statically assigning something like that, it's simple to do in interfaces.

Du-u-u-h-h-h!  That would make the packet traces a lot easier to follow, too, wouldn't it?  OK, someone whack me in the head for missing the obvious.

But I will look at the /usr/share/doc... material.  Sometimes there's good stuff squirreled away in there.

jimb

Quote from: snarked on January 14, 2010, 02:19:10 PM
Maybe he wants to hide the fact that it's a router?

When you see a "...::1", don't you think that there's something else behind it?
Always possible, which is why I asked why he wanted to do it.  I suppose there are cases where you might want to "hide" a router from outside by putting it at some odd IPv6 in a /64, and preventing traceroute from working, etc.

Quote from: tedllewellyn on January 14, 2010, 05:14:35 PM
Quote from: jimb on January 13, 2010, 06:43:09 PM
Well, why do you want a EUI-64 address on a router?  Typically, most people use low IPv6 address (like ::1) for routers.  If you're statically assigning something like that, it's simple to do in interfaces.

Du-u-u-h-h-h!  That would make the packet traces a lot easier to follow, too, wouldn't it?  OK, someone whack me in the head for missing the obvious.

But I will look at the /usr/share/doc... material.  Sometimes there's good stuff squirreled away in there.
I was wondering if you had some reason for wanting to do it like that but I guess not.  :)  Obviously, it's not mandatory to use an MEUI-64 for your host address.  It's just what autoconfig uses.  You should use a /64 though, since that's what seems to be recommended if not mandated (there's a huge thread on the ipv6-ops list right now about whether it's "proper" to use longer-than /64 prefix lengths for things like p-t-p interfaces, such as /127s, /126s, etc.  Pretty lively debate.)