您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息
免费发信息
三六零分类信息网 > 张家界分类信息网,免费分类信息发布

洞察关于Linux透明网关的配置

2023/7/9 2:56:19发布27次查看
当oracle配置多个透明关信息的时候我们就可以不用安装关软件,但是有很多朋友们不知道如何配置透明关,那么我们现在就去看看关于linux透明关的配置。旗胜站长目录
iptables -t nat -a postrouting -o eth0 -s 192.168.40.024 -j masquerade
echo "1" > procsysnetipv4ip_forward
iptables -f
iptables -x
iptables -z
iptables -f -t nat
iptables -x -t nat
iptables -z -t nat
iptables -p output accept
iptables -p forward accept
iptables -t nat -a postrouting -o ppp0 -s 192.168.0.024 -j masquerade
?
透明关
辛辛苦苦弄了两天,每天只睡5小时,才终于把linux的透明关弄好。不过不是所有时间都在研究这个东西,但也花了两天里面的大半时间在看这个,现在反而对防火墙的配置有了更进一步的了解,值得。先贴一下代码备查。
启动了iptables,没有启动squid,系统为linux as4
我自己建了个脚本,明天还得修改一下才能用到的关去。
? 1 echo "1">procsysnetipv4ip_forward
? 2
? 3 ext_if=ppp0
? 4 int_if=eth0
? 5 export ext_if
? 6 export int_if
? 7 #lan_ip_range="192.168.0.0255.255.255.0"
? 8 lan_ip_range="192.168.0.024"
? 9 static_ip="192.168.0.210"
10 export lan_ip_range
11 export static_ip
12
13 iptables -f
14 iptables -x
15 iptables -f -t mangle
16 iptables -x -t mangle
17 iptables -f -t nat
18 iptables -x -t nat
19 iptables -z -t nat
20
21 iptables -p input accept
22 iptables -p output accept
23 iptables -p forward accept
24
25 iptables -a forward -p tcp ! --syn -m state --state new -j log --log-prefix "new not syn:"
26 iptables -a forward -p tcp ! --syn -m state --state new -j drop
27
28 #iptables -t nat -a postrouting -o $ext_if -s $lan_ip_range -j snat --to-source $static_ip
29 iptables -t nat -a postrouting -o $ext_if -j masquerade
30
31
32 iptables -a forward -i $int_if -j accept
33 iptables -a forward -m state --state established,related -j accept
34 iptables -a forward -f -m limit --limit 100s --limit-burst 100 -j accept
35
36 iptables -a forward -p icmp -m limit --limit 1s --limit-burst 10 -j accept
37
38 iptables -a forward -p udp -d $lan_ip_range -i $ext_if -j accept
39
40 iptables -a output -o $ext_if -p tcp -s $static_ip --sport 1024:65535 -d any0 --dport 22 -j
accept
41 iptables -a input -i $ext_if -p tcp ! --syn -s any0 --sport 22 -d $static_ip --dport 1024:6
? 5535 -j accept
42
43
44 iptables -a output -o $ext_if -p tcp -s $static_ip --sport 1024:65535 -d any0 --dport 21 -j
accept
45 iptables -a input -i $ext_if -p tcp ! --syn -s any0 --sport 21 -d $static_ip --dport 1024:6
? 5535 -j accept
46
47
48 iptables -a output -o $ext_if -p tcp -s $static_ip --sport 1024:65535 -d any0 --dport 20 -j
accept
49 iptables -a input -i $ext_if -p tcp ! --syn -s any0 --sport 20 -d $static_ip --dport 1024:6
? 5535 -j accept
50
51 #iptables -t nat -a prerouting -i $ext_if
52 #iptables -t nat -a prerouting -i $ext_if -s 192.168.0.016 -j drop
53 #iptables -t nat -a prerouting -i $ext_if -s 10.0.0.08 -j drop
54 #iptables -t nat -a prerouting -i $ext_if -s 172.16.0.012 -j drop
55
56
57 echo $ext_if + $int_if + $lan_ip_range + $static_ip
58
透明关
上文中介绍了关于linux透明关的配置,关于linux的相关知识还很多,我们需要以后要多在实战项目中运用才能更好地体会。
张家界分类信息网,免费分类信息发布

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录