LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Sending and receiving from specified origin and destination (https://www.linuxquestions.org/questions/linux-newbie-8/sending-and-receiving-from-specified-origin-and-destination-4175733957/)

Jason.nix 02-17-2024 05:00 AM

Sending and receiving from specified origin and destination
 
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 DROP

Server 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 DROP

Thank you.


All times are GMT -5. The time now is 06:18 AM.