I want to make possible communication from a client computer C1 to server S via router R. On my R i have set ip forwarding and with iptables I want to restrict communications only for ssh (and say web server, but now it's not important). What I don't know if sending and receiving of messages originate at port 22 and directed to port 22, or sending and receiving ports ar different.
Let's say may iptables are:
iptables -A FORWARD -s 10.1.1.1 -d 10.9.9.1 -p tcp --dport 22 -m state --state NEW,ESTABLISHED -j ACCEPT iptables -A FORWARD -s 10.9.9.1 -d 10.1.1.1 ??? -m state ESTABLISHED -j ACCEPT iptables -A FORWARD -j REJECT
So what I have to specify for the second rule and why?