ALT Linux Community general discussions
 help / color / mirror / Atom feed
* [Comm] IPTABLES, разбор ошибок
@ 2003-09-29 19:54 unix9
  2003-09-30  3:09 ` Gosha
  2003-09-30  3:37 ` Mike Lykov
  0 siblings, 2 replies; 13+ messages in thread
From: unix9 @ 2003-09-29 19:54 UTC (permalink / raw)
  To: community

Я тут впервые настраиваю шлюз (файрволл и нат, на машине также есть почтовый сервер, днс-сервер и веб)

При запуске скрипта выходит такое сообщение

Bad argument `бродкастовый адрес'
Bad argument `ACCEPT'
Bad argument `ESTABLISHIED,RELATED'
Warning: wierd character in interface `eth0-j' (No aliases, :, ! or *).
Bad argument `tcp_packets'
Warning: wierd character in interface `eth0-j' (No aliases, :, ! or *).
Bad argument `udp_packets'
Bad argument `ACCEPT'

Знатоки подобных вещей объясните где я не прав?

Вот сам скрипт

#!/bin/sh
# Internet Configuration"
INET_IP="реальный адрес"
INET_IFACE="eth0"
INET_BROADCAST="бродкастовый адрес"


# LAN Configuration
LAN IP="192.168.100.6"
LAN_IP_RANGE="192.168.100.0/24"
LAN_BROADCAST_ADDRESS="192.168.100.250"
LAN_IFACE="eth1"

#Localhost Configuration

LO_IFACE="lo"
LO_IP="127.0.0.1"

#IPTABLES
IPTABLES="/sbin/iptables"


# Module loading
/sbin/modprobe ip_tables
/sbin/modprobe ip_conntrack
/sbin/modprobe iptable_filter
/sbin/modprobe iptable_mangle
/sbin/modprobe iptable_nat
/sbin/modprobe ipt_LOG
/sbin/modprobe ipt_limit
/sbin/modprobe ipt_state


# proc set up
#
#proc "1" > /proc/sys/net/ipv4/ip_forward


# Rules
$IPTABLES -P INPUT DROP
$IPTABLES -P OUTPUT DROP
$IPTABLES -P FORWARD DROP

# Create bad tcp packets
$IPTABLES -N bad_tcp_packets
$IPTABLES -N allowed
$IPTABLES -N tcp_packets
$IPTABLES -N udp_packets
$IPTABLES -N icmp_packets
$IPTABLES -A bad_tcp_packets -p tcp ! --syn -m state --state NEW -j LOG \
--log-prefix "New not syn:"
$IPTABLES -A bad_tcp_packets -p tcp ! --syn -m state --state NEW -j DROP
$IPTABLES -A allowed -p tcp --syn -j ACCEPT
$IPTABLES -A allowed -p tcp -m state --state ESTABLISHED, RELATED -j
ACCEPT
$IPTABLES -A allowed -p tcp -j DROP
# TCP Rules
$IPTABLES -A tcp_packets -p tcp -s 0/0 --dport 21 -j allowed 
$IPTABLES -A tcp_packets -p tcp -s 0/0 --dport 22 -j allowed
$IPTABLES -A tcp_packets -p tcp -s 0/0 --dport 80 -j allowed
$IPTABLES -A tcp_packets -p tcp -s 0/0 --dport 110 -j allowed
$IPTABLES -A tcp_packets -p tcp -s 0/0 --dport 113 -j allowed
# UDP ports
$IPTABLES -A udp_packets -p udp -s 0/0 --source-port 2074 -j ACCEPT
$IPTABLES -A udp_packets -p udp -s 0/0 --source-port 4000 -j ACCEPT
$IPTABLES -A udp_packets -p udp -i $INET_IFACE -d -d $INET_BROADCAST \
--destination-port 135:139 -j DROP
$IPTABLES -A udp_packets -p udp -i $INET_IFACE -d 255.255.255.255 \
--destination-port 67:68 -j DROP
# ISMP rules
$IPTABLES -A icmp_packets -p icmp -s 0/0 --icmp-type 8 -j ACCEPT
$IPTABLES -A icmp_packets -p icmp -s 0/0 --icmp-type 11 -J ACCEPT
$IPTABLES -A icmp_packets -p icmp -s 0/0 --icmp-type 0 -j ACCEPT
#INPUT chain
#BAD TCP packets
$IPTABLES -A INPUT -p tcp -j bad_tcp_packets 
#Rules for special
$IPTABLES -A INPUT -p ALL -i $LAN_IFACE -s $LAN_IP_RANGE -j ACCEPT
$IPTABLES -A INPUT -p ALL -i $LO_IFACE -s $LO_IP -j ACCEPT
$IPTABLES -A INPUT -p ALL -i $LO_IFACE -s $LAN_IP -j ACCEPT
$IPTABLES -A INPUT -p ALL -i $LO_IFACE -s $INET_IP -j ACCEPT
$IPTABLES -A INPUT -p ALL -i $LAN_IFACE -d $LAN_BROADCAST_ADDRESS -j
ACCEPT
#Rules for incoming from Internet
$IPTABLES -A INPUT -p ALL -d $INET_IP -m state ESTABLISHIED, RELATED \
-j ACCEPT 
$IPTABLES -A INPUT -p tcp -i $INET_IFACE-j tcp_packets
$IPTABLES -A INPUT -p udp -i $INET_IFACE-j udp_packets
$IPTABLES -A INPUT -p -i $INET_IFACE -d 224.0.0.0/8 -j DROP
#Log
$IPTABLES -A INPUT -m limit --limit 3/minute --limit-burst 3 -J LOG \
--log-level DEBUG --log-prefix "IPT INPUT packet died:"
#Forward chain
$IPTABLES -A FORWARD -p tcp -J bad_tcp_packets
$IPTABLES -A FORWARD -i $LAN_IFACE -j ACCEPT
$IPTABLES -A FORWARD -m state --state ESTABLISHIED, RELATED -j ACCEPT
#Log
$IPTABLES -A FORWARD -m limit --limit 3/minute --limit-burst 3 -j LOG \
--log-level DEBUG --log-prefix "IPT FORWARD packets died: "

#Badtcppacketswe don`t wont 
$IPTABLES -A OUTPUT -p ALL -s $LO_IP -j ACCEPT
$IPTABLES -A OUTPUT -p ALL -s $LAN_IP -j ACCEPT
$IPTABLES -A OUTPUT -p ALL -s $INET_IP -j ACCEPT
$IPTABLES -A OUTPUT -m limit --limit 3/minite --limit-burst 3 -j LOG \
--log-level DEBUG --log-prefix "IPT OUTPUT packet died: "
$IPTABLES -t nat -A POSTROUTING -o $INET_IFACE -j MASQUERADE
$IPTABLES -t nat -A POSTROUTING -s 192.168.100.0/24 --out-interface eth0 -j
SNAT --to-source $INET_IP



^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2003-09-30 18:39 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-09-29 19:54 [Comm] IPTABLES, разбор ошибок unix9
2003-09-30  3:09 ` Gosha
2003-09-30  3:14   ` Gosha
2003-09-30  3:37 ` Mike Lykov
2003-09-30  3:55   ` Gosha
2003-09-30  4:48     ` Mike Lykov
2003-09-30  6:55       ` Igor Solovyov
2003-09-30  6:28   ` [Comm] IPTABLES,разбор ошибок unix9
2003-09-30 14:02     ` unix9
2003-09-30 16:29       ` Igor Solovyov
2003-09-30 18:35         ` [Comm]IPTABLES,разбор ошибок unix9
2003-09-30 17:10       ` [Comm] IPTABLES,разбор ошибок Пирогов Алексей
2003-09-30 18:39         ` [Comm] IPTABLES,=?koi8-r?b?0sHaws/S?= ошибок unix9

ALT Linux Community general discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/community/0 community/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 community community/ http://lore.altlinux.org/community \
		mandrake-russian@linuxteam.iplabs.ru community@lists.altlinux.org community@lists.altlinux.ru community@lists.altlinux.com
	public-inbox-index community

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.community


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git