Rocking iptables like a DJ


Once some subnets are able to talk to the router things get interesting especially when to decide which subnet is allowed to reach each other or allowed to access services on the router.
Let’s say we have another private class A subnet ( connected to the router. Hosts from that subnet on eth1 should be able to connect to hosts on the subnet ( on eth0 interface without access to services running on the router itself !
Since the router wouldn’t talk to anyone it explicitly knows, we need to configure an IP address ( on the eth1 interface to have a route from the subnet to be physically reachable but without allowing the subnet in the firewall. This time we won’t use a makefile but allow forwarding temporarily eg:

me@host:~# -4 FORWARD_SUBNET eth0
# forwarding (eth1) to eth0.

The FORWARD_SUBNET call doesn’t take any protection measures and is therefore recommended only for forwarding internal subnets on different interfaces where protection isn’t needed. We also omit service discovery, UPNP or link-local traffic. When only FORWARD_SUBNET call is given it would just allow hosts from the class A subnet on eth1 to pass the interface barrier by forwarding to the eth0 interface but without having access to service discovery, UPNP or link-local since this traffic still can’t pass when going through different interfaces and would need an explicit ALLOW_SUBNET on the router’s interface.

Chain FORWARD (policy DROP 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source        destination         
    0     0 ACCEPT     all  --  eth0   eth1          state NEW /* FORWARD_SUBNET on 0x000e0c35edae to eth0 */
    0     0 ACCEPT     all  --  eth0   eth1          state RELATED,ESTABLISHED /* FORWARD_SUBNET on 0x000e0c35edae to eth0 */
    0     0 ACCEPT     all  --  eth1   eth0            /* FORWARD_SUBNET on 0x000e0c35edae to eth0 */
 2555  319K LOG        all  --  *      *            limit: avg 8/min burst 16 LOG flags 0 level 4 prefix "[FW4-DROP] "

Even when there would be other subnets (eg. configured on eth1 they would end up denied because FORWARD_SUBNET explicitly accepts only traffic from the specified subnet and only between the given interfaces they reside on although traffic originating from the class A subnet can be addressed anywhere it’s limited to subnets on the eth0 interface only which is in our case the class C subnet.


Figure D: Another private subnet which is forwarded internally only without allowing access to services on the router.