14

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
7

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 '15 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 '21 at 11:26
6

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.

2
  • 2
    can you explain what this is doing? Jul 25 '17 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 '17 at 0:06
6

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

$ sudo dhclient -r

Now obtain fresh IP address using DHCP on Linux:

$ sudo dhclient

2
  • 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 '20 at 23:52
  • This worked from going from a bridged network to a NAT network on a VM Aug 27 '20 at 11:33

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