23

I would like to reset my network settings and services entirely as if starting from scratch. I had recently installed Ubuntu a few days ago, and deleted a important boot file. After installing Ubuntu again, my network was not auto configured like my previous install. And my network did not work. Then I think I messed up the network settings too much in attempting to fix it, and now I would like to completely reset network settings. My system is an old HP Pavilion dv8 running Ubuntu 14.04 and Windows 8.1 dual boot.

2

3 Answers 3

18

The -r flag explicitly releases the current lease...

$ sudo dhclient -r

Now obtain fresh IP address using DHCP on Linux:

$ sudo dhclient

4
  • 1
    Hey, I tried this and it worked! Thank-you, I'm interested what does it do? My issue occurred after uninstalling Logmein Hamachi, any ideas why this fixed the issue that that created? No worries if not, just interested in learning more about what my PC is doing.
    – Retsek
    May 17, 2020 at 23:52
  • This worked from going from a bridged network to a NAT network on a VM Aug 27, 2020 at 11:33
  • THANK YOU. I tried everything including restarting Linux and router, iptables -F, even switched from wifi to LAN but nothing worked. The fault is either on NetworkManager or ProtonVPN, one of them broke my system, and this fixed it.
    – saeedgnu
    Jun 29, 2022 at 5:15
  • After this, I got an 'operation not possible due to rfkill', but sudo rm /dev/rfkill worked.
    – ggorlen
    Mar 22, 2023 at 0:46
10

I found a good command which has helped me to fix my problems.

sudo iptables -F

It reset my network settings and my network started to work. I hope this would help someone who had a similar problem.

Source:- Ask Ubuntu

2
  • 6
    This is unlikely to help if you network is not configured as all this command does is flush firewall rules.
    – Anigel
    Apr 28, 2015 at 13:07
  • This helped me, thank you so much. just noticed that after rebooting the system, i have to execute the command again to avoid my issue. any permanent solution like this?
    – joe_inz
    Jun 13, 2021 at 11:26
9

Try this:

sudo nano /etc/network/interfaces

Enter:

auto eth0
iface eth0 inet dhcp

eth0 is assuming that you are using an Ethernet labeled "eth0". You can confirm that with ifconfig.

3
  • 2
    can you explain what this is doing? Jul 25, 2017 at 20:33
  • 1
    This is a simple change to return the interface (iface) known as eth0 (ethernet 0) to a dhcp configuration. The answer is specifically referring to the "not auto configured like my previous install" dhcp is an auto config coming from a router or other dhcp server.
    – wlraider70
    Jul 26, 2017 at 0:06
  • This is the correct answer to "How to completely reset ubuntu networking settings?". Of course, uncomment any other settings in /etc/network/interfaces Nov 21, 2023 at 11:24

Not the answer you're looking for? Browse other questions tagged .