We are currently setting up a system where we are using a Linux computer (debian) that acts as a WiFi control and router. The Linux computer connects to two WiFi networks (let's call them A and B) via WiFi (wlan0 and wlan1). A PC is then connected via ethernet to the Linux box to allow it access to any device on the two WiFi networks. See ASCII art image                                             WiFi A (192.170.1.xx)                                            /                                           /PC (192.168.2.xx) ----- (192.168.2.1) Linux (192.170.1.253)                                            \                                            \                                             WiFi B (192.170.1.xx)Protocols that we need routed:SSH to any 192.170.1.xx device from PCTCP on ports 1234/4321 to any 192.170.1.xx device from PCPING to any 192.170.1.xx device from PCThe question relates to how to setup the IPTablesThe PC has the gateway set to 192.168.2.1 so any packets that the PC sends to 192.170.1.xx will be routed to the Linux box?This is what I think should work (not yet tested). Could you please indicate if this is correct or I have a fundamental mistake in my logic?iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADEiptables -A FORWARD -i eth0 -o wlan0 -m state --state RELATED,ESTABLISHED -j ACCEPTiptables -A FORWARD -i eth0 -o wlan 1-m state --state RELATED,ESTABLISHED -j ACCEPTiptables -A FORWARD -i wlan0 -o eth0 -j ACCEPTiptables -A FORWARD -i wlan1 -o eth0 -j ACCEPT
IPTables for packet routing with two wifi networks
iptables
Note: Wifi A and B must be in different subnets otherwise the Linux system will complain.I will assume that eth0 is for the PC, then you can use this rule to achieve what you want for the ssh and tcp ports:iptables -t filter -A FORWARD -i eth0 -o <Interface> -d <Des subnet> -p tcp --dport <Des Port> -m state --state NEW,RELATED,ESTABLISHED -j ACCEPTTo allow ping you can use:iptables -t filter -A FORWARD -i eth0 -o <Interface> -d <Des subnet> -p icmp --icmp-type 8 -j ACCEPT