Running SSHD on 2 ports?


I need to run SSHD on 2 ports on my Gentoo Linux server.

From the top of the config I grabbed this which should tell you what version I'm using.
'OpenBSD: sshd_config,v 1.69 2004/05/23 23:59:53 dtucker Exp'

Why do I need it on 2 ports? So for internal access I can still connect to 22, and from externally (since my router does not allow routing from one port to a different port, I would like to use a different port number so it's less likely to be hacked.


Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

iptables can do that
for example
iptables -t nat -A PREROUTING  -p tcp -d 0/0 --dport 2222 -j DNAT  --to

all connection make to port 2222 go to port 22 for example

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
H4InfAuthor Commented:
Fantastic! That was easy.

I also discovered in my searches that you can enter 2 Port lines into the sshd_config file - and it will run on both.

Either way does the trick! Cheers
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux Networking

From novice to tech pro — start learning today.