LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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
 
LinkBack Search this Thread
Old 07-08-2003, 02:00 PM   #1
Snabber
Member
 
Registered: Dec 2002
Posts: 76

Rep: Reputation: 15
IPCHAINS is acting weird


I'm having a problem with ipchains. I wrote a simple script to apply my required rules in testing and allow me to build on it. I set up rules to allow incoming ftp, ssh, epl (my own server for testing), www (http), time, finger, and telnet. eth1 is the internet. eth0 is my internel network. What I would like to do is allow all packets from eth0, and allow only ftp, ssh, www, epl, time, telnet, and finger from the internet (eth1). Here is my rules script:

# !/bin/sh
ipchains -F
ipchains -P input DENY
ipchains -A input -p tcp -i ! eth1 -j ACCEPT
ipchains -A input -p tcp -d 0/0 ftp -j ACCEPT
ipchains -A input -p tcp -d 0/0 20 -j ACCEPT
ipchains -A input -p tcp -d 0/0 ssh -j ACCEPT
ipchains -A input -p tcp -d 0/0 www -j ACCEPT
ipchains -A input -p tcp -d 0/0 epl -j ACCEPT
ipchains -A input -p tcp -d 0/0 time -j ACCEPT
ipchains -A input -p tcp -d 0/0 telnet -j ACCEPT
ipchains -A input -p tcp -d 0/0 finger -j ACCEPT
ipchains -A input -f -j ACCEPT

Sometimes, all interfaces are totally open, other times they are totally closed. ipchains was installed with redhat 7.2 when i got it. Thanks, Eric S.
 
Old 07-08-2003, 02:08 PM   #2
hakcenter
Member
 
Registered: Apr 2003
Location: Not to far from the computer screen
Distribution: RedHat 9.0
Posts: 324

Rep: Reputation: 30
iim gunna write it from scratch kk

if your doing this remotely...

ipchains -F
ipchains -P INPUT -j ACCEPT
ipchains -P FORWARD -j ACCEPT
ipchains -P OUTPUT -j ACCEPT

ipchains -A INPUT -m state --state INVALID -j DROP
ipchains -A FORWARD -m state --state INVALID -j DROP
ipchains -A OUTPUT -m state --state INVALID -j DROP

ipchains -A INPUT -i eth1 -p tcp --multiport --dport 20,21,22,80,epl,time,telnet,finger -j ACCEPT
ipchains -A INPUT -i eth0 -j ACCEPT
ipchains -A INPUT -j DROP

ipchains -A FORWARD -i eth0 -o eth1 -j ACCEPT
ipchains -A FORWARD -i eth1 -o eth0 -j ACCEPT
ipchains -A FORWARD -j DROP

ipchains -t nat -A POSTROUTING -o eth0 -j MASQUERADE
 
Old 07-08-2003, 04:00 PM   #3
Snabber
Member
 
Registered: Dec 2002
Posts: 76

Original Poster
Rep: Reputation: 15
That doesn't work either. Here is the output:
ipchains: -P requires a chain and a policy
Try `ipchains -h' or 'ipchains --help' for more information.
ipchains: Bad value `state' for -m.

Try `ipchains -h' or 'ipchains --help' for more information.
ipchains: Bad value `state' for -m.

Try `ipchains -h' or 'ipchains --help' for more information.
ipchains: Bad value `state' for -m.

Try `ipchains -h' or 'ipchains --help' for more information.
ipchains: unrecognized option `--multiport'
Try `ipchains -h' or 'ipchains --help' for more information.
ipchains: No target by that name
ipchains: No target by that name
ipchains: -o argument must be 0-65535, not `eth1'
Try `ipchains -h' or 'ipchains --help' for more information.
ipchains: -o argument must be 0-65535, not `eth0'
Try `ipchains -h' or 'ipchains --help' for more information.
ipchains: No target by that name
ipchains: -t requires 2 hexbyte arguments
Try `ipchains -h' or 'ipchains --help' for more information.

I have ipchains 1.3.10, 1-Sep-2000.
 
Old 07-08-2003, 04:07 PM   #4
hakcenter
Member
 
Registered: Apr 2003
Location: Not to far from the computer screen
Distribution: RedHat 9.0
Posts: 324

Rep: Reputation: 30
heh chains is too old for me, i been on iptables, sorry..

um, if its no consequence format and install rh9?
 
Old 07-08-2003, 04:37 PM   #5
Snabber
Member
 
Registered: Dec 2002
Posts: 76

Original Poster
Rep: Reputation: 15
sorry1 The hardware's too old Just be glad I'm not running 6.x!
 
Old 07-08-2003, 04:46 PM   #6
hakcenter
Member
 
Registered: Apr 2003
Location: Not to far from the computer screen
Distribution: RedHat 9.0
Posts: 324

Rep: Reputation: 30
well how old is your damn kernel? lol

update the kernel, get some iptables working
 
Old 07-08-2003, 05:23 PM   #7
unSpawn
Moderator
 
Registered: May 2001
Posts: 21,597
Blog Entries: 47

Rep: Reputation: 1409Reputation: 1409Reputation: 1409Reputation: 1409Reputation: 1409Reputation: 1409Reputation: 1409Reputation: 1409Reputation: 1409Reputation: 1409
I guess it's time to read the 'ol TLDP Ipchains HOWTO.
 
Old 07-08-2003, 06:57 PM   #8
Snabber
Member
 
Registered: Dec 2002
Posts: 76

Original Poster
Rep: Reputation: 15
I got 2.4.7-10. And I did read the howto. The commands just didn't work right.

Last edited by Snabber; 07-08-2003 at 06:58 PM.
 
Old 07-08-2003, 07:52 PM   #9
cuckoopint
Member
 
Registered: Feb 2003
Distribution: Debian
Posts: 797

Rep: Reputation: 30
If yo have 2.4 just recompile and get iptables working - a lot more to work with, IMO
 
Old 08-07-2003, 02:14 PM   #10
Snabber
Member
 
Registered: Dec 2002
Posts: 76

Original Poster
Rep: Reputation: 15
I got iptables working. However, it has the same problem. It cannot access the internet with DROP in place, except if I say to accept all RELATED and ESTABLISHED connections. Then it won't stealth any ports.
 
Old 08-07-2003, 02:18 PM   #11
Snabber
Member
 
Registered: Dec 2002
Posts: 76

Original Poster
Rep: Reputation: 15
Even if I tell it specifically to drop the port, it still accepts connections.
 
Old 08-08-2003, 10:07 AM   #12
hakcenter
Member
 
Registered: Apr 2003
Location: Not to far from the computer screen
Distribution: RedHat 9.0
Posts: 324

Rep: Reputation: 30
iptables -P INPUT -j ACCEPT
iptables -P FORWARD -j ACCEPT
iptables -P OUTPUT -j ACCEPT

iptables -A INPUT -m state --state INVALID -j DROP
iptables -A FORWARD -m state --state INVALID -j DROP
iptables -A OUTPUT -m state --state INVALID -j DROP

iptables -A INPUT -i eth1 -p tcp --multiport --dport 20,21,22,80,epl,time,telnet,finger -j ACCEPT
iptables -A INPUT -i eth0 -j ACCEPT
iptables -A INPUT -j DROP

iptables -A FORWARD -i eth0 -o eth1 -j ACCEPT
iptables -A FORWARD -i eth1 -o eth0 -j ACCEPT
iptables -A FORWARD -j DROP

iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

iptables -P INPUT DROP
iptables -P FORWARD DROP

where eth0 is your internet nic, and eth1 is your lan interface...
 
  


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
apache acting weird Red Squirrel Linux - Software 2 08-19-2005 08:47 PM
Networkcard is acting weird Rolby Linux - Hardware 2 06-26-2004 01:45 PM
Vi Editor acting weird thom Fedora 1 06-19-2004 01:15 PM
cdrom acting weird Vindane Slackware 5 05-30-2004 12:53 AM
apache acting weird... Red Squirrel Linux - Newbie 1 03-03-2004 08:29 PM


All times are GMT -5. The time now is 02:34 PM.

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