View previous topic :: View next topic |
Author |
Message |
linderox n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
Joined: 03 Jun 2007 Posts: 41
|
Posted: Fri Nov 23, 2007 9:55 am Post subject: different iptables rules in config file and $ipbables -L |
|
|
I have Gentoo router.there is a problem that i don't know where to find config file for my iptables, i know some places,but
all tables in this configs have no any similarity with a comand iptables -L
I found several files
/etc/init.d/iptables #run script
/etc/conf.d/iptbales # here there is a line
IPTABLES_SAVE="/var/lib/iptables/rules-save"
/var/lib/iptables/rules-save
Code: |
# Generated by iptables-save v1.2.11 on Tue May 10 08:06:58 20ccept all from localhost
-A INPUT -s 127.0.0.1 -j ACCEPT
# accept all previously established connections
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p TCP -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p UDP -m state --state RELATED,ESTABLISHED -j ACCEPT
# ssh
-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
# ftp / webserver related
-A INPUT -p tcp -m state --state NEW -m tcp --dport 20 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 21 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 443 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 5190 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 25 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dpoer 110 -j ACCEPT
# Windows / Samba
-A INPUT -p tcp -m state --state NEW -m tcp --dport 137:139 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 426 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 445 -j ACCEPT
# up to 5 Bit-torrent connections
-A INPUT -p tcp -m state --state NEW -m tcp --dport 6881:6886 -j ACCEPT
# reject everything else
-A INPUT -j REJECT --reject-with icmp-port-unreachable
COMMIT
|
here is a comand
Code: |
$iptables -L
Chain INPUT (policy DROP)
target prot opt source destination
ACCEPT all -- anywhere anywhere
ACCEPT all -- anywhere anywhere
ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
ACCEPT tcp -- anywhere anywhere tcp dpt:smtp
ACCEPT tcp -- anywhere anywhere tcp dpt:ssh
Chain FORWARD (policy DROP)
target prot opt source destination
ACCEPT tcp -- 10.0.3.0/24 anywhere tcp dpt:20003
ACCEPT all -- server.vodoline.loc anywhere
ACCEPT all -- 10.0.3.3 anywhere
ACCEPT all -- anywhere 10.0.3.0/24 state RELATED,ESTABLISHED
ACCEPT icmp -- 10.0.3.0/24 anywhere
ACCEPT tcp -- 10.0.3.0/24 anywhere tcp dpt:https
ACCEPT tcp -- 10.0.3.0/24 anywhere tcp dpt:aol
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
$iptables -L
|
another one
Code: |
$rc-update -s | grep ipt
iptables |
|
|
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
Sadako Advocate
![Advocate Advocate](/images/ranks/rank-G-1-advocate.gif)
![](images/avatars/2074682074aea79062b33b.jpg)
Joined: 05 Aug 2004 Posts: 3792 Location: sleeping in the bathtub
|
Posted: Fri Nov 23, 2007 10:24 am Post subject: |
|
|
Simply use iptable-save rather than iptables -L to get the rules that would be used in a config file. _________________ "You have to invite me in" |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
linderox n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
Joined: 03 Jun 2007 Posts: 41
|
Posted: Fri Nov 23, 2007 10:29 am Post subject: |
|
|
read topic more attentivly!
I know that it is easy... and i want to use this way,but how if run script doesn't use this file
I told that in rules-save rules different then now is working!
and i dont know where to find file to edit rules! Look higher!!!! |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
Sadako Advocate
![Advocate Advocate](/images/ranks/rank-G-1-advocate.gif)
![](images/avatars/2074682074aea79062b33b.jpg)
Joined: 05 Aug 2004 Posts: 3792 Location: sleeping in the bathtub
|
Posted: Fri Nov 23, 2007 10:49 am Post subject: |
|
|
I'm still not sure what you're problem is, so I'll try to describe how it works.
/etc/init.d/iptables is the script which starts and stops iptables (basically loads or flushes the rules).
/etc/conf.d/iptables is the file which stores certain variables used by the script in init.d, including which file to store the rules in (IPTABLES_SAVE).
This is what I think you are failing to grasp; all the configuaration files in /etc/conf.d are automatically sourced by the corresponding scripts in /etc/init.d.
The best way to manipulate this is to add or remove the rules you want manually, via `iptables -A` or whatever, and then running `/etc/init.d/iptables save` will save them to the IPTABLES_SAVE file for you.
You can of course edit the IPTABLES_SAVE file manually too. _________________ "You have to invite me in" |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
Dagger Retired Dev
![Retired Dev Retired Dev](/images/ranks/rank-retired.gif)
![](images/avatars/28177677446e8e74b25aff.jpg)
Joined: 11 Jun 2003 Posts: 765 Location: UK
|
Posted: Fri Nov 23, 2007 2:23 pm Post subject: |
|
|
from what I can see there you have 2 different sets of rules. One was created my /etc/ini.d/iptables save and it's located in /var/lib/iptables/rules-save (and it is NOT in use now) and the other one had to be added manually or initiated by external script (which IS loaded - you can see it with iptables -L).
I would check rc-update show to check what is starting automatically and check /etc/conf.d/local.start
btw
using !!! and rude answers are not the best way to treat people who are trying to help you... _________________ 95% of all computer errors occur between chair and keyboard (TM)
Join the FSF as an Associate Member!
Post under CC license. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
linderox n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
Joined: 03 Jun 2007 Posts: 41
|
Posted: Fri Nov 23, 2007 6:35 pm Post subject: |
|
|
I know that there are 2 ways to add rule.
But when system starting after restarting they taking rules from some other place and i want to know from which, cause when i'm editing IPTABLES_SAVE it doesn't work aftrer reboot!
there are no anything inside /etc/conf.d/local.start and local.stop |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
Dagger Retired Dev
![Retired Dev Retired Dev](/images/ranks/rank-retired.gif)
![](images/avatars/28177677446e8e74b25aff.jpg)
Joined: 11 Jun 2003 Posts: 765 Location: UK
|
Posted: Sat Nov 24, 2007 12:00 pm Post subject: |
|
|
please post your rc-update show _________________ 95% of all computer errors occur between chair and keyboard (TM)
Join the FSF as an Associate Member!
Post under CC license. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
linderox n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
Joined: 03 Jun 2007 Posts: 41
|
Posted: Mon Nov 26, 2007 8:02 am Post subject: |
|
|
Thank you for everybody! The place was there:
/etc/runlevels/default/fwsetup
There is a link to a firewall script! |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
|