ICode9

精准搜索请尝试: 精确搜索
首页 > 系统相关> 文章详细

linux-iptables -j与-g参数

2019-11-20 00:50:56  阅读:2044  来源: 互联网

标签:stateful iptables firewall linux


从发行版的手册页中,我对下面的粗体部分特别感兴趣.

-j,-跳转目标

This specifies the target of the rule; i.e., what to do if the packet matches it. The target can be a user-defined chain (other than the one this rule is in), one of the special builtin targets which decide the fate
of the packet immediately, or an extension (see EXTENSIONS below). If this option is omitted in a rule (and -g is not used), then matching the rule will have no effect on the packet’s fate, but the counters on the
rule will be incremented.

-g,–goto链

This specifies that the processing should continue in a user specified chain. Unlike the –jump option return will not continue processing in this chain but instead in the chain that called us via –jump.

我担心我会误解-g的实际作用.

-g现在与-j有什么不同?

解决方法:

当当前链中的匹配规则指定目标RETURN时,或到达当前链的末尾时,处理将在跳到当前链的上一个链中继续进行,从仍未处理的下一个规则遍历它,即实际指定当前链为目标并触发跳转到当前链的规则下方的规则.

但是,如果跳转到当前链是通过-g(而不是通过-j)完成的,则处理不会在前一个链中继续进行,而是在之前的链中继续进行,假设跳转是通过-j完成的.如果不是这种情况(即使用了-g),那么将考虑之前的链,依此类推.换句话说,将使用-j而不是-g实际指定下一个链的最近链.

如果未找到这样的链(即,直到并包括-g指定的内置链的所有链),或者到达了内置链的末尾,或者匹配了具有目标RETURN的内置链中的规则,内置链策略指定的目标确定数据包的命运.

标签:stateful,iptables,firewall,linux
来源: https://codeday.me/bug/20191120/2040284.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有