请教:关于iptables。谢谢!

上网、浏览、聊天、下载等
头像
白鳍豚
帖子: 2356
注册时间: 2009-01-19 23:03

请教:关于iptables。谢谢!

#1

帖子 白鳍豚 » 2009-10-17 17:01

在网上淘到的脚本
请教该如何修改成以下几个程序能用?谢谢!
1、可以浏览网页,可以收发邮件,可以用DownThemAll下载
2、电驴mldonkey可以用
3、Pidgin MSN 飞信 QQ都能用

代码: 全选

#!/bin/bash

# This is a script

# Edit by liwei

# establish a static firewall



# define const here

Open_ports="80 25 110 4662 10" # 自己机器对外开放的端口

Allow_ports="53 4662" # internet的数据可以进入自己机器的端口

# Open_ports="4662 10" # 自己机器对外开放的端口

# Allow_ports="4662 443 80 21" # internet的数据可以进入自己机器的端口


#init

iptables -F

iptables -X

iptables -t nat -F

iptables -t nat -X

# The follow is comment , for make it better
# iptables -P INPUT DROP

iptables -A INPUT -i ! eth0 -j ACCEPT


# define ruler so that some data can come in.
echo "设置允许端口"

for Port in $Allow_ports ; do
iptables -A INPUT -i eth0 -p tcp --sport $Port -j ACCEPT -v
iptables -A INPUT -i eth0 -p udp --sport $Port -j ACCEPT -v
done

echo "设置开放端口"

for Port in $Open_ports ; do
iptables -A INPUT -i eth0 -p tcp --dport $Port -j ACCEPT -v
iptables -A INPUT -i eth0 -p udp --dport $Port -j ACCEPT -v
done

# This is the last ruler , it can make you firewall better
# iptables -A INPUT -i eth0 -p tcp -j REJECT --reject-with tcp-reset -v
# iptables -A INPUT -i eth0 -p udp -j REJECT --reject-with icmp-port-unreachable -v
上次由 白鳍豚 在 2009-10-17 17:14,总共编辑 1 次。
头像
白鳍豚
帖子: 2356
注册时间: 2009-01-19 23:03

Re: 请教:关于iptables

#2

帖子 白鳍豚 » 2009-10-17 17:03

另外,10端口是干嘛用的
放狗没有找到关于10的详细说明
浏览网页,可以收发邮件 Open_ports="80 25 110 "Allow_ports="53"?
头像
白鳍豚
帖子: 2356
注册时间: 2009-01-19 23:03

Re: 请教:关于iptables

#3

帖子 白鳍豚 » 2009-10-17 17:07

Open_ports=4662 Allow_ports=4662(还是4672?)电驴?
头像
白鳍豚
帖子: 2356
注册时间: 2009-01-19 23:03

Re: 请教:关于iptables

#4

帖子 白鳍豚 » 2009-10-17 17:09

不加20 21 应该可以下载网上ftp里面的东东吧?加了就是可以开通给别人下载,不知道对不对?
头像
白鳍豚
帖子: 2356
注册时间: 2009-01-19 23:03

Re: 请教:关于iptables。谢谢!

#5

帖子 白鳍豚 » 2009-10-17 17:17

netstat-nat :em06 :em04
头像
白鳍豚
帖子: 2356
注册时间: 2009-01-19 23:03

Re: 请教:关于iptables。谢谢!

#6

帖子 白鳍豚 » 2009-10-17 17:31

8080 1863貌似是皮筋用的
头像
白鳍豚
帖子: 2356
注册时间: 2009-01-19 23:03

Re: 请教:关于iptables。谢谢!

#7

帖子 白鳍豚 » 2009-10-17 17:35

貌似pacman要21和38001
顺便Syu
头像
白鳍豚
帖子: 2356
注册时间: 2009-01-19 23:03

Re: 请教:关于iptables。谢谢!

#8

帖子 白鳍豚 » 2009-10-17 17:39

本地N多随机端口? :em20 :em20
头像
白鳍豚
帖子: 2356
注册时间: 2009-01-19 23:03

Re: 请教:关于iptables。谢谢!

#9

帖子 白鳍豚 » 2009-10-17 18:39

那位大大帮忙解释解释
先谢了
头像
白鳍豚
帖子: 2356
注册时间: 2009-01-19 23:03

Re: 请教:关于iptables。谢谢!

#10

帖子 白鳍豚 » 2009-10-18 17:48

再盖一层楼
头像
cnkilior
论坛版主
帖子: 4984
注册时间: 2007-08-05 17:40

Re: 请教:关于iptables。谢谢!

#11

帖子 cnkilior » 2009-10-19 1:03

开80端口干什么?你以为浏览网页要这个端口?开http服务才要的。
头像
白鳍豚
帖子: 2356
注册时间: 2009-01-19 23:03

Re: 请教:关于iptables。谢谢!

#12

帖子 白鳍豚 » 2009-10-19 14:20

回楼上,不懂才问 :em06
网上淘到的说没开80端口,浏览不了网页
头像
白鳍豚
帖子: 2356
注册时间: 2009-01-19 23:03

Re: 请教:关于iptables。谢谢!

#13

帖子 白鳍豚 » 2009-10-20 0:09

再盖一层
头像
hcym
帖子: 15634
注册时间: 2007-05-06 2:46

Re: 请教:关于iptables。谢谢!

#14

帖子 hcym » 2009-10-20 0:18

iptables

你没搜到地方吧,我以前用过,太强悍

出岔可能封死自己进不了系统

用gufw吧,就你这用途应该满足
头像
白鳍豚
帖子: 2356
注册时间: 2009-01-19 23:03

Re: 请教:关于iptables。谢谢!

#15

帖子 白鳍豚 » 2009-10-20 8:29

ufw一直在用。只是想用iptables
搜索结果太多,解释多样化,看得眼花了
还是周末自己上虚拟机折腾算了
水平菜,折腾才是正道 :em06
回复