Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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


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.