07-[面試題答案]防火墻面試題整理

第 第1章 章 選擇
1.1 rule permit ip source 210.78.1.1 0.0.255.255 destination202.38.5.2 0.0.0.0 的含義是( D )
A. 允許主機 210.78.1.1 訪問主機 202.38.5.2
B. 允許 210.78.0.0 的網(wǎng)絡(luò)訪問 202.38.0.0 的網(wǎng)絡(luò)
C. 允許主機 202.38.5.2 訪問網(wǎng)絡(luò) 210.78.0.0
D. 允許 210.78.0.0 的網(wǎng)絡(luò)訪問主機 202.38.5.2
1.2 在防火墻上允許 tcp 和 和 udp 端口 21 、 23 、 25 訪問內(nèi)網(wǎng),下列那張協(xié)議包可以進來 (多選)
A C D
A. SMTP #25 簡單郵件傳輸協(xié)議
B. STP #
C. FTP #21 20
D. Telnet #23
E. HTTP #80
F. POP3 #110
1.3 以下不屬 以下不屬 于 防火墻能夠?qū)崿F(xiàn)的功能是( B )
A、網(wǎng)絡(luò)地址轉(zhuǎn)換
B、差錯控制
C、數(shù)據(jù)包過濾
D、數(shù)據(jù)轉(zhuǎn)發(fā)
1.4 哪個不屬于 iptables 的表 D
A. filter
B. nat
C. mangle
D. INPUT

1.5 以下對防火墻的描述正確的是:(C )
A. 完全阻隔了網(wǎng)絡(luò)
B. 能在物理層隔絕網(wǎng)絡(luò)
C. 僅允許合法的通訊
D. 無法阻隔黑客的侵入
第 第2章 章 填空
2.1 ( (防火墻 ) 是設(shè)置在被保護網(wǎng)絡(luò)和外部網(wǎng)絡(luò)之間的一道 屏障,以防止破壞性侵入
2.2 在 在 CentOS7 下,我想關(guān)閉掉防火墻,應(yīng)該用命令systemctl stop firewalld 來關(guān)閉掉。如果以后開
機都不想它啟動起來,執(zhí)行(systemctl disable firewalld) 命令
2.3 在 CentOS7 配置 ip 轉(zhuǎn)發(fā)需要在(/etc/sysctl.conf) 里加入(net.ipv4.ip_forward=1) 執(zhí)行(sysctl -p) 命令
后生效
第 第3章 章 簡答
3.1 防火期墻策略,開放服務(wù)器 80 端口,禁止來自 10.0.0.188 的地址訪問服務(wù)器 80 端口的請求。
iptables -t filter -A INPUT -p tcp --dport 80 -j ACCEPT
iptables -t filter -I INPUT -p tcp --dport 80 -s 10.0.0.188 -j DROP

iptables -A INPUT -p tcp --dport 80 ! -s 10.0.0.188 -j ACCEPT
3.2 防火墻策略,實現(xiàn)把訪問 10.0.0.3:80 的請求轉(zhuǎn)到 172.16.1.17:8080 上。
iptables -t nat -A PREROUTING -p tcp --dport 80 -j DNAT --to 172.16.1.17:8080
3.3 防火墻策略配置說明。闡述出 10.10.10.1 訪問 192.168.1.1 所有端口策略需要的配置過程
iptables -A INPUT -p all -s 10.10.10.1 -d 192.168.1.1 --dport 1:65535 -j ACCEPT
iptables -t filter -I INPUT -p tcp --dport 1-65535 -s 10.10.10.1 -d 192.168.1.1 -j ACCPET

iptables 知識考察,根據(jù)要求寫出防火墻規(guī)則
3.4 屏蔽 192.168.1.5 訪問本機 dns 服務(wù)端口:
iptables -t filter -I INPUT -p udp --dport 53 -s 192.168.1.5 -j DROP
iptables -t filter -I INPUT -p tcp --dport 53 -s 192.168.1.5 -j DROP
3.5 允許 10.1.1.0/24 訪問本機的 udp 8888 9999 端口
iptables -t filter -I INPUT -s 10.1.1.0/24 -p udp -m multiport --dport 8888,9999 -j ACCEPT
3.6 iptables 禁止 10.10.10.1 訪問本地 80 端口
iptables -t filter -I INPUT -p tcp -s 10.10.10.1 --dport 80 -j DROP
3.7 如何利用 iptables 屏蔽某個 IP 對 對 80 端口的訪問
iptables -t filter -I INPUT -p tcp -s xx.xx.xx.xx --dport 80 -j DROP
3.8 寫出 iptables 四表五鏈,按照優(yōu)先級排序
表的處理優(yōu)先級:raw>mangle>nat>filter
進路由(PREROUTING)、進系統(tǒng)(INPUT) 、轉(zhuǎn)發(fā)(FORWARD)、出系統(tǒng)(OUTPUT)、出路由
(POSTROUTING)
3.9 如何通過 iptables 將本地 80 端口的請求轉(zhuǎn)發(fā)到 8080 端口,當前主機 IP 為 為 192.168.2.1
iptables -t nat -A PREROUTING -p tcp --dport 80 -j DNAT --to-destination 192.168.2.1:8080
3.10 請寫一條命令,只允許 80 端口,其他端口都拒絕,eth1 網(wǎng)卡 ip 為 為 192.168.1.12
一條命令的:
iptables -I INPUT -p tcp ! --dport 80 -j DROP

iptables -I INPUT -p tcp -i eth1 -d 192.168.1.12 ! --dport 80 -j DROP
分為兩步的:
iptables -t filter -I INPUT -p tcp -d 192.168.1.12 --dport 80 -j ACCEPT
iptables -P INPUT DROP

3.11 限制連接到 192.168.100.100:8080 后端服務(wù)最大 1000
iptables -I INPUT -p tcp -d 192.168.100.100 --dport 8080 -m limit --limit 10/min --limit-burst
1000
3.12 請簡述防火墻的基本功能和特點
基本功能:
包過濾
包的透明轉(zhuǎn)發(fā)
阻擋外部攻擊
記錄攻擊
特點:
數(shù)據(jù)必經(jīng)之地
網(wǎng)絡(luò)流量的合法性
抗攻擊免疫力
3.13 內(nèi)網(wǎng)環(huán)境中,A (10.0.0.1 )機與 B (10.0.0.2 )機互通,現(xiàn)在需要在 A 機上簡 單 安全策略,禁止
B 機訪問 A 機的 SSH 服務(wù)( (22 端口)有幾種方法?如何操作?
iptables -t filter -A INPUT -p tcp --dport 22 -j DROP
iptables -t filter -I INPUT -p tcp -s 10.0.0.2 -j DROP
iptables -t filter -I INPUT -p tcp -s 10.0.0.2 --dport 22 -j DROP
3.14 service iptables stop 與 iptables -F 有何區(qū)別?
systemctl stop iptables #關(guān)閉防火墻服務(wù),如果規(guī)則沒有保存 之前配置的規(guī)則丟失
前者是 iptables 服務(wù)的關(guān)閉,會清空當前規(guī)則。
后者是清空臨時規(guī)則
3.15 iptables 封禁 eth0 網(wǎng)卡與 192.168.1.1 通訊的所有數(shù)據(jù)包
iptables -t filter -I INPUT -p all -i eth0 -s 192.168.1.1 -j DROP
iptables -t filter -I OUTPUT -p all -o eth0 -d 192.168.1.1 -j DROP
3.16 iptables 禁止所有到本機(eth0:10.10.10.200 )22 端口的 TCP 訪問
iptables -t filter -I INPUT -p tcp -d 10.10.10.200 --dport 22 -j DROP

3.17 如何禁止 192.168.500.2 訪問本機 ssh 端口?
3.18 解釋這條規(guī)則:/sbin/iptables -t nat -A PREROUTING -d 192.168.20.99/32 -p udp -m udp --dport
99 -j DNAT --to-destination 192.168.20.11

  1. iptables -t filter -I INPUT -p tcp -s 192.168.500.2 --dport 22 -j DROP
  2. 將請求 192.168.20.99 的 udp 99 端口的數(shù)據(jù)包轉(zhuǎn)發(fā)到 192.168.20.11
    3.19 有一臺主機內(nèi)網(wǎng) IP :10.4.82.200 ,公網(wǎng) IP :118.186.111.121 ,現(xiàn)欲使 10.4.82.0/24 網(wǎng)段, (該網(wǎng)段
    為 默認網(wǎng)關(guān)為 10.4.82.254 ),使用 10.4.82.200 作為跳板機出往,請給出配置方法
    將默認網(wǎng)關(guān)改為 10.4.82.200
    iptables -t nat -I POSTROUTING -p tcp -s 10.4.82.0/24 -j SNAT --to-source 118.186.111.121
    3.20 配置跳板機主機的某個內(nèi)核參數(shù),并使其生效
    3.21 配置跳板機的 iptables 防火墻規(guī)則
    iptables -t filter -I INPUT -s xx.xx.xx.xx -p tcp --dport 2222 -j ACCEPT
    3.22 把 把 10.10.0.0 網(wǎng)段流出的數(shù)據(jù)的原地址修改為 66.66.66.66
    iptables -t nat -I POSTROUTING -p tcp -s 10.10.0.0/24 -j SNAT --to-source 66.66.66.66
    3.23 本機有兩張網(wǎng)卡,分別為 eth0 和 和 eth1 ,請寫出僅允許從 eth0 訪問本機 web (80 )服務(wù)的 iptables
    許 規(guī)則,允許 eth1 所有訪問
    iptables -t filter -I INPUT -p tcp --dport 80 -i eth0 -j ACCEPT
    iptables -t filter -I INPUT -p all -i eth1 -j ACCEPT
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

友情鏈接更多精彩內(nèi)容