LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 02-01-2004, 07:03 PM   #1
john8675309
Member
 
Registered: Oct 2003
Location: Spencer, Iowa
Distribution: Slackware (of course)
Posts: 67

Rep: Reputation: 16
iptables prevent some allow some


I am trying to learn iptables and I have a question I am sure is simple but I can't figure it out:

I need to deny all internet traffic from eth1 <- internal to eth0 <-Internet
but I want to allow port 80 and port 443

how can this be accomplished?

thanks,
John
 
Old 02-01-2004, 07:17 PM   #2
qwijibow
Guru
 
Registered: Apr 2003
Location: nottingham england
Distribution: Gentoo
Posts: 2,672

Rep: Reputation: 47
those questions are answered in the manual page.

man iptables.
 
Old 02-01-2004, 07:40 PM   #3
john8675309
Member
 
Registered: Oct 2003
Location: Spencer, Iowa
Distribution: Slackware (of course)
Posts: 67

Original Poster
Rep: Reputation: 16
Does anyone have an answer
 
Old 02-01-2004, 08:40 PM   #4
german
Member
 
Registered: Jul 2003
Location: Toronto, Canada
Distribution: Debian etch, Gentoo
Posts: 312

Rep: Reputation: 30
log in, and type "man iptables". what you want to do is explained in detail there.

HTH

B.
 
Old 02-01-2004, 10:33 PM   #5
YMHiK
LQ Newbie
 
Registered: Jan 2004
Distribution: Slackware 2.6.5, Slackware 2.6.4, RedHat 9 2.4.20-8
Posts: 23

Rep: Reputation: 15
Though I'm no expert in iptables, this may do the trick:
iptables -A FORWARD -i eth1 -o eth0 -p tcp --destination-port ! 80 -j DROP
iptables -A FORWARD -i eth1 -o eth0 -p tcp --destination-port ! 443 -j DROP

This is an example for tcp protocol.
 
Old 02-02-2004, 03:36 AM   #6
qwijibow
Guru
 
Registered: Apr 2003
Location: nottingham england
Distribution: Gentoo
Posts: 2,672

Rep: Reputation: 47
iptables -A FORWARD -i eth1 -o eth0 -p tcp --destination-port ! 80 -j DROP
iptables -A FORWARD -i eth1 -o eth0 -p tcp --destination-port ! 443 -j DROP

i think he wanted to allow those ports, not drop them.
 
Old 02-02-2004, 10:38 AM   #7
YMHiK
LQ Newbie
 
Registered: Jan 2004
Distribution: Slackware 2.6.5, Slackware 2.6.4, RedHat 9 2.4.20-8
Posts: 23

Rep: Reputation: 15

It will drop any packet going to any port except to 80 and 443( notice ! .. not operator).
Moreover, you may need to put REJECT in place of DROP if you want.

Last edited by YMHiK; 02-02-2004 at 10:39 AM.
 
  


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
Help to prevent a divorce!!! Paulsuk Linux - Software 5 11-20-2005 02:24 AM
How can I prevent forkbombs? DaneM Linux - Security 7 06-30-2005 09:48 PM
how to prevent Bogons ? basbosco Linux - Security 5 03-01-2004 10:35 PM
How to prevent the bogons? basbosco Linux - Security 1 03-01-2004 02:22 PM
prevent an IP to get out? jimval7 Linux - Security 16 05-09-2003 09:58 AM


All times are GMT -5. The time now is 03:16 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