Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have 2 servers and want to be able to connect via SSH from server A to B and vice versa. What Iptables rules should I set on both machines to make this possible ? SSH is runnning on default port 22

share|improve this question
    
possible duplicate of iptables Ubuntu VPS SSH rule –  mailq Oct 2 '11 at 20:20

1 Answer 1

You should add the next rule to both hosts. You can define source and destination ip address (-d) in case you only want to connect from this hosts in a bilateral connection. In any case you should take a look to the iptables documentation

iptables -A INPUT -p tcp --dport 22 --m state --state NEW,ESTABLISHED -j ACCEPT

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.