Sign up ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

I want to stop internet on my system using iptables so what should I do?

iptables -A INPUT -p tcp --sport 80 -j DROP


iptables -A INPUT -p tcp --dport 80 -j DROP ?

share|improve this question
You went from "I want to allow only some specific services like I should be able to access the internet" to "I want to stop internet on my system"? – Michael Mrozek Sep 11 '11 at 5:58
Trying different modes of iptables. – Chankey Pathak Sep 11 '11 at 6:11
@Chankey I'd advise reading the stateful firewall article I linked in my other answer, it will probably explain everything you need to know how to do. It's very easy too.. just ignore emerge and kernel config parts. – xenoterracide Sep 11 '11 at 6:34
Okay, thank you xenoterracide :) – Chankey Pathak Sep 11 '11 at 6:36

1 Answer 1

up vote 5 down vote accepted

Reality is you're asking 2 different questions.

  • --sport is short for --source-port

  • --dport is short for --destination-port

also the internet is not simply the HTTP protocol which is what typically runs on port 80. I Suspect you're asking how to block HTTP requests. to do this you need to block 80 on the outbound chain.

iptables -A OUTPUT -p tcp --dport 80 -j DROP

will block all outbound HTTP requests, going to port 80, so this won't block SSL, 8080 (alt http) or any other weird ports, to do those kinds of things you need L7 filtering with a much deeper packet inspection.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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