问题原文
原帖链接 · blurb · CC BY-SA 3.0
Let's say I have two interfaces on one host, eth0 and eth1. The behavior I'm seeing currently is:
Receive traffic on eth0, it finds a suitable route on eth1 and tries to send it.
I'm already intercepting the packets coming in on eth0 so I would like to stop this forwarding and drop all packets coming in on eth0 instead of sending them on eth1.
In essence, I'd like to block all traffic between two interfaces on one host. Is this possible with iptables or routing?
社区高分解答
原帖链接 · BillThor · CC BY-SA 4.0
You should be able to control this at the kernel level with sysctl. Setting the net.ipv4 and/or net.ipv6 forwarding values off.
net.ipv4.conf.all.forwarding = 0
net.ipv4.conf.eth0.forwarding = 0
net.ipv4.conf.eth1.forwarding = 0
Depending on the distribution you can configure this at startup by editing /etc/sysctl.conf or adding a file in /etc/sysctl.d. Normally forwarding is disabled by default, so you may have a line enabling forwarding.
Some firewall builders will enable or disable forwarding depending on the configuration.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
