This document is publicly accessible at http://bit.ly/ickl-networking-101 

Networking 101 with *nix Command Line Tools

SSH - remote secure shell access

NC - the networking swiss army knife

TELNET - play around with line-based protocols

LSOF - who is having my ports?

DIG - troubleshoot your DNS

TRACEROUTE - find out how your packets are moving about

PING - i think almost everyone knows this

Python Tools

Web Server

Mail Server

Debugging Server

Proxy Server

SSH - remote secure shell access

NC - the networking swiss army knife

TELNET - play around with line-based protocols

$ telnet smtp.gmail.com 25

$ telnet google.com 80

LSOF - who is having my ports?

$ lsof -i :PORT_NUMBER

DIG - troubleshoot your DNS

$ dig -t ANY infinite-code.com

$ dig -t ANY www.infinite-code.com

TRACEROUTE - find out how your packets are moving about

$ traceroute infinite-code.com

NOTES:

PING - i think almost everyone knows this

$ ping google.com

PING google.com (173.194.120.97): 56 data bytes

64 bytes from 173.194.120.97: icmp_seq=0 ttl=57 time=41.138 ms

64 bytes from 173.194.120.97: icmp_seq=1 ttl=57 time=43.198 ms

64 bytes from 173.194.120.97: icmp_seq=2 ttl=57 time=41.232 ms

64 bytes from 173.194.120.97: icmp_seq=3 ttl=57 time=44.689 ms

--- google.com ping statistics ---

86 packets transmitted, 85 packets received, 1.2% packet loss

round-trip min/avg/max/stddev = 39.464/42.280/78.773/6.608 ms

Python Tools

Web Server

Has been in standard library for a long time. Instantly host the contents in the folder you can the command, by default port 8000, you can change the port if needed.

# runs on port 8000

$ python -m SimpleHTTPServer

# if you want to run on another port

$ python -m SimpleHTTPServer 8001

Mail Server

Debugging Server

Doesn’t really send out the mail. Just print out in stdout/console.

$ python -msmtpd --class DebuggingServer --debug -n

Simple tutorial on SMTP commands:

Proxy Server

Print out in stdout/console and relay to real mail server.

$ python -msmtpd --debug -n

ADVERTORIAL :)

This document is created as one of the “Sharing Sessions” that we hold once/twice monthly at Infinite Code mostly on Fridays. We build custom web and mobile apps and we love technology, open source and things geeky.