# [SOLVED] dhcpcd not working for IPv6

## roboto

I followed the dhcp set up instructions step by step in the Gentoo Handbook. 

I rebooted and it did the dhcp method for IPv6, instead of IPv4.

So I couldn't connect to the internet.

The kernel .config:

https://paste.pound-python.org/show/AMTDQG6cuwcXCMGdAr2/

rc.log for my dhcpcd output:  https://paste.pound-python.org/show/NfcWUPNlmuelPPh4vzZr/

Is there any way I can just use IPv4 instead of IPv6?

dhcp in portage is set to version 4, instead of 6, which is stupid.

----------

## Maxxx

I don't be able to open your kernel config:

https://paste.pound-python.org/show/AMTDQG6cuwcXCMGdAr2/

Maybe you must enable IPV4 and disable IPV6.

I disabled IPV6 in my kernel and now i have only IPV4.

Furthermore, posting /etc/conf.d/net file would be usefull

----------

## roboto

I'm not sure on how you disable IPv6 and enable IPv4, considering there's no "CONFIG_IPV4" option. Only CONFIG_IPV6

/etc/conf.d/net:

config_enp2s0="dhcp"

.config: https://paste.pound-python.org/show/RFWeJ5XgBA4N4mMAy1j5

----------

## roboto

I disabled IPv6 entirely just now in my .config and dhcpcd still uses IPv6 addresses. Its output this boot was slightly different.

https://paste.pound-python.org/show/gb8oykgF6RVRsHVfguD8

----------

## Hu

Normally, an IPv6-enabled system will also configure an IPv4 address.  This is necessary because key parts of the Internet (in particular, residential ISPs) are years behind on their IPv6 deployment, so trying to run an IPv6 only stack is painful.  Please explain why you believe you had only an IPv6 address.

 *roboto wrote:*   

> dhcp in portage is set to version 4, instead of 6, which is stupid.

 Please explain this statement.  The DHCP server package version in Portage is version 4.  The DHCPCD (client) package in Portage is version 6.  Neither of these has any bearing on what IP versions are supported.

 *roboto wrote:*   

> I disabled IPv6 entirely just now in my .config and dhcpcd still uses IPv6 addresses. Its output this boot was slightly different.

 That log appears to cover several reboots, including ones from Tuesday, the day before your post.  You did not indicate your local time at the time of the post, so we must guess which log entries were made with your IPv6-disabled kernel.  I see one boot at 16:22 that tried to use IPv6.  I see another boot at 16:33 that did not.

----------

## Maxxx

What's the output of

```
ifconfig
```

In this output, there should be "inet" line which means IPV4 while "inet6" means IPV6.

If you have "inet" line, your IPV4 is active and loaded from kernel.

For example, i disabled ipv6 directly in kernel and i haven't "inet6" line.

----------

## UberLord

 *Quote:*   

> dhcp_open: enp2s0: Address family not supported by protocol

 

Oh dear, looks like AF_PACKET aka the Packet Filter isn't enabled in your kernel config.

 *Quote:*   

> # CONFIG_PACKET is not set

 

Yup, I was right  :Smile: 

----------

## Ant P.

 *UberLord wrote:*   

>  *Quote:*   dhcp_open: enp2s0: Address family not supported by protocol 
> 
> Oh dear, looks like AF_PACKET aka the Packet Filter isn't enabled in your kernel config.
> 
>  *Quote:*   # CONFIG_PACKET is not set 
> ...

 

Maybe nitpicking, but shouldn't all the dhcp client packages be using linux-info.eclass to check for that?

----------

## UberLord

That's a good point. Feel free to file a Gentoo bug, hopeful the maintainers can fix all DHCP packages.

But to really pick more nits, they use also add an ipv4 use flag and only test that if enabled.

IPv6 only kernels are a thing as well you know and afaik only dhcpcd supports building as IPv6 only 

----------

## Hu

While that warning could be useful, remember that not all systems even have a kernel configuration available when the DHCP client is built, so the test needs to be optional.  I have a bit of a sore point about the linux-info.eclass functions from a few years ago when packages kept needlessly dying because, while my kernel was configured correctly, they couldn't prove it, so they aborted.

Also, even when the configuration is available and shows AF_PACKET support, there's no guarantee that the package will be run on a well-configured system, only that the current build host is well-configured.

----------

## UberLord

 *Hu wrote:*   

>  I have a bit of a sore point about the linux-info.eclass functions from a few years ago when packages kept needlessly dying because, while my kernel was configured correctly, they couldn't prove it, so they aborted.

 

That is truely nefarious!

It should just be a warning at most because it's not API/ABI breaking, just a runtime requirement and guess what - dhcpcd keeps running regardless because other protocols might just work.

----------

## roboto

Enabling AF_PACKET solved my issue, dhcpcd now uses IPv6.

Thank you all very much.

----------

## UberLord

So AF_PACKET is only needed for IPv4.

AF_INET6 is the sole requirement (afaik) for IPv6.

----------

## roboto

Oops, I meant to say IPv4, sorry.

----------

