作業 iptables 周作業

2021-10-09 14:26:32 字數 2302 閱讀 6028

1. 拒絕所有主機ping當前的主機

[root@centos8 ~]#iptables -a input -p icmp -j reject 

#測試驗證

[root@centos7 ~]# ping -c1 10.0.0.8

ping 10.0.0.8 (10.0.0.8) 56(84) bytes of data.

from 10.0.0.8 icmp_seq=1 destination port unreachable

--- 10.0.0.8 ping statistics ---

1 packets transmitted, 0 received, +1 errors, 100% packet loss, time 0ms

[root@centos6 ~]# ping -c1 10.0.0.8

ping 10.0.0.8 (10.0.0.8) 56(84) bytes of data.

from 10.0.0.8 icmp_seq=1 destination port unreachable

--- 10.0.0.8 ping statistics ---

1 packets transmitted, 0 received, +1 errors, 100% packet loss, time 0ms

2. 本機能夠訪問別的機器的http服務,但是別的機器無法訪問本機
[root@centos8 ~]#iptables -a input -d 10.0.0.8 -p tcp --dport 80 -j reject

#測試驗證

[root@centos8 ~]#curl 127.0.0.1

centos8.kobe.com

[root@centos8 ~]#curl 10.0.0.7

centos7.kobe.com

[root@centos8 ~]#curl 10.0.0.6

centos6.kobe.com

[root@centos7 ~]# curl 10.0.0.8

curl: (7) failed connect to 10.0.0.8:80; connection refused

[root@centos6 ~]# curl 10.0.0.8

curl: (7) couldn't connect to host

3. 當我們發現有 ip 惡意攻擊我們的時候,我們可以通過對防火牆設定規則來進行控制,所以我們可以新增connlimit模組來實現對最大併發得到控制。請寫出步驟
[root@centos8 ~]#iptables -a input -d 10.0.0.8 -p tcp --dport 22 -m connlimit --connlimit-above 10 -j reject
4. 實踐題

實驗前提需求

現在我在外地出差使用a7網際網路主機,但是由於公司有業務需要我ssh連線到內網、這時候我就連線到我們公司同事在防火牆上配置相關規則讓我連線進公司內網

請寫出實現過程:

思路:利用snat和dnat實現

環境準備好後,測試能否ping通

注意:要在a7和a8上新增路由

注意:在a7和a8上要開啟ip_forward **功能

配置規則:

測試驗證:

iptables 部落格作業

一.拒絕所有主機ping當前主機 iptables a input p icmp j erject iptables atnput s 10.0.0.0 24 p icmp icmp type 8 j reject 二 本機能夠訪問別的機器httpd服務,但別的機器無法訪問本機 方式一 iptabl...

第七周作業作業

1 自建yum倉庫,分別為網路源和本地源 建立yum配置檔案,類似如下 base name base baseurl file misc cd gpgcheck 0 epel name epel baseurl gpgcheck 0 enabled 1 本地源 以前自己整理的 2 編譯安裝http2...

第8周作業作業

1 對稱加密過程由那三部分組成 加密 傳送方將資訊通過對稱金鑰加密形成密文 傳輸 傳送方通過網路把密文傳出 解密 接收者將資訊用對稱金鑰進行解密形成明文 2 使用 openssl 中的 aes 對稱加密演算法對檔案 file.txt 進行加密,然後解密 openssl enc aes 128 cbc...