掌握Linux防火墻經(jīng)典應(yīng)用 讓企業(yè)網(wǎng)絡(luò)更安全
Linux防火墻經(jīng)典應(yīng)用如下:
iptables 這個(gè)指令, 如同以下用 man 查詢所見, 它用來過濾封包和做NAT Network Address Translation(網(wǎng)路位址轉(zhuǎn)譯), 這個(gè)指令的應(yīng)用很多, 可以做到很多網(wǎng)路上的應(yīng)用.
iptables - administration tool for IPv4 packet filtering and NAT
應(yīng)用1:讓區(qū)域網(wǎng)路內(nèi)的電腦以一個(gè)真實(shí)IP來共享頻寬(實(shí)作NAT)
架構(gòu)圖:
所需設(shè)備: 一臺(tái) Linux server , 2張網(wǎng)路卡
網(wǎng)卡1 : eth0 , 使用真實(shí)IP , 網(wǎng)卡2 : eth1 , 使用 192.168.1.254
設(shè)定: 在 /etc/rc.d/rc.local 寫入以下幾行
- echo "1" > /proc/sys/net/ipv4/ip_forward
- modprobe ip_tables
- modprobe ip_nat_ftp
- modprobe ip_conntrack
- modprobe ip_conntrack_ftp
- iptables -t nat -A POSTROUTING -o eth0 -s 192.168.1.0/24 -j MASQUERADE
應(yīng)用2:讓區(qū)域網(wǎng)路內(nèi)的電腦以一個(gè)ADSL來共享頻寬(實(shí)作NAT),這個(gè)例子和上個(gè)例子很像, 只是某一個(gè)設(shè)定要做修改
架構(gòu)圖:
所需設(shè)備: 一臺(tái) Linux server , 2張網(wǎng)路卡
網(wǎng)卡1 : eth0 , 使用真實(shí)IP , 網(wǎng)卡2 : eth1 , 使用 192.168.1.254
設(shè)定: 在 /etc/rc.d/rc.local 寫入以下幾行
- echo "1" > /proc/sys/net/ipv4/ip_forward
- modprobe ip_tables
- modprobe ip_nat_ftp
- modprobe ip_conntrack
- modprobe ip_conntrack_ftp
- iptables -t nat -A POSTROUTING -o ppp0 -s 192.168.1.0/24 -j MASQUERADE
應(yīng)用3:讓外界的電腦可以存取區(qū)域網(wǎng)路內(nèi)的某部server(實(shí)作轉(zhuǎn)址,轉(zhuǎn)port),此種做法有保護(hù)內(nèi)部 server 的效果
架構(gòu)圖:
所需設(shè)備: 一臺(tái) Linux server , 2張網(wǎng)路卡
網(wǎng)卡1 : eth0 , 使用真實(shí)IP , 網(wǎng)卡2 : eth1 , 使用 192.168.1.254
設(shè)定: 在 /etc/rc.d/rc.local 寫入以下幾行
- echo "1" > /proc/sys/net/ipv4/ip_forward
- modprobe ip_tables
- modprobe ip_nat_ftp
- modprobe ip_conntrack
- modprobe ip_conntrack_ftp
- iptables -t nat -A POSTROUTING -o eth0 -s 192.168.1.0/24 -j MASQUERADE
- iptables -t nat -A PREROUTING -i eth0 -p tcp -d 真實(shí)IP --dport 80 -j DNAT --to-destination 192.168.1.13:80
Linux防火墻的經(jīng)典應(yīng)用就為大家介紹完了,希望大家通過以上的介紹已經(jīng)理解并掌握了,我們還會(huì)在以后的文章中多多整理這方面的知識(shí)。






