Iptables

基础概念

Iptables 默认有三个表: filter表,nat表,以及 mangle 表。mangle 表

filter表默认有 Input, output, forward 的链(chain)

img

nat表默认有prerouting, input, output, forward, post routing 5条链

img

显示当前iptables,可看到规则id

删除规则

端口转发

将 1.1.1.1的3306端口,转发到2.2.2.2的3306,这样在任意机器上,访问1.1.1.1的3306,就是2.2.2.2的3306

参考资料: http://linux-training.be/networking/ch14.html#:~:text=the%20Linux%20kernel.-,iptables%20tables,is%20used%20for%20packet%20filtering.&text=The%20nat%20table%20is%20used%20for%20address%20translation.&text=The%20mangle%20table%20can%20be,special%2Dpurpose%20processing%20of%20packets.

Last updated