# Static ipv4 and dynamic ipv6 address config: how to do it?

## nephros

Hi,

I am running a IP dual-stack LAN, set up like this:

```

   {cable uplink} --- [ OpenWRT router] ---- LAN --- [ box1 ]

                                   |

                                   ----------WLAN--- [laptop1]

```

Now, the machines do the following:

 router: runs DHCP server, 6to4 tunnel, radvd

 laptop1: connects via WLAN, get addresses via DHCP and radvd everything working OK

 box1: connected via LAN, has a fixed ipv4 address and should also get a radvd-assigned ipv6 address but it doesn't.

I have been trying to figure out to get box1 to keep its static IPv4 connection, and get IPv6 address and routing information from radvd like dynamic clients.

Everything works on box1 if I set a static ip6 address (prefix + local prefix +MAC address) and route in conf.d/net but I don't want to do that because later I want to use privacy extensions which vary the MAC part.

----------

## truc

Are you hidding some informations about box1 by any chance? I ask, because, enabling IPv6 forwarding on box1 will usually disable IPv6 auto conf. That may be you problem?

Other than that, why not just keep everything dynamic on the client side and just configure the DHCPd on the openWRT router to always assign(and reserve) the same IP address for box1?

----------

## nephros

 *truc wrote:*   

> Are you hidding some informations about box1 by any chance? I ask, because, enabling IPv6 forwarding on box1 will usually disable IPv6 auto conf. That may be you problem?

 

Good catch, yes, box1 has a rather more complex setup (connected to two other networks, and openvpn server), and I have ipv6 forwarding enabled.

I will experiment with ipv6 forwarding disabled, didn't know that. Is there a way to have both?

----------

## truc

 *nephros wrote:*   

> Good catch, yes, box1 has a rather more complex setup (connected to two other networks, and openvpn server), and I have ipv6 forwarding enabled.
> 
> I will experiment with ipv6 forwarding disabled, didn't know that. Is there a way to have both?

 

IIRC there is. I don't remember which of the sysctl key you have to play with but I do remember you have to set a boolean key to 2 (that's right, not 0, not 1, but 2  :Laughing:  )

I have not tested it though, so keep us informed  :Wink: 

----------

## nephros

 *truc wrote:*   

>  *nephros wrote:*   Good catch, yes, box1 has a rather more complex setup (connected to two other networks, and openvpn server), and I have ipv6 forwarding enabled.
> 
> I will experiment with ipv6 forwarding disabled, didn't know that. Is there a way to have both? 
> 
> IIRC there is. I don't remember which of the sysctl key you have to play with but I do remember you have to set a boolean key to 2 (that's right, not 0, not 1, but 2  )
> ...

 

Right, it's the 'accept_ra' sysctl.

I learned from here, and it's documented at http://www.kernel.org/doc/Documentation/networking/ip-sysctl.txt (or locally file:///usr/src/linux/Documentation/networking/ip-sysctl.txt)

This will require some more work for me to get it right for all the interfaces in my use case (esp routing is a mess on "box1") but thanks a lot for your help and pointing me in the right direction.

[PS: What is the right amount of slashes for the file: URI scheme? Three, four, what? Is it at all portable?]

[PPS: I have been absent from these forums for years now, seriously considering spending more time here again after this very positive experience]

----------

## truc

 *nephros wrote:*   

> This will require some more work for me to get it right for all the interfaces in my use case (esp routing is a mess on "box1") but thanks a lot for your help and pointing me in the right direction.

 no problem, I was probably a bit lucky there  :Wink: 

 *Quote:*   

> [PS: What is the right amount of slashes for the file: URI scheme? Three, four, what? Is it at all portable?]

 

three, unless you want to specify the hostname which unsurprisingly goes between the second and the third in which case it looks like there is only two slashes  :Laughing: 

----------

