中文字幕在线观看,亚洲а∨天堂久久精品9966,亚洲成a人片在线观看你懂的,亚洲av成人片无码网站,亚洲国产精品无码久久久五月天

關(guān)于Linux透明網(wǎng)關(guān)的配置

2019-09-02    來源:愛站科技

容器云強勢上線!快速搭建集群,上萬Linux鏡像隨意使用

當(dāng)Oracle配置多個透明網(wǎng)關(guān)信息的時候我們就可以不用安裝網(wǎng)關(guān)軟件,但是有很多朋友們不知道如何配置透明網(wǎng)關(guān),那么我們現(xiàn)在就去看看關(guān)于Linux透明網(wǎng)關(guān)的配置。

iptables -t nat -A POSTROUTING -o eth0 -s 192.168.40.0/24 -j MASQUERADE

echo "1" > /proc/sys/net/ipv4/ip_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.0/24 -j MASQUERADE
?

透明網(wǎng)關(guān)

辛辛苦苦弄了兩天,每天只睡5小時,才終于把linux的透明網(wǎng)關(guān)弄好。不過不是所有時間都在研究這個東西,但也花了兩天里面的大半時間在看這個,現(xiàn)在反而對防火墻的配置有了更進一步的了解,值得。先貼一下代碼備查。

啟動了iptables,沒有啟動squid,系統(tǒng)為linux as4

我自己建了個腳本,明天還得修改一下才能用到公司的網(wǎng)關(guān)去。

????? 1 echo "1">/proc/sys/net/ipv4/ip_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.0/255.255.255.0"
????? 8 LAN_IP_RANGE="192.168.0.0/24"
????? 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 100/s --limit-burst 100 -j ACCEPT
???? 35
???? 36 iptables -A FORWARD -p icmp -m limit --limit 1/s --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 any/0 --dport 22 -j
???????? ACCEPT
???? 41 iptables -A INPUT -i $EXT_IF -p tcp ! --syn -s any/0 --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 any/0 --dport 21 -j
???????? ACCEPT
???? 45 iptables -A INPUT -i $EXT_IF -p tcp ! --syn -s any/0 --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 any/0 --dport 20 -j
???????? ACCEPT
???? 49 iptables -A INPUT -i $EXT_IF -p tcp ! --syn -s any/0 --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.0/16 -j DROP
???? 53 #iptables -t nat -A PREROUTING -i $EXT_IF -s 10.0.0.0/8 -j DROP
???? 54 #iptables -t nat -A PREROUTING -i $EXT_IF -s 172.16.0.0/12 -j DROP
???? 55
???? 56
???? 57 echo $EXT_IF + $INT_IF + $LAN_IP_RANGE + $STATIC_IP
???? 58
透明網(wǎng)關(guān)

上文中介紹了關(guān)于Linux透明網(wǎng)關(guān)的配置,關(guān)于Linux的相關(guān)知識還很多,我們需要以后要多在實戰(zhàn)項目中運用才能更好地體會。

標(biāo)簽: Linux 透明網(wǎng)關(guān)

版權(quán)申明:本站文章部分自網(wǎng)絡(luò),如有侵權(quán),請聯(lián)系:west999com@outlook.com
特別注意:本站所有轉(zhuǎn)載文章言論不代表本站觀點!
本站所提供的圖片等素材,版權(quán)歸原作者所有,如需使用,請與原作者聯(lián)系。

上一篇:CentOS如何設(shè)置靜態(tài)IP

下一篇:Linux搭建discuz論壇的方法