I upgraded my Raspberry Pi to Jessie, which uses systemd. One side-effect is that it connects using IPv6 only and does not have an IPv4 address. How can I force it to get an IPv4 address from the DHCP server?

One ad-hoc solution is the command

sudo dhclient -4 -v eth0

but this only lasts for the current session.

  • None of the answers below worked for me, instead I needed to sudo apt-get install isc-dhcp-client after using sudo dhclient -4 -v eth0 to get online. – mrswadge May 20 '19 at 23:12
  • Some further context to my previous comment. In my situation the symptoms when running sudo ifup -v eth0 the call to dhclient was failing and instead showing the usage information. – mrswadge May 21 '19 at 8:21

Raspbian Jessie no longer has a file called /etc/sysctl.d -- it's now a folder of the same name.

According to the read-me file in the same folder, README.sysctl, it basically says that any .conf file will be read in at boot time and processed. Any legal file name will work, but they suggested local.conf, so that's what I used.

I created /etc/sysctl.d/local.conf and added the single line from the other answers:


This appears to work just fine.

  • Anything .d in /etc was never anything but a directory to start with. I dunno if Joe Platano's answer involves a typo or whether that will actually work, somehow I doubt it (although there seems to be another answer confirming it will). – goldilocks Dec 7 '16 at 14:39

sudo nano /etc/sysctl.conf

append the following lines to turn off ipv6:

net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1

run sudo sysctl -p to take effect or just reboot.

  • Confirmed working on Raspbian Buster. – Vahid Amiri Apr 12 '20 at 5:51

In Raspbian Jessie/Jessie Lite, simply edit the /etc/sysctl.conf file and add the switch to disable ipv6, as follows:

sudo nano /etc/sysctl.conf

Enter the text:


Save the file with Ctrl-O, Ctrl-X and reboot the RPi.


you can insert a line into sysctl to disable ipv6.

echo net.ipv6.conf.all.disable_ipv6=1 >> /etc/sysctl.conf

this will work after next reboot.

  • 2
    It's /etc/sysctl.conf as target file. Be aware that the > will override the entire file! – David Dec 2 '19 at 16:00

the easiest way I found to also get an IPv4 address for the interface was changing /etc/network/interfaces: setting the manual to dhcp ... that also gets you an IPv4 address on eth0 ... probably only a hack but haven't found anything better yet either ...

    auto eth0
    allow-hotplug eth0
    # iface eth0 inet manual
    iface eth0 inet dhcp
  • Raspbian Jessie does not use dhcp (unless the user has really fiddled with it) and this would prevent GUI WiFi support from working. – Milliways Nov 6 '15 at 11:51

Combining, correcting and adding to the previous answers:

To fix an interface (either eth or wlan) that is showing just an inet6 (IPV6) address and no inet (IPV4) address, you can append a config file to disable inet6 (IPV6) assignment, so that all interfaces are given an inet (IPV4) address. If that config file is then deleted again, interfaces will then be given BOTH an inet (IPV4) and an inet6 (IPV6) address, i.e. a return to the usual default state.

To add the file:

sudo nano /etc/sysctl.d/local.conf

and add the single line:


Save with Ctrl-O, Y, [Return]. Reboot and login again.

sudo reboot

Check the addresses using


Remove the config file and reboot:

cd /etc/sysctl.d
sudo rm local.conf
sudo reboot

Check again with ifconfig:


See both inet (IPV4) and inet6 (IPV6) addresses for all interfaces:

eth0      Link encap:Ethernet  HWaddr 00:e0:4c:53:44:58
          inet addr:  Bcast:  Mask:
          inet6 addr: fe80::26a5:b629:f948:92c3/64 Scope:Link

wlan0     Link encap:Ethernet  HWaddr b8:27:eb:62:b4:7a
          inet addr:  Bcast:  Mask:
          inet6 addr: fe80::254c:3f61:fdc:bc49/64 Scope:Link

And I can once again SSH to my Pi Zero using either eth0 or wlan0, both using either IPV4 or IPV6 address.


I upgraded my Raspberry Pi to Stretch and I was unable to have any success with any variation of the net.ipv6.conf.all.disable_ipv6=1 answers.

Manually running sudo dhclient -4 -v eth0 to get my network/internet connectivity back worked, however as stated by the original poster it does not survive a reboot.

I noticed that sudo ifup -v eth0 called dhclient, but it was failing and instead of functioning correctly, it was showing the usage information for the dhclient command.

The workaround appears to be to move away from dhclient and instead install isc-dhcp-client. Upon reboot my connectivity was automatically available after installing this package.

sudo apt-get install isc-dhcp-client
sudo reboot

I have the same problem and tried the solution below, this works fine after rebooting my Pi.

sudo nano  /etc/sysctl.d/98-rpi.conf



Type Ctrl-X then answer "Y" followed by to save the file.

sudo reboot

Now I see my ip4 address on booted screen.

Not the answer you're looking for? Browse other questions tagged or ask your own question.