Want to ssh from outside my LAN but get "no route to host"

do flag

I have Ubuntu 22.4.2 that I can ssh from my LAN, but not outside of it.

el@KOPPARTS4-PC:~$ ssh  
ssh: connect to host port 22: No route to host  

I think I've forwarded the port correctly in my router, but when I ping or traceroute the server I get a response from a different address.

el@KOPPARTS4-PC:~$ sudo tcptraceroute  
[sudo] password for el:   
traceroute -T -O info 
traceroute to (, 30 hops max, 60 byte packets  
1 (  0.396 ms  0.379 ms  0.374 ms  
2  KOPPARTS4-PC (  1030.840 ms !H  3009.976 ms !H *
user4556274 avatar
ru flag is an [rfc1918]( address which is by definition only useful on a local LAN segment.
Bodo avatar
pt flag
`` is a non-routeable address. Is this the internal IP address of the system in your LAN or the external IP address of your router? If it is the external IP address, then probably your provider uses carrier grade NAT which would not allow you to do what you want. Please [edit] your question to add requested information or clarifiction.
pl flag

From inside your network use curl to find out your public IP address. From outside, ssh to that address, not the private one.

wasabi deadwood avatar
do flag
Thanks, that did it. I've been scratching my head for a month trying to figure this out. I'm obviously new to Linux and learn something everyday. Thanks again for helping expand my knowledge.
I sit in a Tesla and translated this thread with Ai:


Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.