Im running ubuntu 16.04 and i have accidently flushed my iptables while trying to troubleshoot a slow internet issue. I used following command

iptables -F

Now i cannot open any website, log into skype, or even ping any website using url.

I can ping internet ip addresses though, can open websites using their ip address, and can see ERR_NAME_RESOLUTION_FAILED in chrome when i try to use url.

I have tried fixes listed in following answer https://serverfault.com/questions/497438/how-to-reset-ubuntu-12-04-iptables-to-default-without-locking-oneself-out but it didnt fix the issue. The exact commands that i ren are as follows

iptables -P INPUT ACCEPT

iptables -F INPUT
iptables -F OUTPUT
iptables -F FORWARD

You can say that im not exactly sure what im doing since im not a server admin or a networking guy.

Any help would be greatly appreciated.


Update 1
Since it appears to be DNS related, I just went ahead and added my ISP's DNS server's address in network connection settings IPV4 Settings > DNS Servers input box, restarted the machine, and it has come back to life. The internet appears to be working fine now.

I think I've found a way around the problem but the original problem is still there. Is it?

Update 2
I'm having another internet related issue (the original speed issue) that I've put the description of into another question. The question is here Routing tables - Default gateway and traceroute discrepancy

  • I'm pretty sure flushing is what resets iptables, and I'm also fairly certain that rebooting will restore it to defaults. Try that. Sep 2, 2016 at 3:33
  • I have reset multiple times. It doesnt seem to affect this issue.
    – Ejaz
    Sep 2, 2016 at 10:07

1 Answer 1


You might have default policies in your iptables which drop each packet by default. Default policies won't get flushed. It would be of help if you post your iptables using

iptables -nvL

So making the iptables accept any input and output should prevent the loss of packets.

iptables -P INPUT ACCEPT
  • I did that and it doesn't appear to be making any difference. I'm still getting DNS error. Please see the update in my question.
    – Ejaz
    Sep 2, 2016 at 10:48
  • If there weren't any DNS Servers, like Google's, defined, then your machine wasn't able to resolve any domains.
    – MarcoMeter
    Sep 2, 2016 at 11:07
  • Makes sense but there should be a default DNS server value (like it would use default gateway as a DNS server as well, honest question)? I do not remember putting in DNS server address manually in the past.
    – Ejaz
    Sep 2, 2016 at 11:16
  • Well, that depends on your local network and its configuration.
    – MarcoMeter
    Sep 2, 2016 at 18:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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