Skip to content

Instantly share code, notes, and snippets.

@scarolan
Last active August 9, 2019 17:42
Show Gist options
  • Save scarolan/1e660409e99db1e83084cacce2d64ab4 to your computer and use it in GitHub Desktop.
Save scarolan/1e660409e99db1e83084cacce2d64ab4 to your computer and use it in GitHub Desktop.
Useful network troubleshooting commands

Handy Network Troubleshooting Commands

Nmap

Nmap is an all-purpose network and port scanner. It can scan hundreds of hosts and ports quickly, across a variety of protocols and situations. Here are a few basic commands that you can use:

Check that ports 8200 and 8201 are listening on a host. The Pn flag tells nmap to skip the preliminary ping to see if the host is up.

nmap -p 8200,8201 10.0.1.10 -Pn

Tcpdump

Tcpdump lets you see raw TCP packets coming across a network interface on the machine. This can be helpful when you need to determine whether traffic is even reaching a host and what it looks like.

Show all traffic on port 8201 except from the load balancer at 10.0.1.117. Do not resolve hostnames and ports into names, leave them as numbers (-nn)

tcpdump -nn port 8201 and not host 10.0.1.117

Capture everything on the eth0 interface

tcpdump -i eth0

Openssl

The openssl command can be used to inspect an SSL certificate to see if it is valid and check its configuration: https://www.sslshopper.com/article-most-common-openssl-commands.html

Check a certificate

openssl x509 -in certificate.crt -text -noout

Check a private key

openssl rsa -in privateKey.key -check

Certbot/Letsencrypt

Create a new SSL certificate for your domain or subdomain. Must be able to create DNS records in your domain to do this:

Wildcard cert for all of hashidemos.io

certbot certonly --server https://acme-v02.api.letsencrypt.org/directory --manual --preferred-challenges dns-01 -d *.hashidemos.io

Cert for foo.hashidemos.io and bar.hashidemos.io

certbot certonly --server https://acme-v02.api.letsencrypt.org/directory --manual --preferred-challenges dns-01 -d foo.hashidemos.io -d bar.hashidemos.io
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment