LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Reply
 
Search this Thread
Old 02-26-2003, 11:30 AM   #1
macnanc
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?

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

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

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

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
macnanc
LQ Newbie
 
Registered: May 2002
Location: Ireland
Posts: 5

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


Reply


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


All times are GMT -5. The time now is 09:32 AM.

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