免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
12下一页
最近访问板块 发新帖
查看: 2082 | 回复: 19
打印 上一主题 下一主题

[网络管理] Running Iptables in linux [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2005-04-10 09:19 |只看该作者 |倒序浏览
i write my configuration of iptables in the directory of /etc/sysconfig/iptables

1.1 Internet Configuration.
#

INET_IP="194.236.50.155"
INET_IFACE="eth0"
INET_BROADCAST="194.236.50.255"





When i use the command of /etc/rc.d/init.d/ iptables start, there is error shows: bad argument: NET_IP="194.236.50.155".

How can I slove it, please help me.

Cheers.

论坛徽章:
0
2 [报告]
发表于 2005-04-10 09:37 |只看该作者

Running Iptables in linux

If someone know the IPtables, please help me.

since I am in the lab, i can not type chinese. so......

论坛徽章:
0
3 [报告]
发表于 2005-04-10 10:09 |只看该作者

Running Iptables in linux

After i write the iptable configure file, how can i run it?

论坛徽章:
1
荣誉版主
日期:2011-11-23 16:44:17
4 [报告]
发表于 2005-04-10 10:10 |只看该作者

Running Iptables in linux

  1. chmod u+x
  2. ./file
复制代码

论坛徽章:
0
5 [报告]
发表于 2005-04-10 10:19 |只看该作者

Running Iptables in linux

chmod u+x iptables
./iptables

It can not run..

how can i run it?

论坛徽章:
0
6 [报告]
发表于 2005-04-10 10:27 |只看该作者

Running Iptables in linux

show your /etc/sysconfig/iptables please
tell me how you configured your iptables

论坛徽章:
0
7 [报告]
发表于 2005-04-10 10:32 |只看该作者

Running Iptables in linux

#
# 1.1 Internet Configuration.
#

INET_IP="192.101.79.2"
INET_IFACE="eth0"
INET_BROADCAST="192.101.79.255"

# 1.2 Local Area Network configuration.
LAN_IP="10.2.1.2"
LAN_IP_RANGE="10.2.1.0/24"
LAN_IFACE="eth1"
#
# 1.4 Localhost Configuration.

LO_IFACE="lo"
LO_IP="127.0.0.1"
#
# 1.5 IPTables Configuration.
#
IPTABLES="/usr/sbin/iptables"
###########################################################################
#
# 2. Module loading.
#
/sbin/depmod -a
/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
###########################################################################
#
# 3. /proc set up.
#
echo "1" >; /proc/sys/net/ipv4/ip_forward
###########################################################################
#
# 4. rules set up.
#
######
# 4.1 Filter table
#
#
# 4.1.1 Set policies
#
$IPTABLES -P INPUT DROP
$IPTABLES -P OUTPUT DROP
$IPTABLES -P FORWARD DROP
#
# 4.1.2 Create userspecified chains
#
#
# Create chain for bad tcp packets
#
$IPTABLES -N bad_tcp_packets
#
# 4.1.3 Create content in userspecified chains
#
#
# bad_tcp_packets chain
#
$IPTABLES -A bad_tcp_packets -p tcp --tcp-flags SYN,ACK SYN,ACK \
-m state --state NEW -j REJECT --reject-with tcp-reset
$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
#
# 4.1.4 INPUT chain
#
#
# Bad TCP packets we don't want.
#
$IPTABLES -A INPUT -p tcp -j bad_tcp_packets
#
# Rules for special networks not part of the Internet
#
$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 UDP -i $LAN_IFACE --dport 67 --sport 68 -j ACCEPT
#



# Rules for incoming packets from the internet.
#
$IPTABLES -A INPUT -p ALL -d $INET_IP -m state --state ESTABLISHED,RELATED \
-j ACCEPT
$IPTABLES -A INPUT -m limit --limit 3/minute --limit-burst 3 -j LOG \
--log-level DEBUG --log-prefix "IPT INPUT packet died: "
#
# 4.1.5 FORWARD chain
#
#
# Bad TCP packets we don't want
#
$IPTABLES -A FORWARD -p tcp -j bad_tcp_packets
#
# Accept the packets we actually want to forward
#
$IPTABLES -A FORWARD -i $LAN_IFACE -j ACCEPT
$IPTABLES -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
#
# Log weird packets that don't match the above.
#
$IPTABLES -A FORWARD -m limit --limit 3/minute --limit-burst 3 -j LOG \
--log-level DEBUG --log-prefix "IPT FORWARD packet died: "
#
# 4.1.6 OUTPUT chain
#
#
# Bad TCP packets we don't want.
#
$IPTABLES -A OUTPUT -p tcp -j bad_tcp_packets
#
# Special OUTPUT rules to decide which IP's to allow
#
$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
#
# Log weird packets that don't match the above.
#
$IPTABLES -A OUTPUT -m limit --limit 3/minute --limit-burst 3 -j LOG \
--log-level DEBUG --log-prefix "IPT OUTPUT packet died: "
######
# 4.2 nat table
#
$IPTABLES -t nat -A POSTROUTING -o $INET_IFACE -j SNAT --to-source $INET_IP

论坛徽章:
0
8 [报告]
发表于 2005-04-10 10:44 |只看该作者

Running Iptables in linux

so long the shell is !
it's too difficult to read so long prog. . . (oh, not READ, that is TroubleShooting)
does it write by yourself ?
you'd better consummate it step by step.
you'd better know what you want first.

论坛徽章:
0
9 [报告]
发表于 2005-04-10 10:49 |只看该作者

Running Iptables in linux

it is basic configuration of iptables.

I can understand what i have written. but i do not what is the problem is.

论坛徽章:
0
10 [报告]
发表于 2005-04-10 10:54 |只看该作者

Running Iptables in linux

oh, insert "#! /bin/bash" at your shell first

and chmod 700 <shell name>;
./<shell name>;

or
# bash <shell name>;
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP