LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 06-19-2002, 03:09 AM   #1
khaapala
LQ Newbie
 
Registered: Jun 2002
Location: Finland
Distribution: RedHat-7.3, SuSE-8.0
Posts: 9

Rep: Reputation: 0
Cool iptables


Hi all.

I have little problem with my Redhat 7.3 machine.
I try to make my linux box that allows internet sharing
to my local-network.

I use iptables and here is what i do.
I type this line:
#iptables -t nat -A postrouting -o eth0 -j MASQUERADE

and it gives me this:
iptables: No chain/target/match by that name

what is wrong ?? Same command works at my
friend computer.

Thanks

-- Krisse
 
Old 06-19-2002, 08:51 AM   #2
kahuna
Member
 
Registered: Jun 2002
Location: Grand Rapids, MI
Distribution: Redhat, Slackware
Posts: 78

Rep: Reputation: 15
Do you have the NAT chain set up in your kernel?
 
Old 06-20-2002, 03:03 AM   #3
mqe
LQ Newbie
 
Registered: Jun 2002
Location: Finland
Distribution: Debian
Posts: 6

Rep: Reputation: 0
Cool Iptables Sample Firewall Generator

You might want to check out something what is on:
http://www.citadec.com/FirewallGenerator.html

It seems to be a Java applet what asks some questions and generates a firewall shellscript from your selections. (it has masq option also)

Its good to read what it does, but it helps to get started.
 
Old 06-20-2002, 05:58 AM   #4
peter_robb
Senior Member
 
Registered: Feb 2002
Location: Szczecin, Poland
Distribution: Gentoo, Debian
Posts: 2,458

Rep: Reputation: 48
A couple of things...

Try using caps
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

2nd thing, MASQUERADE needs to be allowed in your kernel.

3rd thing, don't MASQUERADE on a nic with a static address. Better to -j SNAT --to-source xxx.xxx.xxx.xxx
MASQUERADE takes a whole heap of CPU time locating your ip address for each connection. It was designed for dynamic numbers.

Regards,
Peter.
 
Old 06-20-2002, 12:07 PM   #5
Noerr
Member
 
Registered: May 2002
Location: Dalec, HU
Distribution: Redhat 7.3
Posts: 696

Rep: Reputation: 30
4th thing module for iptables must surely be loaded (modprobe)
5th thing goto www.linuxguruz.org/iptables -for firewall examples
6th thing in iptables you need minimum of three entries for sharing
..check this example
echo "1" > /proc/sys/net/ipv4/ip_forward
iptables -P FORWARD DROP
iptables -A FORWARD -s $localnet/24 -j ACCEPT
iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -t nat -A POSTROUTING -s $localnet/24 -j SNAT --to $ipofIneteth

(localnet=192.168.1.0 -for example)
ipofIneteth=123.123.123.123 -your external ip
if you have dhcp use last line like this
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE (if eth0 is your outgoing device)
 
  


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
An error occured getting IPtables status from the command /etc/rc.d/init.d/iptables s CrazyMAzeY Linux - Newbie 10 08-12-2010 05:25 AM
Iptables - Couldn't load target `ACCPET':/lib/iptables/libipt_ACCPET.so: z00t Linux - Security 3 01-26-2004 02:24 AM
IPtables Log Analyzer from http://www.gege.org/iptables/ brainlego Linux - Software 0 08-11-2003 06:08 AM
iptables book wich one can you pll recomment to be an iptables expert? linuxownt Linux - General 2 06-26-2003 04:38 PM
My iptables script is /etc/sysconfig/iptables. How do i make this baby execute on boo ForumKid Linux - General 3 01-22-2002 07:36 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

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