Go Back   DaemonForums > Other Operating Systems > Other BSD and UNIX/UNIX-like

Other BSD and UNIX/UNIX-like Any other flavour of BSD or UNIX that does not have a section of its own.

Thread Tools Display Modes
  #1   (View Single Post)  
Old 2nd October 2008
anomie's Avatar
anomie anomie is offline
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 -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 -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

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Quick Ant Question disappearedng FreeBSD General 0 27th October 2008 06:20 AM
Quick question about PHP script 18Googol2 Programming 2 21st September 2008 05:33 AM
quick question about optimizations in /etc/make.conf thevirtuesofxen FreeBSD Installation and Upgrading 7 15th July 2008 10:29 AM
NetBSD reference card Oliver_H NetBSD General 0 8th May 2008 06:20 PM
BBcode tags used to reference manpages ocicat Feedback and Suggestions 3 2nd May 2008 12:05 PM

All times are GMT. The time now is 03:49 AM.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick