佳木斯湛栽影视文化发展公司

主頁(yè) > 知識(shí)庫(kù) > 在Linux系統(tǒng)中給iptables規(guī)則添加注釋的教程

在Linux系統(tǒng)中給iptables規(guī)則添加注釋的教程

熱門(mén)標(biāo)簽:電話機(jī)器人搭建 硅谷的囚徒呼叫中心 外呼系統(tǒng) 解決方案 家政服務(wù)網(wǎng)絡(luò) 服務(wù)器配置 百度競(jìng)價(jià)點(diǎn)擊價(jià)格的計(jì)算公式 美團(tuán)

給iptables規(guī)則添加注釋,以此給你的老板和同事一個(gè)好印象。方法如下:

什么是iptables的注釋呢?

iptables的注釋一般使用在每條規(guī)則的后面,注釋一般用 /*  */ 包住。(具體的見(jiàn)下面的iptables規(guī)則中的注釋  /* allow  SSH to  this host  from  anywhere */ )

   

復(fù)制代碼
代碼如下:
$ sudo iptables -L
Chain INPUT (policy DROP)
target prot opt source destination
ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED /* allow inbound traffic for established and related connections */
fail2ban-ssh tcp -- anywhere anywhere multiport dports ssh
ACCEPT tcp -- anywhere anywhere tcp dpt:ssh /* allow SSH to this host from anywhere */
ACCEPT udp -- anywhere anywhere udp dpt:route /* allow incoming RIP on the internal interface */
ACCEPT all -- localhost localhost /* allow any local-only traffic */
ACCEPT ipv6 -- tserv2.ash1.he.net anywhere /* allow IPv6 tunnel traffic from HE */
ACCEPT icmp -- anywhere anywhere /* allow ICMP traffic to this host from anywhere *//p> p> Chain FORWARD (policy DROP)
target prot opt source destination
ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED /* allow inbound traffic for established and related connections */
ACCEPT all -- anywhere anywhere /* allow all Internet bound traffic from the internal network */
ACCEPT icmp -- anywhere anywhere /* forward any ICMP traffic *//p> p> Chain OUTPUT (policy ACCEPT)
target prot opt source destination/p> p> Chain fail2ban-ssh (1 references)
target prot opt source destination
RETURN all -- anywhere anywhere

 
為新的iptables規(guī)則添加注釋

 

為新的iptables規(guī)則添加注釋的語(yǔ)法為 :  comment --comment “要添加的注釋文字”
具體的例子:下面添加一條允許ssh流量通過(guò)的規(guī)則,并且給這條規(guī)則添加注釋:


復(fù)制代碼
代碼如下:
$ sudo iptables -A INPUT -p tcp -m tcp --dport 22 -m comment --comment "allow SSH to this host from anywhere" -j ACCEPT

然后用 -L 列出規(guī)則,就會(huì)看到剛才添加的規(guī)則和下面的一樣:

復(fù)制代碼
代碼如下:
$ sudo iptables -L/p> p>ACCEPT tcp -- anywhere anywhere tcp dpt:ssh /* allow SSH to this host from anywhere */

教程完!

標(biāo)簽:撫州 烏蘭察布 臨沂 防城港 南昌 邢臺(tái) 北海 韶關(guān)

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《在Linux系統(tǒng)中給iptables規(guī)則添加注釋的教程》,本文關(guān)鍵詞  ;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問(wèn)題,煩請(qǐng)?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無(wú)關(guān)。
  • 相關(guān)文章
  • 收縮
    • 微信客服
    • 微信二維碼
    • 電話咨詢

    • 400-1100-266
    宜都市| 兴和县| 二手房| 孝昌县| 钦州市| 滨州市| 关岭| 甘南县| 七台河市| 阿拉尔市| 泽普县| 高陵县| 繁昌县| 韶山市| 周至县| 肇源县| 凌源市| 勃利县| 黄梅县| 延寿县| 阳朔县| 无为县| 普洱| 文水县| 读书| 和平县| 达州市| 阜康市| 武威市| 汉寿县| 阳东县| 九龙城区| 绥芬河市| 报价| 镇雄县| 泰来县| 昆明市| 商水县| 天等县| 乐清市| 庆城县|