# Is ipv6_addrs_<NIC> supported?



## Ben (Dec 4, 2012)

Hi,

I changed my alias-configuration syntax to 
	
	



```
ipv4_addrs_<NIC>
```
-Syntax. In the default configuration I can't find the IPv6 equivalent.

Is 
	
	



```
ipv6_addrs_<NIC>
```
 supported already? I currently have no machine to test it.

Thanks.


----------



## gkontos (Dec 4, 2012)

That would be:


```
ifconfig_<NIC>_ipv6="inet6 XXXX:XXXX:XXXX:XXXX::X prefixlen 64"
```


----------



## Ben (Dec 4, 2012)

But this is not for alias configuration. This is to assign an IPv6 address, right?


----------



## gkontos (Dec 4, 2012)

Ben said:
			
		

> But this is not for alias configuration. This is to assign an IPv6 address, right?



Correct, if you need an alias there is no difference in the syntax:


```
ifconfig_<NIC>_alias0="inet6 XXXX:XXXX:XXXX:XXXX::X"
```


----------



## Ben (Dec 4, 2012)

Yes, this is the deprecated syntax which is not handy to use any more (a lot of aliases). That's why I switched to the other Syntax.

Just I can't find the equivalent for IPv6. That's a petty and inconsitent


----------



## kpa (Dec 4, 2012)

Try the attached patch for /etc/network.subr. If it works it should allow you to write the ipv6 aliases this way:


```
ipv6_addrs_re0="2001:db8:1111:2222::1/64 2001:db8:1111:2222::2/64 "
```

This is not supported yet:


```
ipv6_addrs_re0="2001:db8:1111:2222::1 prefixlen 64"
```


Oh and this patch is against r242187 of /etc/network.subr in 9-STABLE. I don't know if it applies to 9.0-RELEASE or 9.1-RELEASE.


----------



## Ben (Dec 4, 2012)

Oh, thanks for the patch.

Is this going to be available in an upcoming 9.0-Release or 9.1 earliest?

Very nice, thanks!


----------



## kpa (Dec 4, 2012)

This is still my own private hacking  If it works I'll see if I could get it commited to HEAD and 9-STABLE.


----------



## Ben (Dec 4, 2012)

You got my vote


----------



## kpa (Dec 4, 2012)

By the way, 9.0-RELEASE and 9.1-RELEASE are feature locked so this type of enhancements that add new functionality are not going to make into them. 9.2-RELEASE it's certainly possible if my patch gets accepted to 9-STABLE.

I'll see if I can do any improvements, there's not a lot of error checking, not even in the original code I used as the starting point.


----------



## kpa (Dec 6, 2012)

PR sent, http://www.freebsd.org/cgi/query-pr.cgi?pr=174225. It does not show up in GNATS yet though.

Edit: Shows up in GNATS now.


----------



## Ben (Dec 6, 2012)

Thanks!!


----------



## kpa (Dec 21, 2012)

Patch updated in the PR, it's now possible to use ranges like this:


```
ipv6_addrs_re0="2001:db8:1111:2222::2-4/64 2001:db8:1111:2222::9-f/64"
```

It also allows silly ranges like:


```
2001:db8:1111:2222::1-ffff/64
```

Use with caution


----------



## Ben (Dec 21, 2012)

Nice!


----------



## kpa (Dec 23, 2012)

My patch is getting more intrusive because I have to modify few more functions in network.subr. I have put up the patch at github as 

https://gist.github.com/4362018

With this version it should be possible to assign all IPv6 addresses on an interface with a single setting in rc.conf(5)


```
ipv6_addrs_re0="2001:db8:1111:2222::1-4/64"
```

Previously there had to be ipv6_interfaces or ifconfig_IF_ipv6 for ipv6_addrs_IF to work.


----------



## kpa (Dec 26, 2012)

Yet another update to the patch. This one should be the final one. 

I've updated the PR with the updated patch, the third one is the latest.

The patch on github:

https://gist.github.com/4362018/297373e0a7e659ba898437c6ec57507a9f201f83


----------

