LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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 10-02-2003, 02:31 AM   #1
arrruken
Member
 
Registered: Apr 2003
Distribution: gentoo
Posts: 238

Rep: Reputation: 32
iptables and NAT


ok, i dont like posting without research beforehand, but i cant find any basic tutorials on this. I have a Gentoo box with two nic's. It is gonna be the router for my network among other things. eth0 is connected directly to my DSL modem, and the modem is forwarding all ports to eth0. eth1 is going to a switch, which two other pc's are connected to.
setup:
dsl modem(192.168.1.254) ----> eth0(192.168.1.100)<Linux>-----

--->eth1(192.168.0.1)--->switch------->pc(192.168.0.10)
|------------------->pc(192.168.0.11)

iptables is supported by the kernel, and is loaded.
ip forwarding is enabled. eth1 is set as the default gateway for the pc's. i cant start iptables because there are no rules. i need to know exactly which files to add and modify so that iptables has a basis to start. i dont care about any firewall functions right now. Just NAT and ip masquerading so that the pc's can connect to the net. There is no rc.d directory on gentoo or rc.local. the problem is every tutorial is for red hat(ugh).the only iptables config files are in /etc/init.d and /etc/conf.d. the iptables program is in /sbin/iptables along with iptables-restore and iptables-save.
so again, the thing i need to know is where are the config files i need to add and modify, and what are basic commands i need to add to set up NAT and ip masquerading. basic meaning forwarding all ports to and from eth0 to eth1. thanks
 
Old 10-02-2003, 08:10 AM   #2
arrruken
Member
 
Registered: Apr 2003
Distribution: gentoo
Posts: 238

Original Poster
Rep: Reputation: 32
doesnt anyone know?
 
Old 10-02-2003, 09:06 AM   #3
ivanatora
Member
 
Registered: Sep 2003
Location: Bulgaria
Distribution: Ubuntu 9.10, FreeBSD 7.2
Posts: 459

Rep: Reputation: 32
There aren't config files for iptables, I think.. and you wont make it only with few 'basic commands'. I suggest you to read the '$ man iptables' carefully, and especially the MASQUERADING section.. there's a MASQ-HOWTO in your documentation directory, too. Read it, there are a lot of useful things.
Here's the 'basic command' that you could explore:
Code:
iptables -A FORWARD -i eth0 -o eth1 -m state --state ESTABLISHED,RELATED 
iptables -A FORWARD -i eth1 -o eth0 -j ACCEPT
iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE
 
Old 10-02-2003, 09:44 AM   #4
arrruken
Member
 
Registered: Apr 2003
Distribution: gentoo
Posts: 238

Original Poster
Rep: Reputation: 32
thanks but i cant use commands until iptables is working. it is set to run at boot, and when it tries it says it cant start, there is no rules, create some rules first. so i need to know which files are need and why it wont start. but thx anyway
 
Old 10-02-2003, 10:18 AM   #5
Blindsight
Member
 
Registered: Mar 2003
Distribution: Slackware
Posts: 234

Rep: Reputation: 30
iptables

ivanatora is indeed right. There are no config files for iptables. However, there are two programs called iptables-save and iptables-restore. iptables-save outputs a config type file that's really just a cat of your iptable rules with some extra schtuff in it like packet counters and whatnot.
It's fine if iptables' startup in Gentoo shiz's the bed. It doesn't mean iptables won't work. It only means the saved iptables-save file didn't load on startup. You can still use the rules ivanatora suggested to setup ip masq by typing those rules, just as he/she/it suggested.
 
Old 10-02-2003, 12:48 PM   #6
Bambi
Newbie
 
Registered: Aug 2003
Location: Toronto, Canada
Distribution: RedHat
Posts: 13

Rep: Reputation: 0
you said
"i cant start iptables because there are no rules."

is this true?
 
Old 10-02-2003, 08:25 PM   #7
arrruken
Member
 
Registered: Apr 2003
Distribution: gentoo
Posts: 238

Original Poster
Rep: Reputation: 32
yes right now, there was something wrong with my kernel and what i was trying to do. its being worked on now.
 
Old 10-02-2003, 08:28 PM   #8
ehdwuld
Member
 
Registered: Jul 2003
Distribution: Currently Suse 11.1 but have RH7,8,9 / Fedora 7,8_64,9_64,&10_64
Posts: 634

Rep: Reputation: 30
http://www.linux-sxs.org/security/ip...-tutorial.html
 
Old 10-03-2003, 04:17 AM   #9
arrruken
Member
 
Registered: Apr 2003
Distribution: gentoo
Posts: 238

Original Poster
Rep: Reputation: 32
thx but in the end it boiled down to iptables not working right, not my config. no matter what, me or to a greater extent, blindsight, through ssh,who posted up there, tried to do, iptables would not work. it was not a simple config problem. iptables was just jacked up. in the end i decided to ditch gentoo in favor of a distro i know better, slackware. now i know this wasnt gentoo's fault, but it got kicked to the curb anyway. its too bad because i actually liked it alot, it was faster than any distro ive ever tried and everything was fine except iptables. but i have been workin on gettin everything set up the way i like it for a week straight. and thats just too long. maybe ill try gentoo again once i know iptables a little better, exactly what the kernel needs to support, and what dependencies it has on other programs/services. for those of you not understanding me, try out gentoo...
 
  


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
IPTables 1:1 NAT Garak Linux - Security 13 12-19-2011 05:03 PM
iptables nat kernelvn Linux - Networking 5 05-03-2005 11:39 AM
IPTABLES : build NAT using IPTABLES joseph Linux - Networking 4 04-23-2004 05:08 AM
iptables NAT issue. onina Linux - Networking 1 02-26-2003 04:58 AM
IPtables +NAT daromer Linux - Networking 1 01-07-2002 11:15 AM

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

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