View the system's routing table
View active or listening TCP and UDP services
Other network statistics
-I <int> show stats for specific NIC
-a show 'server' socket state too
-f inet only show IPv4 info
-n don't do IP -> name (DNS) lookups
-r show system routing table
netstat -a -n -f inet
Use netstat to see established and open TCP/UDP sockets
netstat -a -f unix
Similar information for Unix sockets
netstat -q -i
Usage statistics for interfaces by protocol
The -q limits output to interfaces in use

Static IP config looks like this:
feanor % cat /etc/hostname.fxp0
inet 128.138.220.44 255.255.255.0 NONE
DHCP looks like this:
feanor % cat /etc/hostname.wi0
dhcp NONE NONE NONE
feanor % cat /etc/mygate
128.138.220.1
Client lease info found in /var/db/dhclient.leases
Configuration info in /etc/dhclient.conf
You don't have to touch this usually
Add your own DNS domains or requested hostname
send host-name "feanor";
append domain-name " cs.colorado.edu colorado.edu";
Use -a to see info about all interfaces
Use netstat -i if -a doesn't work (e.g. on HP/UX)
Specify an interface to view it only
% ifconfig <int> down
% ifconfig <int> up <ip> netmask <nm>
DNS - the Domain Name System
/etc/hosts - the traditional local file
NIS / NIS+ - Sun's Problem..
A 'hosts' entry designates one or more sources
feanor % ssh bfs grep hosts /etc/nsswitch.conf
hosts: files dns
bfs will look in its own /etc/hosts file first
and then (via /etc/resolv.conf) try DNS
'search' line gives domains to look in
'nameserver' lines give IP addrs of DNS nameservers to use
Specify up to three, they are tried in order
OpenBSD has an optional 'lookup' line where you specify to look in /etc/hosts first
coatl % cat /etc/resolv.conf
search cs.colorado.edu colorado.edu
nameserver 128.138.242.197
nameserver 128.138.192.220
nameserver 128.138.192.205
lookup file bind
% netstat -rn -f inet
Each line describes a DESTINATION known to the system
Flags may be:
U Usable route
G Destination will forward
R Destination un-Reachable
S Static route
L Link address known
H Destination is a Host
Next Hop routing
Outgoing packet's destination IP addr is matched in route table
Longest match determines route chosen
Small networks with few hosts
Simple network topologies
General syntax of route is:
% route <cmd> [<args>]
Commands are:
add Add a route.
delete Delete a specific route.
change Change aspects of a route
flush Remove all routes.
There are commands for viewing routes too