[root@comp ~]# iptables -A OUTPUT -p tcp -d 127.0.0.1 --dport 9101:9103 -j ACCEPT
[root@comp ~]# iptables -A OUTPUT -p tcp -d 127.0.0.1 --sport 9101:9103 -j ACCEPT
[root@comp ~]# iptables -A INPUT -p tcp -s 127.0.0.1 --sport 9101:9103 -j ACCEPT
[root@comp ~]# iptables -A INPUT -p tcp -s 127.0.0.1 --dport 9101:9103 -j ACCEPT
[root@comp ~]#
[root@ ~]#
[root@ ~]# iptables-save
# Generated by iptables-save v1.4.7 on Mon Jun 21 13:27:04 2010
*filter
:INPUT ACCEPT [4:898]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [2:294]
-A INPUT -f -j DROP
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -s 127.0.0.1/32 -p tcp -m tcp --sport 9101:9103 -j ACCEPT
-A INPUT -s 127.0.0.1/32 -p tcp -m tcp --dport 9101:9103 -j ACCEPT
-A FORWARD -f -j DROP
-A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT
-A OUTPUT -f -j DROP
-A OUTPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A OUTPUT -d 127.0.0.1/32 -p tcp -m tcp --dport 9101:9103 -j ACCEPT
-A OUTPUT -d 127.0.0.1/32 -p tcp -m tcp --sport 9101:9103 -j ACCEPT
COMMIT
# Completed on Mon Jun 21 13:27:04 2010
# Generated by iptables-save v1.4.7 on Mon Jun 21 13:27:04 2010
*mangle
:PREROUTING ACCEPT [14373:12875824]
:INPUT ACCEPT [14370:12875127]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [10759:2184227]
:POSTROUTING ACCEPT [10859:2197768]
COMMIT
# Completed on Mon Jun 21 13:27:04 2010
[root@comp ~]#
[root@comp ~]# ls /etc/sysconfig
anacronjobs clock framebuffer init keyboard lircd ntpd smartd xinetd
autofs console harddisk iptables klogd mouse openoffice.org syslogd xinitrc
bacula consolefont harddisks iptables_modules kvm mysqld openvpn system xrandr
bacula-fd dnsmasq httpd2 iptables_params limits network portmap usb xserver
bootsplash ethtool i18n kernel limits.d nfs rawdevices wpa_supplicant
[root@comp ~]#
[root@comp ~]# cat /etc/sysconfig/iptables
# iptables firewall config file in iptables-save format.
# DO NOT USE THE -t (table) OPTION IN THIS FILE!
[root@comp ~]# Запускаю:
[root@comp ~]# service iptables status
Table: filter
Chain INPUT (policy ACCEPT)
target prot opt source destination
DROP all -f anywhere anywhere
ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
ACCEPT tcp -- localhost.localdomain anywhere tcp spts:9101:9103
ACCEPT tcp -- localhost.localdomain anywhere tcp dpts:9101:9103
Chain FORWARD (policy ACCEPT)
target prot opt source destination
DROP all -f anywhere anywhere
ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
DROP all -f anywhere anywhere
ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
ACCEPT tcp -- anywhere localhost.localdomain tcp dpts:9101:9103
ACCEPT tcp -- anywhere localhost.localdomain tcp spts:9101:9103
Table: mangle
Chain PREROUTING (policy ACCEPT)
target prot opt source destination
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
Chain POSTROUTING (policy ACCEPT)
target prot opt source destination
[root@comp ~]#
В итоге:
[root@comp ~]# service iptables start
iptables firewall is not configured [PASSED]
[root@comp ~]#
Так работает iptables? И почему вообще пишет, что несконфигурирован файер???