Ssh no route to host linux

SSH Connection Error: No route to host

All the machines have Ubuntu 11.04 (Desktop A is a 64bit one) and have both openssh-server and openssh-client.

Now when I try to connect Desktop A to Laptop A or vice-versa by ssh user@1.23.y.y I get an error as

I own both the machines, now if I try same commands from my friend’s machine, i.e. via Desktop B, I can access both my Laptop and Desktop. But if I try to access Desktop B from my Laptop or by Desktop I get

port 22: Connection timed out 

I even tried changing ssh port no. in ssh_config file but no success.

Note: that ‘Laptop A’ uses WiFi connection while ‘Machine A’ uses Ethernet Connection and ‘Machine B’ is on an entirely different network.

@Lekensteyn Here it is ->

Laptop A && Desktop A -> Router/Nano_Rcvr provided to me by ISP. So to one Router two Machines are connected and can be accessed at the same time. here is my ifconfig output for both the machines :- Laptop

 Link encap:Ethernet HWaddr X:X:X:X:00:bc inet addr:1.23.73.111 Bcast:1.23.95.255 Mask:255.255.224.0 inet6 addr: fe80::219:e3ff:fe04:bc/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:108409 errors:0 dropped:0 overruns:0 frame:0 TX packets:82523 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:44974080 (44.9 MB) TX bytes:22973031 (22.9 MB) 
 Link encap:Ethernet HWaddr X:X:X:X:c5:78 inet addr:1.23.68.209 Bcast:1.23.95.255 Mask:255.255.224.0 inet6 addr: fe80::227:eff:fe04:c578/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:10380 errors:0 dropped:0 overruns:0 frame:0 TX packets:4509 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:1790366 (1.7 MB) TX bytes:852877 (852.8 KB) Interrupt:43 Base address:0x2000 

Output of ip route show

 1.23.64.0/19 dev wlan0 proto kernel scope link src 1.23.73.111 metric 2 169.254.0.0/16 dev wlan0 scope link metric 1000 

Output of traceroute -n 1.23.73.111

 traceroute to 1.23.73.111 (1.23.73.111), 30 hops max, 60 byte packets 1 1.23.68.209 3008.787 ms !H 3008.786 ms !H 3008.784 ms !H 

Please correct those IP addresses. Is 1.23.x.x a public IP address? If not, please use 10.x.x.x, 192.168.x.x or 172.16.x.x. Can you ping the other machines? ping 192.168.x.x

Sounds weird but its a public IP Addr if u want I can give you ‘ifconfig’ output. No I cant Ping both my machines it says ‘Destination Host Unrechable’ Though I can ping my friend’s machine

Could you draw your network setup? ASCII art will be fine. You need to include the machines, the «internet» and involved (home) routers/modems.

I agree with @Lekensteyn. These problems are most commonly NAT/forwarding issues. Explain your network structure and we can probably help.

8 Answers 8

The routes look fine. I’ll assume that those IP addresses are private ones (LAN) and not public accessible.

Читайте также:  Linux kaspersky защита выключена

Since you’re connected in different ways to the network (wifi / wired), it’s very likely that your router has separated wired / wireless networks. Try connecting both of them on a wired (or wireless) connection. Another possibility is that a firewall on the Ubuntu machines is blocking connections.

Otherwise, configure your router to use the same network (subnet) for wireless and wired connections. Also make sure that the router does not block client-to-client communication.

Your router is possibly dropping all unsolicited packets, that’s why your friend gets a «connection timed out» message on your public IP address. Configure NAT port forwarding so that the public IP address + port combination forwards to your LAN address.

YOUR NETWORK (A) Router A (public address: 198.51.100.1) Desktop A - 10.0.0.2 Laptop A - 10.0.0.3 YOUR FRIENDS NETWORK (B) Router B (public address: 203.0.113.1) Machine B - 192.168.0.2 

On Router A, setup NAT forwarding:

To make your desktop accessible: forward the public port 22 to 10.0.0.2 To make your laptop accessible: forward the public port 2222 to 10.0.0.3 

If you’ve a firewall ( ufw , iptables , . ) on the machines set, allow incoming traffic to port 22 (Desktop A) and port 2222 (Laptop A).

The desktop can now be accessed using SSH with:

The laptop can now be accessed using SSH with:

If you want to access your friends machine, apply these instructions to his machine + router.

Источник

How to Fix No route to host SSH Error in Linux?

As a Linux user, the Secure Shell (SSH) protocol has likely played an essential role in your daily computing tasks. SSH is a network protocol that provides secure access to remote systems and enables users to execute commands on a remote machine from their local computer. The protocol is designed with strong encryption techniques that prevent data tampering and eavesdropping by unauthorized personnel.

In Linux, SSH is the most commonly used method for accessing remote servers, managing cloud infrastructure, and performing system administration tasks. This article will focus on troubleshooting one of the common errors encountered while using SSH in Linux – the «No Route to Host» error message.

Brief Explanation of the No Route to Host SSH Error

The «No route to host» error message typically occurs when there is no path for establishing communication between two devices attempting an SSH connection. It could mean that either the server you’re attempting to connect is down or there’s no way for your computer’s network interface card (NIC) or router settings are blocking traffic from reaching the server. The error message can also show up when the SSH service is not running on the remote host or when there’s an incorrect port number or login credentials.

As a result, it’s essential to understand why this error occurs and the various ways to troubleshoot and fix it. This article will guide you through the troubleshooting process, making it easier for you to resolve the «No route to host» SSH error in Linux.

Читайте также:  Mercusys n150 driver linux

Understanding the No route to host SSH Error

Causes of the Error

Before delving into how to troubleshoot the No route to host SSH error, it is important to understand what causes this error in Linux. The most common cause of this error is that the remote server is not reachable. This can happen due to a variety of reasons, including network connectivity issues, incorrect IP address, or firewall settings that are blocking incoming traffic.

Another possible cause of this error is that the SSH service on the remote host is not running properly. If the SSH service is down or has stopped working for some reason, then you will not be able to connect remotely using SSH.

Symptoms of the Error

When you encounter a No route to host SSH error in Linux, there are several symptoms you may experience. These include −

  • The connection attempt may fail with an immediate error message.
  • You may receive an «unreachable» message when attempting to ping the remote server’s IP address.
  • You may be prompted for login credentials repeatedly without being able to log in successfully.
  • You may receive a «connection refused» or «network unreachable» message when using telnet or other network tools.

If you experience any of these symptoms while attempting to connect remotely via SSH, it’s likely that you are encountering a No route to host SSH error and will need to troubleshoot accordingly. By understanding both what causes this error and what symptoms indicate its presence, you’ll be better equipped to identify and resolve any issues preventing successful connections via SSH.

Troubleshooting Steps for Fixing No route to host SSH Error in Linux

Step 1: Check Network Connectivity

One of the most common causes of the no route to host SSH error is a network connectivity issue. When this error occurs, it means that your computer is unable to connect to the remote server or device hosting the SSH service. Therefore, you should begin by checking your network connection.

The first thing you can do is use the ping command to check if your computer can communicate with the remote host. The ping command sends packets of data to a specific IP address and waits for a response from that address.

If it receives a response, then your network connectivity is working correctly. You can also check your IP address using the ifconfig or ip addr show command in Linux terminal.

Ensure that the IP address matches what you expect and that it’s on the same subnet as the remote host’s IP address. Additionally, ensure that there are no firewall rules blocking communication between your computer and the remote host.

Step 2: Verify SSH Service is Running on Remote Host

If you have verified that there are no issues with your network connectivity, then you should verify that SSH service is running on the remote host. One way to do this is by using netstat command which displays all open ports and active connections on both UDP and TCP protocols. You can also use systemctl command which displays all services running in Linux operating system including sshd service.

systemctl status ssh.service

Step 3: Verify Correct Port Number is Used

The sshd_config file specifies which port number SSH service listens on and communicates through. It’s essential to ensure that you’re connecting through this correct port number; otherwise, this error might occur.

Читайте также:  Sudo apt get remove linux

You can check the port number specified in the sshd_config file by using the cat command and examining the contents of this file. Additionally, you can use nmap command to scan ports on the remote host and verify which port number SSH service is running through.

Step 4: Ensure Correct User Credentials are Used

If you have verified that both your network connectivity and SSH service are working correctly, then it’s time to ensure that you’re using correct user credentials. You should double-check that your username and password are correct and match what’s allowed on the remote host.

If you’re using public key authentication, verify that your public key is present on the remote server. It should be located in ~/.ssh/authorized_keys for your user account.

Overall, these troubleshooting steps should help resolve no route to host SSH error in Linux provided there are no hardware issues with either device involved in communication. Keep these steps handy to save yourself time and frustration when encountering this error again.

Importance of understanding and fixing no route to host ssh error

The «No Route to Host SSH Error» is an issue that can occur due to various reasons such as network connectivity problems, incorrect SSH configuration settings or user authentication issues. It can be frustrating because it prevents users from connecting remotely via SSH.

However, it’s essential to understand how this error occurs and how to fix it because SSH plays a critical role in managing Linux systems remotely. For instance, system administrators use SSH for configuration management tasks such as software updates or security patches installation.

Moreover, organizations rely on remote access via SSH for their day-to-day operations which means any disruption can lead to significant downtime causing financial losses or productivity issues. Therefore, being able to troubleshoot and resolve «No Route to Host SSH Error» promptly will help minimize downtime and keep your Linux systems running smoothly.

Conclusion

Fixing the «No route to host SSH Error» in Linux requires a structured approach and a thorough understanding of the potential causes. The first step is to check network connectivity by using ping command, checking IP addresses and firewall settings.

If the network is fine, then it’s essential to verify that the SSH service is running on the remote host by using netstat command or systemctl command. Another critical factor to consider is ensuring that you are using the correct port number.

Check port number in sshd_config file or verify port number using nmap command. Make sure that you are entering the correct username and password and verifying the user’s public key.

Источник

Оцените статью
Adblock
detector