Sending and receiving from specified origin and destination
by Jason.nix from LinuxQuestions.org on (#6JPTX)
Hello,
I want server 1 and server 2 to send and receive on port 1024 only from a specific IP address. Are the following iptables rules correct?
Server 1:
Code:-A OUTPUT -d "Server_2_IP" -p tcp -m tcp --dport 1024 -m conntrack --ctstate NEW,ESTABLISHED -j ACCEPT
-A OUTPUT -p tcp -m tcp --dport 1024 -j DROPServer 2:
Code:-A INPUT -s "Server_1_IP" -p tcp -m tcp --dport 1024 -m conntrack --ctstate NEW,ESTABLISHED -j ACCEPT
-A INPUT -p tcp -m tcp --dport 1024 -j DROPThank you.
I want server 1 and server 2 to send and receive on port 1024 only from a specific IP address. Are the following iptables rules correct?
Server 1:
Code:-A OUTPUT -d "Server_2_IP" -p tcp -m tcp --dport 1024 -m conntrack --ctstate NEW,ESTABLISHED -j ACCEPT
-A OUTPUT -p tcp -m tcp --dport 1024 -j DROPServer 2:
Code:-A INPUT -s "Server_1_IP" -p tcp -m tcp --dport 1024 -m conntrack --ctstate NEW,ESTABLISHED -j ACCEPT
-A INPUT -p tcp -m tcp --dport 1024 -j DROPThank you.