---
description: iptables
---

# 20190529

iptables重點:

![](https://1005948644-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LZgzp55XQBZ7U2SrFtZ%2F-Lg1DHM7JO_bumUQ4fcy%2F-Lg1IUzaO0u8tGVo7iOF%2Fimage.png?alt=media\&token=de609f05-7aea-434c-9d0c-facaee26c8aa)

![](https://1005948644-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LZgzp55XQBZ7U2SrFtZ%2F-Lg1DHM7JO_bumUQ4fcy%2F-Lg1IsbfDkimBO5P0UHt%2Fimage.png?alt=media\&token=18d257c5-8734-4be8-b333-df5a6cf6dd5a)

![](https://1005948644-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LZgzp55XQBZ7U2SrFtZ%2F-Lg1DHM7JO_bumUQ4fcy%2F-Lg1J4K_Dwmj2hDoiqq2%2Fimage.png?alt=media\&token=4149373f-d5cd-4648-b4d8-0681238decf2)

![](https://1005948644-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LZgzp55XQBZ7U2SrFtZ%2F-Lg1DHM7JO_bumUQ4fcy%2F-Lg1JWq_2G52TtQgGPkD%2Fimage.png?alt=media\&token=7dbb3031-918d-44e0-b5e4-efd21add2ad4)





![](https://1005948644-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LZgzp55XQBZ7U2SrFtZ%2F-Lg1DHM7JO_bumUQ4fcy%2F-Lg1QxV_0LTPsfCtUYUh%2Fimage.png?alt=media\&token=5a3a7112-f33a-4710-b640-179288b44742)

\[server]

```
# iptables -F
# iptables -L
# iptalbes -I INPUT -p tcp --dport 80 -j ACCEPT
# iptalbes -I INPUT -p tcp --dport 22 -j ACCEPT
# iptalbes -I INPUT -p tcp --dport 10:21 -j ACCEPT
# iptables -L
# iptalbes -I INPUT -p icmp -j ACCEPT
# iptables -A INPUT -j REJECT
```

![](https://1005948644-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LZgzp55XQBZ7U2SrFtZ%2F-Lg1DHM7JO_bumUQ4fcy%2F-Lg1NTibiVIz2Jt_9n6c%2Fimage.png?alt=media\&token=306d3075-4dac-451d-a143-68bcc79afefc)

![](https://1005948644-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LZgzp55XQBZ7U2SrFtZ%2F-Lg1DHM7JO_bumUQ4fcy%2F-Lg1NeOXZAa5QHkUnW3P%2Fimage.png?alt=media\&token=85d65de6-5172-4418-b933-624b0041d5c1)

![](https://1005948644-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LZgzp55XQBZ7U2SrFtZ%2F-Lg1DHM7JO_bumUQ4fcy%2F-Lg1O9byEw4PiU2wUIsO%2Fimage.png?alt=media\&token=d70f83c9-5bff-40f1-9f03-e260845c7be8)

![](https://1005948644-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LZgzp55XQBZ7U2SrFtZ%2F-Lg1DHM7JO_bumUQ4fcy%2F-Lg1OKz31-Cus6JPCkCm%2Fimage.png?alt=media\&token=22b6b7e2-4fc5-48ba-874a-cb74bab4d8fe)

\[client]

```
# yum install nmap
# nmap -sS -p 0-1000 192.168.56.101
```

![](https://1005948644-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LZgzp55XQBZ7U2SrFtZ%2F-Lg1DHM7JO_bumUQ4fcy%2F-Lg1OnC9_mYpcxG_BTjF%2Fimage.png?alt=media\&token=bce98dff-8d20-4712-85e2-40d5141d45b0)

\[server]

```
# iptables -D INPUT -p tcp --dport 80 -j ACCEPT
# iptables -I INPUT -p tcp --dport 80 -j ACCEPT
```

![](https://1005948644-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LZgzp55XQBZ7U2SrFtZ%2F-Lg1DHM7JO_bumUQ4fcy%2F-Lg1P8Bdz5-xgpj6p5H2%2Fimage.png?alt=media\&token=65e7bd90-50e7-45f1-b1ea-c21e2d41b8b4)

![](https://1005948644-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LZgzp55XQBZ7U2SrFtZ%2F-Lg1DHM7JO_bumUQ4fcy%2F-Lg1PQUnFuSM8hOLeJ2y%2Fimage.png?alt=media\&token=32ca7e6f-46a7-48a1-aa46-424bbf753778)



\[client]

```
# nmap -sS -p 0-1000 192.168.56.101
```

![](https://1005948644-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LZgzp55XQBZ7U2SrFtZ%2F-Lg1DHM7JO_bumUQ4fcy%2F-Lg1PfxXQ1XTZ032UlRC%2Fimage.png?alt=media\&token=bf37083f-0c91-4c0c-8a4d-532bd6161f26)

![](https://1005948644-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LZgzp55XQBZ7U2SrFtZ%2F-Lg1DHM7JO_bumUQ4fcy%2F-Lg1PsfYxr9Pn48SFmuu%2Fimage.png?alt=media\&token=e518a342-3dd2-4c0e-8971-12643715fffd)
