Resolve SSH Connection Problems on MacBook

Resolve SSH Connection Problems on MacBook

Unable to SSH into AWS EC2 instance via Macbook

ยท

2 min read

Overview

This is an anecdote about how I was unable to SSH into the AWS EC2 instance despite having attached the right security groups to my instance.

From my experience, this seems to affect MacBook Pro as well as some Linux OS/virtual machine setups. Interestingly, I did not face this issue while using the newer Mac Mini (Apple M1 chip).


What Happened

When I was trying to learn about AWS EC2 instance on MacBook Pro, I faced the following errors:

# Error 1
client_loop: send disconnect: broken pipe

# Error 2
packet_write_wait: Connection to <ip_address> port <port_number>: Broken pipe

Resolution

I was fortunate to resolve it as my sibling (who's also in the tech industry) had faced this issue previously. The issue is obscure whereby typical users (that's me ๐Ÿ™ˆ ) will not take note of IP quality-of-service (IPQoS) or Differentiated Services Code Point (DSCP) when using SSH.

DSCP is a means to classify and manage network traffic and provide quality of service in the Layer 3 IP networks.

Ad-hoc command option

You will need to include the -o option to indicate the option in the format used in the configuration file. The IPQoS option will be used. Based on some resources, you will need to set the value of IPQoS as throughput or reliability

#Ad-hoc
ssh -o IPQoS=throughput <username>@<target_host_ip_address>

Persistent configuration

For a persistent configuration even after reboot, you will need to define IPQoS=throughput in either of the configuration files

  • User's configuration file (~/.ssh/config)

  • System-wide configuration file (/etc/ssh/ssh_config)

Additional note

I was curious about IPQoS. So I went to look up the SSH manual. Some details are:

  • SSH by default uses low-latency data (af21) for interactive session, i.e. requires user inputs and Lower Effort (cs1).

  • There might be a possibility that the EC2 instance/destination host does not recognize the af21/cs1 DSCP flags, hence terminating the SSH connection as seen from the error messages.

Anyway, that's all for now in sharing a really specific snapshot of my learnings๐Ÿคช Cheers!

Sources

Here are the sources I refer to find out more. Happy reading!

Did you find this article valuable?

Support Nuggets of Wisdom by becoming a sponsor. Any amount is appreciated!

ย