I'm wondering about this, and I can't seem to find an explanation on the internet. I have a linux gateway which has multiple interfaces:
eth0: external ip
eth1: 172.16.1.1/24
eth2: 172.16.2.1/24
ip_forward is enabled.
IPtables is configured to NAT traffic from eth1 -> eth0 and eth2 -> eth0. But configured not to FORWARD traffic between eth1 <-> eth2.
My question is: Why is it possible for a computer on the 172.16.2.0/24 subnet to ping 172.16.1.1 (ip address of eth1 interface)?
nat
Chain PREROUTING (policy ACCEPT 647K packets, 52M bytes)
pkts bytes target prot opt in out source destination
Chain INPUT (policy ACCEPT 17582 packets, 1160K bytes)
pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 14951 packets, 1214K bytes)
pkts bytes target prot opt in out source destination
Chain POSTROUTING (policy ACCEPT 187 packets, 42984 bytes)
pkts bytes target prot opt in out source destination
333K 25M SNAT all -- * eth0 0.0.0.0/0 0.0.0.0/0 to:<external ip>
filter
Chain INPUT (policy DROP 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
0 0 ACCEPT all -- lo * 0.0.0.0/0 0.0.0.0/0
0 0 ACCEPT all -- * * 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
0 0 ACCEPT tcp -- eth1 * 0.0.0.0/0 0.0.0.0/0 tcp dpt:22
0 0 ACCEPT tcp -- eth2 * 0.0.0.0/0 0.0.0.0/0 tcp dpt:22
0 0 ACCEPT tcp -- eth0 * <some trusted ip> 0.0.0.0/0 tcp dpt:22
0 0 ACCEPT udp -- eth1 * 0.0.0.0/0 0.0.0.0/0 udp dpt:53
0 0 ACCEPT udp -- eth2 * 0.0.0.0/0 0.0.0.0/0 udp dpt:53
0 0 ACCEPT icmp -- eth1 * 0.0.0.0/0 0.0.0.0/0
0 0 ACCEPT icmp -- eth2 * 0.0.0.0/0 0.0.0.0/0
Chain FORWARD (policy DROP 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
0 0 ULOG all -- eth1 eth0 0.0.0.0/0 0.0.0.0/0 state NEW ULOG copy_range 0 nlgroup 1 prefix "NEW: " queue_threshold 1
0 0 ULOG all -- eth2 eth0 0.0.0.0/0 0.0.0.0/0 state NEW ULOG copy_range 0 nlgroup 1 prefix "NEW: " queue_threshold 1
0 0 ACCEPT all -- eth1 eth0 0.0.0.0/0 0.0.0.0/0
0 0 ACCEPT all -- eth2 eth0 0.0.0.0/0 0.0.0.0/0
0 0 ACCEPT all -- eth0 eth1 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
0 0 ACCEPT all -- eth0 eth2 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
0 0 ACCEPT all -- * lo 0.0.0.0/0 0.0.0.0/0
eth1andeth2interfaces @goldilocks Well, I would think that you were unable to ping the ip address of different interface, because the ip isn't on the same network. @WarrenYoung Yes, iptables drops traffic frometh1trying to reacheth2. So no pinging ie.172.16.1.100from172.16.2.100. – Daniel.Amkaer Jan 12 at 14:15default gatewayrightly configured? If yes, this is the answer. – F. Hauri Jan 12 at 14:21