美文网首页
iptables、iproute2

iptables、iproute2

作者: michael_jia | 来源:发表于2022-07-02 00:26 被阅读0次
This mark exists only as long as it's handled by the Linux kernel.
It's only purely virtual and internal, as it can have no existence on the wire. 
Depending on where it's used, it may be called firewall mark, fwmark or simply mark.

About iptables

  • iptables is a command-line firewall utility that uses policy chains to allow or block traffic. When a connection tries to establish itself on your system, iptables looks for a rule in its list to match it to. If it doesn’t find one, it resorts to the default action.
  • iptables uses three different chains: input, forward, and output.
    iptables -nvL: --numeric --verbose --list,若不指定 -t --table 表示默认 filter 表。
  • --line-numbers When listing rules, add line numbers to the beginning of each rule, corresponding to that rule’s position in the chain.
  • iptables -nvL INPUT: 只看 INPUT chain;
  • iptables -S INPUT: like iptables-save 一窥命令;
  • iptables -t filter -I INPUT 1 <rule-content>: 把规则插入到第1号。
  • iptables -t filter -D INPUT <rulenum>: 删除 filter 表 INPUT 链的 rulenum 这个序号的规则(使用 --line-numbers 查看规格号 rulenum)。
  • -N, --new-chain chain: Create a new user-defined chain by the given name. -S 可以查看到执行各个命令。
  • -P, --policy chain target: 示例 -P INPUT ACCEPT -c 53 3952
  • iptables -nvL | grep policy: Policy Chain Default Behavior,一般都是 accept。
    设置命令:iptables --policy INPUT ACCEPT
  • Connection-specific Responses: Accept, Drop, Reject. 以 ping 为例,分别就是:Reply ... TTL=64,Request timed out, Destination port unreachable.
  • iptables -A INPUT -s 10.10.10.10 -j DROP: --append --source --jump,在 INPUT 链上加一条规则,源于 10.10.10.10 的包全部丢弃。
  • The Beginner’s Guide to iptables, the Linux Firewall

命令 iptables -t filter -nvL

  • Chain ZY_auth 阻止上网
    # iptables -t filter -nvL;Chain ZY_auth 已阻止上网

命令 iptables -t nat -nvL

  • Chain ZY_host 设置跳转
  • 对 nat 表,重定向到 86 端口 iptables -t nat -nvL |grep "ports 86"
# iptables -t nat -nvL | grep "ports 86"
1867  103K REDIRECT   tcp  --  br0    *       0.0.0.0/0            0.0.0.0/0            tcp dpt:80 redir ports 86
# iptables -t nat -nvL;Chain ZY_host 设置跳转 86 端口;
  • Chain ZY_auth 已放行用户
    # iptables -t nat -nvL;Chain ZY_auth 已放行用户;
最常用 filter table,也是缺省表
  • The filter table is the default table. It contains the actual firewall filtering rules. The built-in chains include these: INPUT OUTPUT FORWARD
Let us try to understand rules output:
target – Tell what to do when a packet matches the rule. Typically, you ACCEPT or REJECT or DROP the packet. You can jump to another chain too.
prot – The protocol for rule.
opt – Additional options for rule.
source – The source IP address/subnet/domain name.
destination – The destination IP address/subnet/domain name.

ethernet bridge administration

# brctl show
bridge name     bridge id               STP enabled     interfaces
br0             8000.2406f2d00068       yes             eth1.0
                                                        eth2.0
                                                        eth3.0
                                                        wl0
                                                        wl1
br1             8000.000000000000       no
  • STP:Spanning Tree Protocol.

iproute2

网络通信解析

Packet flow in Netfilter and General Networking

网络设备驱动

网络设备驱动 七层模型和TCP/IP、dev_queue_xmit 和 netif_rx 网络结构-C语言实现 网络数据传输 dev_queue_xmit

Toybox

  • A implementation of over 200 Unix command line utilities.
    BSD licenses.(和GPL区别在于基于BSD许可的开源软件所做的修改可以不开源,且在BSD上面新开发的部分可以商业使用)。
  • Android's command line tools.

WiFiDog

WiFiDog 无线热点认证解决方案

相关文章

  • iptables、iproute2

    内核[https://www.kernel.org/]; iptables manual[https://linu...

  • A new post

    Linux net-tools VS IProute2

  • iptables

    iptables -F iptables -X iptables -Z service iptables save...

  • iptables

    iptables详解 iptables简介 netfilter/iptables(简称为iptables)组成Li...

  • Iproute2

    安装 net-tools在很多年前就不在更新,在新版本的电脑里基本全是iproute2,所以我们需要学习使用。现在...

  • iptables

    参考: 9个常用iptables配置实例 25个iptables常用示例 iptables命令 Iptables ...

  • 源地址策略路由

    $ cat /etc/iproute2/rt_tables reserved values 255 local25...

  • iptables 配置

    iptables -P INPUT DROP iptables -P OUTPUT DROP iptables -...

  • 安装iptables

    1、检查是否安装iptables 2、安装iptables 3、升级iptables 4、安装iptables-s...

  • kube-proxy报错 "--random-fully"解决方

    原因:iptables 本地iptables版本不支持,要升级iptables 安装升级iptables所需依赖 ...

网友评论

      本文标题:iptables、iproute2

      本文链接:https://www.haomeiwen.com/subject/tlmhbrtx.html