Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Linux Forums > Linux - Networking
User Name
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.


  Search this Thread
Old 02-26-2003, 11:30 AM   #1
LQ Newbie
Registered: May 2002
Location: Ireland
Posts: 5

Rep: Reputation: 0
Talking iptables - howto block by a port and IP address -HELP!

I have RH7.1 and I'm trying to setup a rule using "iptables" to only accept connections from a specific IP address and a specific port?

does anyone know the command to do this?

Old 02-26-2003, 12:41 PM   #2
Senior Member
Registered: Feb 2003
Location: The Real Washington
Distribution: Debian, Android
Posts: 1,819

Rep: Reputation: 46
iptables -A INPUT -p tcp -s ! -sport 80 -j DROP

What this does is to drop all packets from sources that are not

I think that is close. I know using the "!" in front of a normal rule means everything except what ever follows it. Run a search here for example scripts. I am sure someone has an anti rule in one of them..
Old 03-07-2003, 04:45 AM   #3
LQ Newbie
Registered: May 2002
Location: Ireland
Posts: 5

Original Poster
Rep: Reputation: 0
Worked great - Thanks!


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I block all traffic to port 110 to and IP using IPtables? abefroman Linux - Networking 8 11-16-2005 07:26 PM
DESPERATE : Iptables block users by MAC address. ranjan303 Linux - Security 28 03-29-2005 01:15 AM
iptables, block port 80? frank2 Linux - Security 4 09-12-2004 09:14 AM
iptables : how do I block inbound traffic from one ip address only? Apollo77 Linux - Security 7 03-22-2004 10:22 AM
Block incoming port Iptables cli_man Linux - Networking 5 08-11-2003 08:32 PM > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 07:47 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration