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 03-24-2003, 03:16 AM   #1
ratty007
LQ Newbie
 
Registered: Mar 2003
Posts: 16

Rep: Reputation: 0
opening port, newb alert :)


heres my fw script, im trying to get ssl/irc/linknet working so i need port 113 let thru for identd. any solutions to help out a linux newbie ?








#!/bin/sh
### set up NAT host masquerading on eth0
iptables -t nat -A POSTROUTING -s 10.4.20.0/24 -o eth0 -j MASQUERADE
iptables -N block
iptables -F block
# allow localhost network access
iptables -A block -i lo -p all -j ACCEPT
iptables -A block -o lo -p all -j ACCEPT
# allow established and related conections from outside
iptables -A block -m state --state ESTABLISHED,RELATED -j ACCEPT
# allow all connections on all interfaces EXCEPT eth0 (external)
iptables -A block -m state --state NEW -i ! eth0 -j ACCEPT
# allow inbound FTP, SSH, HTTP
iptables -A block -p tcp --dport http -j ACCEPT
iptables -A block -p tcp --dport ftp -j ACCEPT
iptables -A block -p tcp --dport ssh -j ACCEPT
# drop everything else
iptables -A block -j DROP
# apply block filter to INPUT
iptables -A INPUT -j block
echo "1" >> /proc/sys/net/ipv4/ip_forward



thx in advance, great board btw.

Last edited by ratty007; 03-24-2003 at 03:18 AM.
 
Old 03-24-2003, 09:21 AM   #2
Capt_Caveman
Senior Member
 
Registered: Mar 2003
Distribution: Fedora
Posts: 3,658

Rep: Reputation: 69
1. You've got "block" in there instead of the chain, which should be either INPUT, OUTPUT, FORWARD. You've also used it in the target as well, which I think should be DROP or REJECT.

2. You need some prerouting rules. Something like:
iptables -A PREROUTING -t nat -d firewallsaddress -p tcp --dport X -j DNAT --to-destination 10.4.20.0
Where X is the port you want to forward.

3. It's hard to decipher your rules, but you'll need some forwarding rules in there as well. Something like:
iptables -A FORWARD -i eth0 -o eth1 -p tcp --dport 80 -m state NEW,RELATED -j ACCEPT
iptables -A FORWARD -i eth1 -o eth0 -j ACCEPT

Try making those changes and see if that works. If not then post your modified rules.
 
Old 03-24-2003, 10:38 AM   #3
Capt_Caveman
Senior Member
 
Registered: Mar 2003
Distribution: Fedora
Posts: 3,658

Rep: Reputation: 69
Just realized that you did a user defined chain (iptables -N block). That makes alot more sense now. That should work for the INPUT rules, but you need to add the PREROUTING and FORWARD rules to masquerade.
 
  


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
Opening Port steve007 Linux - Newbie 5 07-23-2005 01:05 PM
opening a port Robin01 Linux - General 3 11-17-2004 10:40 PM
Opening a Port gpamkenny Linux - Networking 3 11-04-2004 02:51 PM
snort not logging port scans? Should I use log or alert? lucastic Linux - Security 3 08-30-2004 04:34 AM
Opening port 80 nmoog Linux - Newbie 4 02-01-2004 04:00 PM

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

All times are GMT -5. The time now is 08:53 PM.

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