色yeye在线视频观看_亚洲人亚洲精品成人网站_一级毛片免费播放_91精品一区二区中文字幕_一区二区三区日本视频_成人性生交大免费看

當前位置:首頁 > 嵌入式培訓 > 嵌入式學習 > 講師博文 > Linuxiptables 配置

Linuxiptables 配置 時間:2018-09-27      來源:未知

一、只給 Centos 6.5 打開 22 和 80 端口,并且重啟后有效:

1、查看所有 iptables 配置:

[root@Demon yum.repos.d]# iptables -L -n (當前防火墻是關閉的)

Chain INPUT (policy ACCEPT)

target prot opt source destination

Chain FORWARD (policy ACCEPT)

target prot opt source destination

Chain OUTPUT (policy ACCEPT)

target prot opt source destination

2、只允許 80 和 22 端口通過防火墻

# 清除所有規則

[root@Demon opt]# iptables -F

# 只允許 發送的包從 22 端口進入和返回, -A 的意思是添加一條 INPUT 規則, -p 指定為什么協議,--dport 為目標端口

[root@Demon opt]# iptables -A INPUT -p tcp --dport 22 -j ACCEPT

[root@Demon opt]# iptables -A OUTPUT -p tcp --sport 22 -m state --state ESTABLISHED -j ACCEPT

# 允許本機訪問本機

[root@Demon opt]# iptables -A INPUT -s 127.0.0.1 -d 127.0.0.1 -j ACCEPT

[root@Demon opt]# iptables -A OUTPUT -s 127.0.0.1 -d 127.0.0.1 -j ACCEPT

# 允許所有 IP 訪問 80 端口

[root@Demon opt]# iptables -A INPUT -p tcp -s 0/0 --dport 80 -j ACCEPT

[root@Demon opt]# iptables -A OUTPUT -p tcp --sport 80 -m state --state ESTABLISHED -j ACCEPT

[root@Demon opt]# iptables -P INPUT DROP

[root@Demon opt]# iptables -P OUTPUT DROP

[root@Demon opt]# iptables -P FORWARD DROP

# 保存配置

[root@Demon opt]# iptables-save > /etc/sysconfig/iptables

[root@Demon opt]# iptables -L

Chain INPUT (policy DROP)

target prot opt source destination

ACCEPT tcp -- anywhere anywhere tcp dpt:ssh

ACCEPT all -- localhost localhost

ACCEPT tcp -- anywhere anywhere tcp dpt:http

Chain FORWARD (policy DROP)

target prot opt source destination

Chain OUTPUT (policy DROP)

target prot opt source destination

ACCEPT tcp -- anywhere anywhere tcp spt:ssh state ESTABLISHED

ACCEPT all -- localhost localhost

ACCEPT tcp -- anywhere anywhere tcp spt:http state ESTABLISHED

# 重啟電腦后, ping 一下百度:

[root@Demon opt]# ping www.baidu.com

ping: unknown host www.baidu.com

二、關閉 iptables

# 打開防火墻,重啟生效

# chkconfig iptables on

# 關閉防火墻,重啟生效

# chkconfig iptables off

# 打開防火墻,立即生效,重啟后不生效

# chkconfig start

# 關閉防火墻,立即生效,重啟后不生效

# chkconfig stop

上一篇:Linux管理軟件包

下一篇:Linux編譯軟件包

华清图书馆

0元电子书,限时免费申领

10本华清图书PDF版

扫码关注华清远见公众号
自动回复“2”,即可申领!
熱點文章推薦
華清學員就業榜單
高薪學員經驗分享
熱點新聞推薦
前臺專線:010-82525158 企業培訓洽談專線:010-82525379 院校合作洽談專線:010-82525379 Copyright © 2004-2022 北京華清遠見科技集團有限公司 版權所有 ,京ICP備16055225號-5京公海網安備11010802025203號

回到頂部

主站蜘蛛池模板: 波多野42部无码喷潮在线 | 在线免费观看日本欧美 | 中文字幕91在线 | 免费观看裸体美女网站 | 无码AV波多野结衣久久 | 亚洲精品无码成人a片九色播放 | 老司机深夜福利未满十八 | 日日摸处处碰夜夜爽 | 午夜亚洲WWW湿好爽 国产成人啪精品视频免费视频 | 无码av动漫精品专区 | 亚洲日韩一区二区一无码 | 精品人妻无码一区二区三区下一 | 成人午夜视频观看免费高清第1季 | 性欧美乱妇高清COME | 亚洲国产欧美日韩在线精品一区 | 古装激情偷乱人伦视频 | 97精品久久天干天天 | 少妇厨房愉情理9仑片视频 亚洲妇女熟BBW | 国产精品白丝喷水JK娇喘视频 | 手机看片国产AV无码 | 免费吃奶摸下激烈视频青青网 | 最近在线更新8中文字幕免费 | 青青草国产精品欧美成人 | 亚洲日韩精品一区二区三区无码 | 国产黑色丝袜在线播放 | 97久久草草超级碰碰碰 | 张雨绮被揉到高潮下不了床 | 97在线观看播放 | 欧美z0zo人禽交 | 色噜噜久久综合伊人一本 | 日本一区二区三区精品视频在线观看 | 亚洲精品久久AV无码蜜桃 | MM1313亚洲国产精品 | 久久99久久99精品中文字幕 | 日产精品一品二品三品 | 妺妺第一次啪啪好紧 | 成人免费毛片AAAAAA片 | chinese老太性视频bbw | 亚洲熟妇中文字幕日产无码 | 俩个男人添我下面太爽了 | 久久综合久中文字幕青草 |