LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
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 12-23-2003, 06:22 PM   #1
fleshwound
LQ Newbie
 
Registered: Jul 2003
Location: Michigan, USA
Distribution: Slackware, Debian, Ubuntu. Fedora Core
Posts: 15

Rep: Reputation: 0
iptables problem


Does anyone know why after ive run my firewall script that I can no longer access anything through my external interface (eth0) on that machine... Everything else works fine. Connection sharing works fine, im able to connect the internet on my other machines that use it as a gateway...

Heres my script.

#!/bin/bash
#

IFACE_EXT="eth0"
IFACE_INT="eth1"

# Clear any previous iptables rules
iptables --flush
iptables --table nat --flush
iptables --delete-chain
iptables --table nat --delete-chain
echo "All Tables and Rules Cleared..."

# Default policies
iptables -P INPUT DROP
iptables -P FORWARD DROP
iptables -P OUTPUT ACCEPT
echo "Default Chain Policies Set..."

# Accept ssh connections on external interface
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
echo "Incoming SSH Connections Accepted..."

# Drop unwelcome connects
iptables -A INPUT -p tcp --syn -j DROP

# IP Masquerading
iptables -A FORWARD -i $IFACE_EXT -o $IFACE_INT -m state --state = ESTABLISHED,RELATED -j ACCEPT
iptables -A FORWARD -i $IFACE_INT -o $IFACE_EXT -j ACCEPT
iptables -A FORWARD -i $IFACE_INT -j ACCEPT
iptables -t nat -A POSTROUTING -o $IFACE_EXT -j MASQUERADE
echo "IP Masquerading Running..."

# Port forwarding
iptables -A FORWARD -p tcp -i $IFACE_EXT -j ACCEPT
echo "Port Forwarding Enabled..."

#Enable packet forwarding
echo 1 > /proc/sys/net/ipv4/ip_forward
echo "Packet Forwarding Enabled..."
 
Old 12-23-2003, 10:31 PM   #2
Kilka
Member
 
Registered: Sep 2003
Location: Canada
Distribution: Mandrake, Redhat, openBSD, Gentoo
Posts: 84

Rep: Reputation: 15
if I understand you correctly

Hey,

If I understand you correctly, you can see anything from your gateway itself, like you've ssh'd into it and can't ping anything from eth0 ?

your problem likely lies in this line

iptables -A INPUT -p tcp --syn -j DROP

try removing that line and see if it makes a difference.

-Kilka
 
Old 12-24-2003, 04:19 PM   #3
fleshwound
LQ Newbie
 
Registered: Jul 2003
Location: Michigan, USA
Distribution: Slackware, Debian, Ubuntu. Fedora Core
Posts: 15

Original Poster
Rep: Reputation: 0
Thats exactly what was the problem, thank you for ur help
 
Old 12-25-2003, 01:34 PM   #4
Kilka
Member
 
Registered: Sep 2003
Location: Canada
Distribution: Mandrake, Redhat, openBSD, Gentoo
Posts: 84

Rep: Reputation: 15
your welcome

-kilka
 
Old 12-27-2003, 03:26 PM   #5
fleshwound
LQ Newbie
 
Registered: Jul 2003
Location: Michigan, USA
Distribution: Slackware, Debian, Ubuntu. Fedora Core
Posts: 15

Original Poster
Rep: Reputation: 0
Based on the above script how would I open port 80 or other services on the router its self... Id like to be able to see my pages being served up using apache, but it seems I'm missing something and I cant view anything when trying to browse. The server is up... ssh seems to work... I tried using the same syntax used to open ssh but only on port 80 but still not working... any ideas.... also is there anything I could add to my script to help harden it... right now its pretty basic... id like to block all that bad stuff out there... any help as always is greatly appreciated..
 
Old 12-27-2003, 03:39 PM   #6
Kilka
Member
 
Registered: Sep 2003
Location: Canada
Distribution: Mandrake, Redhat, openBSD, Gentoo
Posts: 84

Rep: Reputation: 15
So you've got this:
iptables -A INPUT -p tcp --dport 80 -j ACCEPT

but still can't see anything through the router ? I would guess it's some setting in the router that you've got to change. Remember that dropping all other connections should always be the last thing you do.

-Kilka
 
Old 12-27-2003, 05:30 PM   #7
fleshwound
LQ Newbie
 
Registered: Jul 2003
Location: Michigan, USA
Distribution: Slackware, Debian, Ubuntu. Fedora Core
Posts: 15

Original Poster
Rep: Reputation: 0
Ya im still figuring all this iptables stuff out... so its a trial by error type thing for me... I have a suspission that its to do with apache... I just found out even though installed with apt-get its proccess not running when checked with ps -A. So ive downloaded the source and im compiling apache myself, well see if this works now...
 
  


Reply



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
problem iptables stomach Linux - Software 3 09-22-2005 02:21 PM
problem with iptables Israfel2000 Linux - Security 3 07-18-2004 12:30 AM
iptables problem bhagat_panwar Linux - Software 0 08-27-2003 06:45 AM
iptables problem? poulaum Linux - Networking 12 02-27-2003 03:57 PM
Problem with IPTABLES jfall Linux - Networking 3 11-04-2002 03:10 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 05:06 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration