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.

In iptables, what is the difference between --dport ssh and --dport 22? i.e. when I change the port in sshd's settings, will iptables automatically get the new port and use that wherever --dport ssh is specified, or will it still use 22?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

When you use a name it will do a look-up on what is defined in your /etc/services. What you have defined in your openssh's sshd_config is completely irrelevant. The name is only evaluated when the rule is being added to the kernel tables. Once the rule has been added, any subsequent changes to /etc/services do not automatically result in a change of the rule.

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.