View Single Post
  #1   (View Single Post)  
Old 2nd October 2008
anomie's Avatar
anomie anomie is offline
Local
 
Join Date: Apr 2008
Location: Texas
Posts: 445
Default Networking: CLI quick reference

I am taking a (Windows-centric) networking class this week, and some of my classmates expressed an interest in GNU/Linux. I wrote up a little reference sheet for them; it occurred to me that since I went to that trouble I should at least share it here on my favorite forum.

-------

Linux networking / CLI quick reference

Displaying configuration details

Display active interfaces:
$ /sbin/ifconfig

Display routing tables:
$ netstat -rn

Display nameservers:
$ cat /etc/resolv.conf

Display packet filtering (netfilter) rules:
$ sudo /sbin/iptables -nvL | less

See the manpages for ifconfig(8), netstat(8), resolv.conf(5), and iptables(8) for more details.

Basic monitoring and discovery

Display all listening tcp and udp services, suppressing name resolution:
$ netstat -ltun

Display all active tcp and udp connnections:
$ netstat -atu

Determine daemon for all listening tcp and udp services (for ipv4 and ipv6):
$ sudo /usr/sbin/lsof -i

Display active entries in stateful firewall (netfilter):
$ sudo /usr/sbin/iptstate

Perform fast tcp syn scan on remote host:
$ nmap -PN -F some.host.here

Scan entire subnet for any listening http service:
$ nmap 192.168.50.0/24 -p 80

Perform OS detection on remote host, in verbose mode:
$ nmap -v -A some.host.here

Perform three-way tcp handshake with remote service (i.e. connect to tcp service):
$ nc some.host.here 22

Send tcp syn packets using spoofed ip address to remote host's port 21:
$ sudo /usr/sbin/hping -S some.host.here -a 10.80.80.2 -p 21

Capture all outbound http traffic and print ascii to screen:
$ sudo /usr/sbin/tcpdump -A -s 0 dst port 80

See the manpages for netstat(8), lsof(8) , iptstate(1), nmap(1), nc(1), hping2(8), and tcpdump(8) for more details.
__________________
Kill your t.v.
Reply With Quote