Rack of Ethernet switches.

Networking Commands for Linux/UNIX, Android, Apple OS X, Windows, and Cisco IOS

TCP/IP Commands and Example Output

The following commands will report the TCP/IP configuration — IPv4/IPv6 addresses and netmasks, routing table, and more — on Linux, Android, Apple OS X, Windows, and Cisco operating systems, plus the rest of the entire Unix family of operating systems. "Unix" includes anything vaguely Unix-like — Linux, Android, BSD, Tru64, Solaris, HP-UX, AIX, IRIX, etc., plus Mac OS X. Many of these commands help you troubleshoot network problems.

Note that the Cisco IOS allows for command abbreviation. That is, instead of:

router> show interfaces

you could simply type:

router> sh in

However, I prefer to use the entire command, using the tab key for command completion. You type just sh and then press <tab>:

router> sh<tab>

and the system finishes the command itself:

router> show

At that point you could press ? to see what alternatives are available (in the case of the show command, quite a few!), and then type enough of the parameter to be unambiguous:

router> show in<tab>

and it finishes the parameter for you:

router> show interfaces

Just two more key presses gives you a clear explanation of what it's doing. More importantly, your typing errors become much more obvious!

The GNU implementations of command shells including Bash, Tcsh, and others also support command and filename completion. These are what you have in Linux, Android, and OS X environments, and what you can have in commercial Unix environments once you add the appropriate GNU package.

Be aware that the networking commands on Linux have gone through a major redesign! The traditional tools including ifconfig, netstat, route, and others may still be available and work as expected, but you may have only the Iproute2 project tools installed. With Android, for example, you get only the new Iproute2 versions. Both the traditional and the Iproute2 versions are explained here.

Learn the new commands using ip.

Also be aware that the move to systemd on Linux has changed the network interface names. You no longer have the expected eth0, eth1, wlan0, and so on.

On-board Ethernet devices will be named eno1, eno2, and so on, or em1, em2, and so on. On VMware, a bug leads to the nonsensical numbered name eno16777736. One workaround is to edit the *.vmx line and change the number found here:
ethernet0.pciSlotNumber="33"
from 33 to a smaller unused number such as 20. In base 16, 20 is 0x14. That virtual Ethernet device will appear at PCI bus address 00:14.0, and it will be enp0s20. Experiment: not all numbers will work, many will result in 16777736.

PCI Express hotplug devices will be ens1, ens2, ...

PCI bus addresses may be used, an Ethernet device at PCI bus address 02:00.0 will be enp2s0. The Bus:Device.Function specification is in hexadecimal, PCI address 00:14.0 leads to enp0s20.
Alternatively, as per this Fedora page, "... ports on PCI cards will be named p<slot_number>p<port_number>, corresponding to the chassis labels," so p3p1 or similar.

USB-connected devices will have names containing the PCI bus address of the USB controller, and the USB bus and device number. If the USB controller is at PCI bus address 00:03.0 (PCI bus 00, slot 03, function 0), and a wireless network interface is plugged into USB bus 1 as device 4, it will be wlp0s3f1u4.

Finally, MAC addresses may be used: enx0011951E8EB6.

Alpha DS10 and Alphastation 200 4/233 servers running Linux and OpenBSD Unix.  The DEC Alpha servers are providing high-speed network services, as web servers and file servers.

AlphaServer DS10 and AlphaStation 200 4/233 running Linux and OpenBSD Unix.

Extra-Short Version

Here is an extra-short version with no explanations and no example output. Maybe all you need is a reminder!

LAN Information
Unix netstat -i
Linux/Android ip -s link
ifstat
Windows netstat -e
Cisco show interfaces
Interface media settings
Linux ethtool interfacename
BSD / OS X ifconfig -m
ifconfig interfacename media
Cisco show interfaces
ARP cache, IPv4—MAC
Unix, Windows arp -a
Linux, Android ip neigh
Cisco show arp
NDP cache, IPv6—MAC
Linux / Android ip -6 neigh show
BSD / OS X ndp -a
Windows netsh interface ipv6 show neighbors
IP address / netmask
Unix, OS X ifconfig -a
Linux, Android ip addr
Windows ipconfig /all
Cisco show ip config
show running-config
show protocols
show interfaces
IPv4 / IPv6 routing table
Unix, OS X netstat -nr
netstat -nr -A inet6
netstat -nr -f inet6
Linux, Android ip route
ip -6 route
Windows netstat -nr
Cisco show ip route
UDP/TCP services
Unix, Android, OS X, Windows netstat -a
Linux ss -a
Cisco show tcp [ brief ]
UDP/TCP/IP counters (statistics)
Unix, Android, OS X, Windows netstat -s
Cisco show interfaces
show ip traffic
show tcp statistics

LAN Information (OSI Layer 1 and 2)

Display the interface statistics (packets received and sent, errors, collisions, maybe the rate of packets or bytes per second, maybe the MAC addresses)

Traditional Linux, Unix and OS X

netstat -i

Linux example:

Linux$ netstat -i
Kernel Interface table
Iface  MTU Met    RX-OK RX-ERR RX-DRP RX-OVR    TX-OK TX-ERR TX-DRP TX-OVR Flg
eth0  1500   0 46249635      0      0      0 46076591      0      0      3 BMRU
eth1  1500   0   780201      2      2      2   774526      0      0      8 BMRU
lo   16436   0   755482      0      0      0   755482      0      0      0 LRU

On Linux, also try ethtool -S eth0

In this BSD and OS X example, I'm adding -n to leave addresses numeric. The following example is from an OpenBSD laptop where:
lo0 = Loopback pseudo-device
sis0 = Ethernet
enc0 = Encapsulation pseudo-device

BSD/OSX$ netstat -i -n
Name    Mtu   Network     Address              Ipkts Ierrs    Opkts Oerrs Colls
lo0     33208 <Link>                              12     0       12     0     0
lo0     33208 127/8       127.0.0.1               12     0       12     0     0
lo0     33208 ::1/128     ::1                     12     0       12     0     0
lo0     33208 fe80::%lo0/ fe80::1%lo0             12     0       12     0     0
sis0    1500  <Link>      00:11:43:44:8a:9b     1522     0      899     0     0
sis0    1500  fe80::%sis0 fe80::211:43ff:fe     1522     0      899     0     0
sis0    1500  10.1.1/24   10.1.1.230            1522     0      899     0     0
enc0*   1536  <Link>                               0     0        0     0     0

Solaris 10 / SunOS 5.10 example:

Solaris$ netstat -in
Name  Mtu  Net/Dest      Address        Ipkts  Ierrs Opkts  Oerrs Collis Queue 
lo0   8232 127.0.0.0     127.0.0.1      1679079 0     1679079 0     0      0     
ce0   1500 10.1.2.0      10.1.2.72      351818291 0     229839621 0     0      0     

Name  Mtu  Net/Dest                    Address                     Ipkts  Ierrs Opkts  Oerrs Collis
lo0   8252 ::1                         ::1                         1679079 0     1679079 0     0     
ce0   1500 fe80::203:baff:fe09:3d51/10 fe80::203:baff:fe09:3d51    351818291 0     229839621 0     0     

Iproute2 on Linux and Android

ip -s link
ifstat 

Linux with two Ethernet interfaces and one wireless LAN interface:

Linux$ ip -s link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    RX: bytes  packets  errors  dropped overrun mcast   
    80889401   246161   0       0       0       0      
    TX: bytes  packets  errors  dropped carrier collsns 
    80889401   246161   0       0       0       0      
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 576 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000
    link/ether 00:11:95:1e:8e:b6 brd ff:ff:ff:ff:ff:ff
    RX: bytes  packets  errors  dropped overrun mcast   
    1412616000 3298189  0       0       0       0      
    TX: bytes  packets  errors  dropped carrier collsns 
    206636541  1651129  0       0       0       0      
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000
    link/ether 6c:62:6d:b2:f8:41 brd ff:ff:ff:ff:ff:ff
    RX: bytes  packets  errors  dropped overrun mcast   
    882299653  2376329  0       0       0       0      
    TX: bytes  packets  errors  dropped carrier collsns 
    2428621918 2630472  0       0       0       0      
4: wlp0s3f1u4: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DORMANT group default qlen 1000
    link/ether c8:3a:35:cf:3b:b9 brd ff:ff:ff:ff:ff:ff
    RX: bytes  packets  errors  dropped overrun mcast   
    1811540993 1214909  0       0       0       0      
    TX: bytes  packets  errors  dropped carrier collsns 
    57537735   653205   0       0       0       0

Linux$ ifstat
#kernel
Interface        RX Pkts/Rate    TX Pkts/Rate    RX Data/Rate    TX Data/Rate  
                 RX Errs/Drop    TX Errs/Drop    RX Over/Rate    TX Coll/Rate  
lo                245948 0        245948 0       153125K 0       153125K 0      
		       0 0             0 0             0 0             0 0      
eth0               3446K 0         1721K 0         1173M 0       231962K 0      
		       0 0             0 0             0 0             0 0      
eth1               1134K 0         1003K 0       589056K 0       365903K 0      
		       0 0             0 0             0 0             0 0      
wlp0s3f1u4         37235 0         14930 0        42507K 0         1380K 0      
		       0 0             0 0             0 0             0 0      

Android on a Samsung Galaxy smart phone with the 802.11 wireless enabled. What a large number of interfaces!

Android$ ip -s link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    RX: bytes  packets  errors  dropped overrun mcast   
    8897040    10038    0       0       0       0      
    TX: bytes  packets  errors  dropped carrier collsns 
    8897040    10038    0       0       0       0      
2: dummy0: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN 
    link/ether 8e:ec:ea:56:b7:41 brd ff:ff:ff:ff:ff:ff
    RX: bytes  packets  errors  dropped overrun mcast   
    0          0        0       0       0       0      
    TX: bytes  packets  errors  dropped carrier collsns 
    0          0        0       0       0       0      
3: rmnet0: <BROADCAST,MULTICAST> mtu 2000 qdisc noop state DOWN qlen 1000
    link/ether 7a:ac:20:6b:aa:ce brd ff:ff:ff:ff:ff:ff
    RX: bytes  packets  errors  dropped overrun mcast   
    0          0        0       0       0       0      
    TX: bytes  packets  errors  dropped carrier collsns 
    0          0        0       0       0       0      
4: rmnet1: <BROADCAST,MULTICAST> mtu 2000 qdisc noop state DOWN qlen 1000
    link/ether 7e:47:97:18:e5:29 brd ff:ff:ff:ff:ff:ff
    RX: bytes  packets  errors  dropped overrun mcast   
    0          0        0       0       0       0      
    TX: bytes  packets  errors  dropped carrier collsns 
    0          0        0       0       0       0      
5: rmnet2: <BROADCAST,MULTICAST> mtu 2000 qdisc noop state DOWN qlen 1000
    link/ether 5a:2c:99:7d:29:e8 brd ff:ff:ff:ff:ff:ff
    RX: bytes  packets  errors  dropped overrun mcast   
    0          0        0       0       0       0      
    TX: bytes  packets  errors  dropped carrier collsns 
    0          0        0       0       0       0      
6: rmnet3: <BROADCAST,MULTICAST> mtu 2000 qdisc noop state DOWN qlen 1000
    link/ether 22:00:f5:c2:f5:d5 brd ff:ff:ff:ff:ff:ff
    RX: bytes  packets  errors  dropped overrun mcast   
    0          0        0       0       0       0      
    TX: bytes  packets  errors  dropped carrier collsns 
    0          0        0       0       0       0      
7: rmnet4: <BROADCAST,MULTICAST> mtu 2000 qdisc noop state DOWN qlen 1000
    link/ether 3a:bd:5b:f2:ed:9f brd ff:ff:ff:ff:ff:ff
    RX: bytes  packets  errors  dropped overrun mcast   
    0          0        0       0       0       0      
    TX: bytes  packets  errors  dropped carrier collsns 
    0          0        0       0       0       0      
8: rmnet5: <BROADCAST,MULTICAST> mtu 2000 qdisc noop state DOWN qlen 1000
    link/ether da:ee:98:aa:0b:b7 brd ff:ff:ff:ff:ff:ff
    RX: bytes  packets  errors  dropped overrun mcast   
    0          0        0       0       0       0      
    TX: bytes  packets  errors  dropped carrier collsns 
    0          0        0       0       0       0      
9: rmnet6: <BROADCAST,MULTICAST> mtu 2000 qdisc noop state DOWN qlen 1000
    link/ether 8a:68:0b:1b:fd:f0 brd ff:ff:ff:ff:ff:ff
    RX: bytes  packets  errors  dropped overrun mcast   
    0          0        0       0       0       0      
    TX: bytes  packets  errors  dropped carrier collsns 
    0          0        0       0       0       0      
10: rmnet7: <BROADCAST,MULTICAST> mtu 2000 qdisc noop state DOWN qlen 1000
    link/ether 4a:16:9a:22:9c:59 brd ff:ff:ff:ff:ff:ff
    RX: bytes  packets  errors  dropped overrun mcast   
    0          0        0       0       0       0      
    TX: bytes  packets  errors  dropped carrier collsns 
    0          0        0       0       0       0      
11: rmnet_sdio0: <> mtu 1500 qdisc pfifo_fast state DOWN qlen 1000
    link/[530] 
    RX: bytes  packets  errors  dropped overrun mcast   
    130307791  158972   0       0       0       0      
    TX: bytes  packets  errors  dropped carrier collsns 
    20301720   148283   0       0       0       0      
12: rmnet_sdio1: <> mtu 2000 qdisc noop state DOWN qlen 1000
    link/[530] 
    RX: bytes  packets  errors  dropped overrun mcast   
    0          0        0       0       0       0      
    TX: bytes  packets  errors  dropped carrier collsns 
    0          0        0       0       0       0      
13: rmnet_sdio2: <> mtu 2000 qdisc noop state DOWN qlen 1000
    link/[530] 
    RX: bytes  packets  errors  dropped overrun mcast   
    0          0        0       0       0       0      
    TX: bytes  packets  errors  dropped carrier collsns 
    0          0        0       0       0       0      
14: rmnet_sdio3: <> mtu 2000 qdisc noop state DOWN qlen 1000
    link/[530] 
    RX: bytes  packets  errors  dropped overrun mcast   
    0          0        0       0       0       0      
    TX: bytes  packets  errors  dropped carrier collsns 
    0          0        0       0       0       0      
15: rmnet_sdio4: <> mtu 2000 qdisc noop state DOWN qlen 1000
    link/[530] 
    RX: bytes  packets  errors  dropped overrun mcast   
    0          0        0       0       0       0      
    TX: bytes  packets  errors  dropped carrier collsns 
    0          0        0       0       0       0      
16: rmnet_sdio5: <> mtu 2000 qdisc noop state DOWN qlen 1000
    link/[530] 
    RX: bytes  packets  errors  dropped overrun mcast   
    0          0        0       0       0       0      
    TX: bytes  packets  errors  dropped carrier collsns 
    0          0        0       0       0       0      
17: rmnet_sdio6: <> mtu 2000 qdisc noop state DOWN qlen 1000
    link/[530] 
    RX: bytes  packets  errors  dropped overrun mcast   
    0          0        0       0       0       0      
    TX: bytes  packets  errors  dropped carrier collsns 
    0          0        0       0       0       0      
18: rmnet_sdio7: <> mtu 2000 qdisc noop state DOWN qlen 1000
    link/[530] 
    RX: bytes  packets  errors  dropped overrun mcast   
    0          0        0       0       0       0      
    TX: bytes  packets  errors  dropped carrier collsns 
    0          0        0       0       0       0      
19: sit0: <NOARP> mtu 1480 qdisc noop state DOWN 
    link/sit 0.0.0.0 brd 0.0.0.0
    RX: bytes  packets  errors  dropped overrun mcast   
    0          0        0       0       0       0      
    TX: bytes  packets  errors  dropped carrier collsns 
    0          0        0       0       0       0      
20: ip6tnl0: <NOARP> mtu 1452 qdisc noop state DOWN 
    link/tunnel6 :: brd ::
    RX: bytes  packets  errors  dropped overrun mcast   
    0          0        0       0       0       0      
    TX: bytes  packets  errors  dropped carrier collsns 
    0          0        0       0       0       0      
21: p2p0: <NO-CARRIER,BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state DORMANT qlen 1000
    link/ether 02:37:6d:a9:b9:35 brd ff:ff:ff:ff:ff:ff
    RX: bytes  packets  errors  dropped overrun mcast   
    0          0        0       0       0       0      
    TX: bytes  packets  errors  dropped carrier collsns 
    0          0        0       0       0       0      
22: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 00:37:6d:a9:b9:35 brd ff:ff:ff:ff:ff:ff
    RX: bytes  packets  errors  dropped overrun mcast   
    50971645   663955   0       902     0       394    
    TX: bytes  packets  errors  dropped carrier collsns 
    1814368098 1215089  0       3349    0       0      

Windows

netstat -e
C:\>netstat -e
Interface Statistics
                      Received        Sent
Bytes                  1160647      105766
Unicast packets            858         200
Non-unicast packets         70          45
Discards                     0           0
Errors                       0           0
Unknown protocols            0 

Cisco

show interfaces
router> show interfaces ethernet 0
Ethernet0 is up, line protocol is up
  Hardware is Lance, address is 0000.0c8e.b534 (bia 0000.0c8e.b534)
  Internet address is 10.1.1.254/24
  MTU 1500 bytes, BW 10000 Kbit, DLY 1000 usec, rely 255/255, load 2/255
  Encapsulation ARPA, loopback not set, keepalive set (10 sec)
  ARP type: ARPA, ARP Timeout 04:00:00
  Last input 00:00:00, output 00:00:00, output hang never
  Last clearing of "show interface" counters never
  Queueing strategy: fifo
  Output queue 0/40, 0 drops; input queue 1/75, 0 drops
  5 minute input rate 108000 bits/sec, 18 packets/sec
  5 minute output rate 107000 bits/sec, 18 packets/sec
     6080 packets input, 4156592 bytes, 0 no buffer
     Received 869 broadcasts, 0 runts, 0 giants, 0 throttles
     0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 0 abort
     0 input packets with dribble condition detected
     5858 packets output, 4036087 bytes, 0 underruns
     0 output errors, 0 collisions, 10 interface resets
     0 babbles, 0 late collision, 0 deferred
     0 lost carrier, 0 no carrier
     0 output buffer failures, 0 output buffers swapped out

Display the interface media settings and options (RJ-45 vs AUI interface, media speed and duplex settings, MTU, etc)

Linux

ethtool interface

Linux has ethtool, I don't know of an equivalent in Android.

Linux# ethtool eth0
Settings for eth0:
        Supported ports: [ TP MII ]
        Supported link modes:   10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
        Supports auto-negotiation: Yes
        Advertised link modes:  10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
        Advertised auto-negotiation: Yes
        Speed: 100Mb/s
        Duplex: Full
        Port: MII
        PHYAD: 32
        Transceiver: internal
        Auto-negotiation: on
        Supports Wake-on: pumbg
        Wake-on: d
        Current message level: 0x00000007 (7)
	Link detected: yes 

BSD and OS X

ifconfig -m
    or, depending on version
ifconfig interface media 
BSD/OSX$ ifconfig sis0 media
sis0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
        lladdr 00:11:43:44:8a:9b
        groups: egress
        media: Ethernet autoselect (100baseTX full-duplex)
        status: active
        supported media:
                media 10baseT
                media 10baseT mediaopt full-duplex
                media 100baseTX
                media 100baseTX mediaopt full-duplex
                media autoselect
        inet6 fe80::211:43ff:fe44:8a9b%sis0 prefixlen 64 scopeid 0x1
	inet 10.1.1.230 netmask 0xffffff00 broadcast 10.1.1.255 

Cisco

show interfaces

See the example in the above section.

Display the ARP and NDP cache

ARP maps between IPv4 and MAC or hardware address.

Linux, Android

ip neigh

Linux:

$ ip neigh
192.168.12.230 dev enp0s18 lladdr 00:11:43:44:8A:9B REACHABLE
192.168.12.230 dev enp0s18 lladdr 00:11:43:37:C2:21 REACHABLE
192.168.12.1 dev enp0s18 lladdr 00:01:5C:24:85:02 REACHABLE
192.168.1.1 dev enp0s18 lladdr 00:1d:7e:2e:97:84 DELAY 

Android:

$ ip neigh
192.168.1.100 dev wlan0 lladdr c8:3a:35:cf:3b:b9 REACHABLE
192.168.1.1 dev wlan0 lladdr 00:1d:7e:2e:97:84 REACHABLE 

Unix, OS X, Windows

arp -a

BSD:

$ arp -a
somehost.example.com (192.168.12.230) at 00:11:43:44:8A:9B [ether] on eth0
otherhost.example.com (192.168.12.230) at 00:11:43:37:C2:21 [ether] on eth0
router.example.com (192.168.12.1) at 00:01:5C:24:85:02 [ether] on eth0
anotherhost.example.com (192.168.1.1) at 00:1d:7e:2e:97:84 [ether] on wlp0s3f1u4
router-s1.isp.net (98.223.96.1) at 00:01:5c:24:9c:01 [ether] on eth1

Solaris:

$ arp -a
Net to Media Table: IPv4
Device   IP Address                 Mask      Flags      Phys Addr
------ --------------------   --------------- -------- ---------------
bge0   224.101.101.101        255.255.255.255          01:00:5e:65:65:65
bge0   otherhost1             255.255.255.255 o        00:03:ba:55:94:91
bge0   otherhost2             255.255.255.255 o        00:14:4f:48:85:30
bge0   myself                 255.255.255.255 SPLA     00:14:4f:62:87:1a
bge0   otherhost3             255.255.255.255 o        00:14:38:8e:c6:d0
bge0   otherhost4             255.255.255.255 o        00:01:e6:98:c8:ee
bge0   base-address.mcast.net 240.0.0.0       SM       01:00:5e:00:00:00 

Windows:

C:\>arp -a

Interface: 10.1.1.50 --- 0xc
  Internet Address      Physical Address     Type
  10.1.1.100            6c-62-6d-b2-f8-f1    dynamic
  10.1.1.230            2c-27-d7-c5-d3-7b    dynamic
  10.1.1.232            b8-27-eb-69-be-bb    dynamic
  10.1.1.233            b8-27-eb-01-d3-20    dynamic
  10.1.1.252            00-1d-7e-2e-97-85    dynamic
  10.1.1.255            ff-ff-ff-ff-ff-ff    static
  224.0.22              01-00-5e-00-00-16    static
  224.0.251             01-00-5e-00-00-fb    static
  224.0.252             01-00-5e-00-00-fc    static
  239.255.255.250       01-00-5e-7f-ff-fa    static
  255.255.255.255       ff-ff-ff-ff-ff-ff    static 

Cisco

show arp
router#show arp
Protocol  Address          Age (min)  Hardware Addr   Type   Interface
Internet  10.1.1.100              0   6c62.6db2.f841  ARPA   Ethernet0
Internet  192.168.1.254           -   0000.0c8e.b535  ARPA   Ethernet1
Internet  10.1.1.230              0   2c27.d7c5.d37b  ARPA   Ethernet0
Internet  10.1.1.254              -   0000.0c8e.b534  ARPA   Ethernet0 

NDP maps between IPv6 and MAC or hardware address. It is based on a subset of the ICMPv6 protocol.

Linux, Android

ip -6 neigh show
$ ip -6 neigh show
fe80::211:43ff:fe44:8a9b dev eth0 lladdr 00:11:43:44:8a:9b REACHABLE 

BSD

ndp -a
$ ndp -a
Neighbor                         Linklayer Address  Netif Expire    S Flags
fe80::211:43ff:fe44:8a9b%sis0    0:11:43:44:8a:9b    sis0 permanent R 
fe80::6e62:6dff:feb2:f841%sis0   6c:62:6d:b2:f8:41   sis0 23h58m40s S R
fe80::1%lo0                      (incomplete)         lo0 permanent R  

In the above output, sis0 is the Ethernet interface. The first entry listed is for this host's Ethernet interface, the last is for this host's software lookback address.

Windows

netsh interface ipv6 show neighbors
Rack of Ethernet switches.

Rack of Ethernet switches.

LAN Troubleshooting and Configuration

There should be no collisions on a switched LAN. If you do see collisions, suspect problems with the negotiation of speed and duplex mode. Some kernel modules (device drivers) may auto-negotiate by default, but then have an option to force auto-negotiation that causes slightly different behavior and results. Experiment!

If there are significant numbers of errors other than collisions, suspect problems with the Ethernet cables (most likely) or possibly the system's Ethernet card or the switch port.

To set the speed and duplex mode, you could run the appropriate ethtool or ifconfig media command immediately after booting, perhaps through /etc/rc.local. The problem is that the interface would have already come up in an inappropriate mode and networking would have to be restarted, especially if you are using DHCP.

A better solution would be to load the kernel module with the appropriate optional parameter. On Linux, start by reading the kernel documentation for the driver-specific options.

The kernel documentation is in /usr/src/linux/Documentation if you have installed the kernel source, or in /usr/sharc/doc/kernel-doc if you installed the kernel-doc package. Within whichever one is relevant, find the subdirectory networking, and within that, a file with the same name as the driver.

If that doesn't provide the needed information, you will need to look at the source code. Start at /usr/src/linux, go down to drivers/net/ethernet, to the appropriate manufacturer-specific subdirectory, and look for the appropriate file.

Once you find the appropriate parameters, you can specify them as option lines in /etc/modprobe.d/ethernet.conf. An option is the modify the boot script configuration file used to start the network service.

On BSD and Linux, add the appropriate fields to the interface configuration file. The options will be applied when the kernel first brings up the interface. Here are some examples, but you need to figure out the precise syntax for the chipset-specific driver for your hardware and kernel:

BSD$ cat /etc/hostname.sis0
10.1.1.230 netmask 255.255.255.0 media 100baseT mediaopt full-duplex 
Linux$ cat /etc/sysconfig/network-scripts/ifcfg-enp0s18
NAME="enp0s18"
ONBOOT="yes"
BOOTPROTO=none
IPADDR=10.1.1.30
PREFIX=24
ETHTOOL_OPTS="speed 1000 duplex full" 
Cisco Catalyst 2924 XL switch, forwarding Ethernet frames at the Physical and Link-Layer Control layers.

Cisco Catalyst 2900 XL switch.

IP Information (OSI Layer 3)

Display the current IP configuration (IP address, netmask) for the interfaces

Traditional Linux, Unix and OS X

ifconfig -a

Here is an example from a Linux system with one wireless interface and two Ethernet interfaces, eth0 and eth1, the second of which has two virtual interface configurations and which has been assigned a specific IPv6 address:

$ ifconfig -a
eth0      Link encap:Ethernet  HWaddr 00:11:95:1E:8E:B6
          inet addr:98.228.31.224  Bcast:255.255.255.255  Mask:255.255.248.0
          inet6 addr: fe80::211:95ff:fe1e:8eb6/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:46932082 errors:0 dropped:0 overruns:0 frame:0
          TX packets:46814984 errors:0 dropped:0 overruns:8 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:809855308 (772.3 MiB)  TX bytes:2776351401 (2.5 GiB)
          Interrupt:21 Base address:0xa000

eth1      Link encap:Ethernet  HWaddr 00:0D:61:B1:86:53
          inet addr:10.1.1.100  Bcast:10.1.1.255  Mask:255.255.255.0
	  inet6 addr: 2001:1800:1234:90::1/64 Scope:Global
          inet6 addr: fe80::20d:61ff:feb1:8653/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:789491 errors:3 dropped:3 overruns:3 frame:0
          TX packets:785514 errors:0 dropped:0 overruns:15 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:234930278 (224.0 MiB)  TX bytes:342684110 (326.8 MiB)
          Interrupt:19 Base address:0x8000

eth1:0    Link encap:Ethernet  HWaddr 00:0D:61:B1:86:53
          inet addr:10.0.0.100  Bcast:10.0.0.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          Interrupt:19 Base address:0x8000

eth1:1    Link encap:Ethernet  HWaddr 00:0D:61:B1:86:53
          inet addr:10.1.0.254  Bcast:10.1.255.255  Mask:255.255.0.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          Interrupt:19 Base address:0x8000

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:760670 errors:0 dropped:0 overruns:0 frame:0
          TX packets:760670 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:676142037 (644.8 MiB)  TX bytes:676142037 (644.8 MiB)

wlp0s3f1u4 Link encap:Ethernet  HWaddr C8:3A:35:CF:3B:B9  
          inet addr:192.168.1.102  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::ca3a:35ff:fecf:3bb9/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1215860 errors:0 dropped:0 overruns:0 frame:0
          TX packets:654344 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:1811705015 (1.6 GiB)  TX bytes:57652637 (54.9 MiB)

sit0      Link encap:IPv6-in-IPv4
          NOARP  MTU:1480  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
	  RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

Here is an example from a BSD system with one Ethernet interface, re0, which has auto-configured an IPv6 address on the fe80/64 network and has been assigned an address on the 2001:1800:1234:90::/64 network by the router:

$ ifconfig
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 33200
        priority: 0
        groups: lo
        inet 127.0.0.1 netmask 0xff000000
        inet6 ::1 prefixlen 128
        inet6 fe80::1%lo0 prefixlen 64 scopeid 0x3
re0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
        lladdr 2c:27:d7:c5:d3:7b
        priority: 0
        groups: egress
        media: Ethernet autoselect (100baseTX full-duplex)
        status: active
        inet6 fe80::2e27:d7ff:fec5:d37b%re0 prefixlen 64 scopeid 0x1
        inet 10.1.1.230 netmask 0xffffff00 broadcast 10.1.1.255
        inet6 2001:1800:1234:90:2e27:d7ff:fec5:d37b prefixlen 64
enc0: flags=0<>
        priority: 0
        groups: enc
        status: active
pflog0: flags=141<UP,RUNNING,PROMISC> mtu 33200
        priority: 0
	groups: pflog 

Iproute2 on Linux and Android

ip addr 

Linux with two wired Ethernet interfaces and one wireless LAN interface.

Linux$ ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 576 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 00:11:95:1e:8e:b6 brd ff:ff:ff:ff:ff:ff
    inet 24.1.80.103/23 brd 255.255.255.255 scope global eth0
       valid_lft forever preferred_lft forever
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 6c:62:6d:b2:f8:41 brd ff:ff:ff:ff:ff:ff
    inet 10.1.1.100/24 brd 10.1.1.255 scope global eth1
       valid_lft forever preferred_lft forever
    inet6 fe80::6e62:6dff:feb2:f841/64 scope link 
       valid_lft forever preferred_lft forever
4: wlp0s3f1u4: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether c8:3a:35:cf:3b:b9 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.102/24 brd 192.168.1.255 scope global wlp0s3f1u4
       valid_lft forever preferred_lft forever
    inet6 fe80::ca3a:35ff:fecf:3bb9/64 scope link 
       valid_lft forever preferred_lft forever 

Android on a Samsung Galaxy smart phone with the 802.11 wireless enabled. Notice that only interfaces #1, #11, #21, and #22 have IP adddresses assigned.

Android$ ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: dummy0: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN 
    link/ether 8e:ec:ea:56:b7:41 brd ff:ff:ff:ff:ff:ff
3: rmnet0: <BROADCAST,MULTICAST> mtu 2000 qdisc noop state DOWN qlen 1000
    link/ether 7a:ac:20:6b:aa:ce brd ff:ff:ff:ff:ff:ff
4: rmnet1: <BROADCAST,MULTICAST> mtu 2000 qdisc noop state DOWN qlen 1000
    link/ether 7e:47:97:18:e5:29 brd ff:ff:ff:ff:ff:ff
5: rmnet2: <BROADCAST,MULTICAST> mtu 2000 qdisc noop state DOWN qlen 1000
    link/ether 5a:2c:99:7d:29:e8 brd ff:ff:ff:ff:ff:ff
6: rmnet3: <BROADCAST,MULTICAST> mtu 2000 qdisc noop state DOWN qlen 1000
    link/ether 22:00:f5:c2:f5:d5 brd ff:ff:ff:ff:ff:ff
7: rmnet4: <BROADCAST,MULTICAST> mtu 2000 qdisc noop state DOWN qlen 1000
    link/ether 3a:bd:5b:f2:ed:9f brd ff:ff:ff:ff:ff:ff
8: rmnet5: <BROADCAST,MULTICAST> mtu 2000 qdisc noop state DOWN qlen 1000
    link/ether da:ee:98:aa:0b:b7 brd ff:ff:ff:ff:ff:ff
9: rmnet6: <BROADCAST,MULTICAST> mtu 2000 qdisc noop state DOWN qlen 1000
    link/ether 8a:68:0b:1b:fd:f0 brd ff:ff:ff:ff:ff:ff
10: rmnet7: <BROADCAST,MULTICAST> mtu 2000 qdisc noop state DOWN qlen 1000
    link/ether 4a:16:9a:22:9c:59 brd ff:ff:ff:ff:ff:ff
11: rmnet_sdio0: <> mtu 1500 qdisc pfifo_fast state DOWN qlen 1000
    link/[530] 
    inet 22.106.60.243/29 scope global rmnet_sdio0
12: rmnet_sdio1: <> mtu 2000 qdisc noop state DOWN qlen 1000
    link/[530] 
13: rmnet_sdio2: <> mtu 2000 qdisc noop state DOWN qlen 1000
    link/[530] 
14: rmnet_sdio3: <> mtu 2000 qdisc noop state DOWN qlen 1000
    link/[530] 
15: rmnet_sdio4: <> mtu 2000 qdisc noop state DOWN qlen 1000
    link/[530] 
16: rmnet_sdio5: <> mtu 2000 qdisc noop state DOWN qlen 1000
    link/[530] 
17: rmnet_sdio6: <> mtu 2000 qdisc noop state DOWN qlen 1000
    link/[530] 
18: rmnet_sdio7: <> mtu 2000 qdisc noop state DOWN qlen 1000
    link/[530] 
19: sit0: <NOARP> mtu 1480 qdisc noop state DOWN 
    link/sit 0.0.0.0 brd 0.0.0.0
20: ip6tnl0: <NOARP> mtu 1452 qdisc noop state DOWN 
    link/tunnel6 :: brd ::
21: p2p0: <NO-CARRIER,BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state DORMANT qlen 1000
    link/ether 02:37:6d:a9:b9:35 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::37:6dff:fea9:b935/64 scope link 
       valid_lft forever preferred_lft forever
22: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 00:37:6d:a9:b9:35 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.100/24 brd 192.168.1.255 scope global wlan0
    inet6 fe80::237:6dff:fea9:b935/64 scope link 
       valid_lft forever preferred_lft forever 

Windows

ipconfig /all
C:\>ipconfig /all
Windows IP Configuration

     Host Name . . . . . . . . . . . . : WINXP
     Primary Dns Suffix  . . . . . . . :
     Node Type . . . . . . . . . . . . : Unknown
     IP Routing Enabled. . . . . . . . : No
     WINS Proxy Enabled. . . . . . . . : No
     DNS Suffix Search List. . . . . . : example.com

Ethernet adapter Local Area Connection:

     Connection-specific DNS Suffix  . :
     Description . . . . . . . . . . . : VMware Accelerated AMD PCNet Adapter
     Physical Address. . . . . . . . . : 00-0C-29-A4-AE-C9
     Dhcp Enabled. . . . . . . . . . . : No
     IP Address. . . . . . . . . . . . : 10.1.1.222
     Subnet Mask . . . . . . . . . . . : 255.255.255.0
     Default Gateway . . . . . . . . . : 10.1.1.100
     DNS Servers . . . . . . . . . . . : 10.1.1.100 

Cisco

show ip config
  or
show running-config
  or
show protocols
  or
show interfaces
router> show protocols
Global values:
  Internet Protocol routing is enabled
Ethernet0 is up, line protocol is up
  Internet address is 10.1.1.254/24
Ethernet1 is up, line protocol is up
  Internet address is 192.168.1.254/24
Serial0 is administratively down, line protocol is down
Serial1 is administratively down, line protocol is down 

Display the current routing table

Traditional Linux, Unix, OS X, and Windows

netstat -nr

Output from the same Linux machine with the specified IP addresses:

eth0        24.1.80.103/23
            2001:1800:1234:90::1/64 Scope:Global
            fe80::6e62:6dff:feb2:f841/64 Scope:Link
eth1        10.1.1.100/24
eth1:0      10.1.0.100/24
eth1:1      10.1.0.254/24
wlp0s3f1u4  192.168.1.102/24

Linux$ netstat -nr
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
0.0.0.0         24.1.80.1       0.0.0.0         UG        0 0          0 eth0
10.0.0.0        0.0.0.0         255.255.255.0   U         0 0          0 eth1
10.1.1.0        0.0.0.0         255.255.255.0   U         0 0          0 eth1
10.1.0.0        0.0.0.0         255.255.0.0     U         0 0          0 eth1
24.1.80.0       0.0.0.0         255.255.254.0   U         0 0          0 eth0
169.254.0.0     0.0.0.0         255.255.0.0     U         0 0          0 wlp0s3f1u4
169.254.0.0     0.0.0.0         255.255.0.0     U         0 0          0 eth0
169.254.0.0     0.0.0.0         255.255.0.0     U         0 0          0 eth1
192.168.1.0     0.0.0.0         255.255.255.0   U         0 0          0 wlp0s3f1u4

Linux$ netstat -nr -A inet6
Kernel IPv6 routing table
Destination                     Next Hop   Flags Metric Ref    Use Iface
fe80::/64                       ::         U     256    0        0 eth0    
2001:1800:1234:90::/64          ::         U     256    0        0 eth1    
fe80::/64                       ::         U     256    0        0 eth1    
::1/128                         ::         U     0      76       1 lo      
2001:1800:1234:90::/128         ::         U     0      0        1 lo      
2001:1800:1234:90::1/128        ::         U     0      0        1 lo      
fe80::/128                      ::         U     0      0        1 lo      
fe80::/128                      ::         U     0      0        1 lo      
fe80::211:95ff:fe1e:8eb6/128    ::         U     0      0        1 lo      
fe80::6e62:6dff:feb2:f841/128   ::         U     0      0        1 lo      
ff00::/8                        ::         U     256    0        0 eth0    
ff00::/8                        ::         U     256    0        0 eth1

Flags:
U = Up
G = Gateway

The IPv6 routing table prints much wider, as there is enough room in the "Destination" and "Next Hop" columns for a full IPv6 address. One line is listed for each IPv6 neighbor on the network, the neighbor's IPv6 address/128 as the destination and its IPv6 address as the next hop.

Add -f inet to see IPv4 only on BSD and OS X, otherwise you see voluminous IPv6 routing information:

BSD/OSX$ netstat -nr
Routing tables

Internet:
Destination        Gateway            Flags   Refs      Use   Mtu  Prio Iface
default            10.1.1.100         UGS        3      338     -     8 re0  
10.1.1/24          link#1             UC         1        0     -     4 re0  
10.1.1.100         6c:62:6d:b2:f8:41  UHLc       2     2064     -     4 re0  
10.1.1.230         127.0.0.1          UGHS       0        0 33200     8 lo0  
127/8              127.0.0.1          UGRS       0        0 33200     8 lo0  
127.0.0.1          127.0.0.1          UH         4     4602 33200     4 lo0  
224/4              127.0.0.1          URS        0        0 33200     8 lo0  

Internet6:
Destination                            Gateway            Flags  Refs  Use   Mtu  Prio Iface
::/104                                 ::1                UGRS      0    0     -     8 lo0  
::/96                                  ::1                UGRS      0    0     -     8 lo0  
::1                                    ::1                UH       14    0 33200     4 lo0  
::127.0.0.0/104                        ::1                UGRS      0    0     -     8 lo0  
::224.0.0.0/100                        ::1                UGRS      0    0     -     8 lo0  
::255.0.0.0/104                        ::1                UGRS      0    0     -     8 lo0  
::ffff:0.0.0.0/96                      ::1                UGRS      0    0     -     8 lo0  
2001:1800:1234:90::/64                 link#1             UC        1    0     -     4 re0  
2001:1800:1234:90::1                   6c:62:6d:b2:f8:41  UHLc      0    4     -     4 re0  
2001:1800:1234:90:2e27:d7ff:fec5:d37b  2c:27:d7:c5:d3:7b  UHL       1    0     -     4 lo0  
2002::/24                              ::1                UGRS      0    0     -     8 lo0  
2002:7f00::/24                         ::1                UGRS      0    0     -     8 lo0  
2002:e000::/20                         ::1                UGRS      0    0     -     8 lo0  
2002:ff00::/24                         ::1                UGRS      0    0     -     8 lo0  
fe80::/10                              ::1                UGRS      0    0     -     8 lo0  
fe80::%re0/64                          link#1             UC        0    0     -     4 re0  
fe80::2e27:d7ff:fec5:d37b%re0          2c:27:d7:c5:d3:7b  UHL       0    0     -     4 lo0  
fe80::%lo0/64                          fe80::1%lo0        U         0    0     -     4 lo0  
fe80::1%lo0                            link#3             UHL       0    0     -     4 lo0  
fec0::/10                              ::1                UGRS      0    0     -     8 lo0  
ff01::/16                              ::1                UGRS      0    0     -     8 lo0  
ff01::%re0/32                          link#1             UC        0    0     -     4 re0  
ff01::%lo0/32                          ::1                UC        0    0     -     4 lo0  
ff02::/16                              ::1                UGRS      0    0     -     8 lo0  
ff02::%re0/32                          link#1             UC        0    0     -     4 re0  
ff02::%lo0/32                          ::1                UC        0    0     -     4 lo0  

Flags:
U = Up
G = Gateway
S = Static, e.g., default route added at boot time
H = Host-specific
C = Generate new (host-specific) routes on use
L = Valid link-layer (MAC) address
c = Cloned route
R = Reject route, known but unreachable route

Solaris

solaris$ netstat -nr
Routing Table: IPv4
  Destination           Gateway           Flags  Ref     Use     Interface 
-------------------- -------------------- ----- ----- ---------- --------- 
default              10.1.2.1             UG        1      20274           
10.1.2.0             10.1.2.72            U         1          9 ce0       
224.0.0.0            10.1.2.72            U         1          0 ce0       
127.0.0.1            127.0.0.1            UH       13     902628 lo0       

Routing Table: IPv6
  Destination/Mask            Gateway                   Flags Ref   Use    If   
--------------------------- --------------------------- ----- --- ------- ----- 
fe80::/10                   fe80::203:baff:fe09:3d51    U       1       0 ce0   
ff00::/8                    fe80::203:baff:fe09:3d51    U       1       0 ce0   
::1                         ::1                         UH      4      11 lo0   

Flags:
U = Up
G = Gateway
H = Host-specific

Windows

netstat -nr
C:\>netstat -nr
===========================================================================
Interface List
0x1 ........................... MS TCP Loopback interface
0x10003 ...00 0c 29 a4 ae c9 ...... AMD PCNET Family PCI Ethernet Adapter
===========================================================================
===========================================================================
Active Routes:
Network Destination        Netmask          Gateway       Interface  Metric
          0.0.0.0          0.0.0.0       10.1.1.100      10.1.1.222	  10
         10.1.1.0    255.255.255.0       10.1.1.222      10.1.1.222	  10
       10.1.1.222  255.255.255.255        127.0.0.1       127.0.0.1	  10
   10.255.255.255  255.255.255.255       10.1.1.222      10.1.1.222	  10
        127.0.0.0        255.0.0.0        127.0.0.1       127.0.0.1	  1
        224.0.0.0        240.0.0.0       10.1.1.222      10.1.1.222	  10
  255.255.255.255  255.255.255.255       10.1.1.222      10.1.1.222	  1
Default Gateway:        10.1.1.100
===========================================================================
Persistent Routes:
  None

Route Table

Iproute2 on Linux and Android

ip route 

Linux with two wired Ethernet interfaces and one wireless LAN interface:

Linux$ ip route
default via 24.1.80.1 dev eth0 
10.1.1.0/24 dev eth1  proto kernel  scope link  src 10.1.1.100 
24.1.80.0/23 dev eth0  proto kernel  scope link  src 24.1.80.103 
169.254.0.0/16 dev wlp0s3f1u4  scope link  metric 35 
169.254.0.0/16 dev eth0  scope link  metric 1002 
169.254.0.0/16 dev eth1  scope link  metric 1003 
192.168.1.0/24 dev wlp0s3f1u4  proto kernel  scope link  src 192.168.1.102  metric 35  

Android on a Samsung Galaxy smart phone with the 802.11 wireless enabled:

Android$ ip route
default via 192.168.1.1 dev wlan0 
192.168.1.0/24 dev wlan0  scope link 
192.168.1.0/24 dev wlan0  proto kernel  scope link  src 192.168.1.100 
192.168.1.1 dev wlan0  scope link  

Cisco

show ip route
router> show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
       i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, * - candidate default
       U - per-user static route, o - ODR

Gateway of last resort is 10.1.1.100 to network 0.0.0.0

     10.0.0.0/24 is subnetted, 1 subnets
C       10.1.1.0 is directly connected, Ethernet0
C    192.168.1.0/24 is directly connected, Ethernet1
S*   0.0.0.0/0 [1/0] via 10.1.1.100

See the page "How Routing Works" for an explanation of IP routing and example output.

Interactive Changes to the IP Configuration

On Linux and BSD, you can assign an IP address and netmask interactively. You will need to know the correct device name, but ifconfig -a or ip addr will show you the list.

Use the LAN oriented commands above if you need to figure out which of two Ethernet interfaces you're using.

Use ifconfig on traditional Linux and BSD, ip on Linux with Iproute2.

Then just do something like this:

BSD:      # ifconfig eth0 192.168.250.219/24
Linux:    # ifconfig eth0 192.168.250.219/24
Iproute2: # ip addr add 192.168.250.219/24 dev eth0 

To add an IPv6 address on Linux and BSD:

BSD:      # ifconfig re0 inet6 2001:1800:1234:90::1/64
Linux:    # ifconfig eth0 add 2001:1800:1234:90::1/64
Iproute2: # ip -6 addr add 2001:1800:1234:90::1/64 dev eth0

Then add the default route with something like this:

BSD:      # route add default 192.168.250.254
Linux:    # route add default gw 192.168.250.254
Iproute2: # ip route replace default via 192.168.250.254

Permanent Changes to the IP Configuration

On BSD, configure the interface in /etc/hostname.name and the default gateway in /etc/mygate:

$ cat /etc/hostname.re0 
inet 192.168.250.219 255.255.255.0 NONE
inet6 2001:1800:1234:90:2e27:d7ff:fec5:d37b 64
$ cat /etc/mygate 
192.168.250.1 

On most Linux distributions, configure the interface in /etc/sysconfig/network-scripts/ifcfg-name and the default gateway in /etc/sysconfig/network:

$ cat /etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE=eth1
BOOTPROTO=static
IPADDR=192.168.250.219
## Always include the NETMASK field.  Red Hat Enterprise Linux 6
## leaves this out.  It includes a PREFIX field, which does get
## the netmask correctly set, but their boot scripts then
## miscalculate the broadcast address!
NETMASK=255.255.255.0
## Always comment out the unneeded BROADCAST and NETWORK entries
## added by Red Hat's installation tools!  If you leave them in,
## and later you make manual changes that are the least bit
## contradictory, strange problems will occur!
# BROADCAST=192.168.250.255
# NETWORK=192.168.250.0
## Also comment out the unneeded HWADDR entry added by Red Hat's
## installation tool!  If you leave it in, and then change your
## Ethernet card, your networking will mysteriously fail.
# HWADDR=00:03:47:76:23:F8
## If you want IPv6:
IPV6INIT=yes
IPV6ADDR=2001:1800:1234:90::1/64

$ cat /etc/sysconfig/network
HOSTNAME=whatever.example.com
NETWORKING=yes
GATEWAY=192.168.250.254
NETWORKING_IPV6=yes
IPV6FORWARDING=yes 

For channel bonding, configure a bond interface in ifcfg-bondN and then configure network interfaces to be bound together. Here we bind eth0 and eth1 to be bond0 and configure its IP. The bonding options specify MII link monitoring at 100 millisecond interval and Active Load Balancing policy for fault tolerance and load balancing, with transmit and receive load balancing for IPv4.

$ cat /etc/sysconfig/network-scripts/ifcfg-bond0
DEVICE=bond0
IPADDR=10.1.2.3
NETMASK=255.255.255.0
ONBOOT=yes
BOOTPROTO=static
BONDING_OPTS="miimon=100 mode=balance-alb"
$ cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
MASTER=bond0
SLAVE=yes
ONBOOT=yes
BOOTPROTO=none
$ cat /etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE=eth1
MASTER=bond0
SLAVE=yes
ONBOOT=yes
BOOTPROTO=none 

On Debian/Ubuntu Linux, configure the interface and default gateway in /etc/network/interfaces. Here is a simple one:

$ cat interfaces 
auto lo
iface lo inet loopback

iface eth0 inet static
address 192.168.250.219
netmask 255.255.255.0
gateway 192.168.250.1

auto eth0 

For more details on IPv6, 802.11i/WPA2 security and more, see my page on networking with the Raspberry Pi and its Debian/Ubuntu derived distribution.

Use traceroute to trace the hop-by-hop route to a destination

Linux, Unix and OS X traceroute 195.242.3.1
Windows tracert 195.242.3.1
Cisco trace
You will then be asked to enter the target IP address.

The output will resemble something like the following, with one line per router along the way, and three probes to each router. Note that many web servers today silently drop traceroute probes, so you will see the trace to the last router and dropped packets (stars) beyond that. Also remember that most organizations pay a company to host their web server at an entirely different point in the Internet topology than their main operation. For example, www.pentagon.mil is hosted by Akamai, which means that many mirrors of it are distributed around the Internet, none of them at the five-sided building in Washington DC. Here's a trace from Indiana to Moscow:

$  traceroute www.fsb.ru
traceroute to www.fsb.ru (213.24.76.23), 30 hops max, 40 byte packets
 1  itns-core-vss-01-vlan444.ecn.purdue.edu (128.46.144.1)  0.450 ms  0.436 ms  0.473 ms
 2  tel-210-c7609s-01-po1.tcom.purdue.edu (172.28.252.14)  0.349 ms  0.354 ms  0.353 ms
 3  indiana-gigapop-ctc-internet-mx960.tcom.purdue.edu (192.5.40.179)  1.375 ms  1.396 ms  1.419 ms
 4  xe-0-2-0.111.rtr.ll.indiana.gigapop.net (149.165.254.22)  1.506 ms  1.459 ms  1.464 ms
 5  xe-0-2-0.111.rtr.atla.net.internet2.edu (149.165.254.23)  16.586 ms  16.578 ms  16.583 ms
 6  xe-1-0-0.0.rtr.wash.net.internet2.edu (64.57.28.59)  30.242 ms  30.243 ms  30.212 ms
 7  xe-2-0-0.0.rtr.newy32aoa.net.internet2.edu (64.57.28.74)  35.432 ms  35.428 ms  35.376 ms
 8  ge5-3-0-1000M.ar1.SJC2.gblx.net (64.208.110.25)  35.596 ms  35.602 ms  35.593 ms
 9  PO1-20G.ar1.ARN3.gblx.net (67.17.109.213)  141.805 ms  142.065 ms  142.187 ms
10  RT-COMM-RU-OJSC.Port-channel2.463.ar1.ARN3.gblx.net (64.213.54.50)  144.452 ms  144.487 ms  144.472 ms
11  195.161.47.126 (195.161.47.126)  157.495 ms  155.553 ms *
12  213.59.2.62 (213.59.2.62)  155.583 ms  155.199 ms  157.258 ms
13  * * *
14  * * *
15  * * *
16  * * *
Rack of Cisco routers.

Rack of Cisco routers. Most are 3600 series routers, the brown one near the bottom is a 2500 series. The network connections on on the opposite side, the single cable to each router is a connection to its console port.

Hops 1-3: Across Purdue University's networks and to an Internet2 gateway in Indianapolis. Fractions of milliseconds to get across campus, just over 1 millisecond to get to Indianapolis, maybe 150 km away along the fiber route.

Hops 3-7: Across the internet2.edu very high speed backbone. Interpreting the router names: Indianapolis IN; Atlanta GA; Washington DC; New York NY. Notice the IN-GA and GA-DC hops add about 15 milliseconds each, and DC-NY adds about another 5 msec.

Hops 8-10: Across the Global Crossing gblx.net world-wide backbone. Notice how much time gets added from hops 8 to 9, compared to the time for hops 1-10. Hop #11 crosses the Atlantic by fiber, and the speed of light is a hard speed limit.

Hops 11-12: Two hops within Russia, probably within Moscow.

Hops 13 and beyond: One possibility is that a firewall is hop 13 and it is silently dropping the arriving traceroute probes, and the server would then be hop 14. Another possibility is that the server itself is hop 13 and it is silently dropping the packets.

UDP/TCP Information (OSI Layer 4)

Display all TCP connections, listening ports and service states

Click here to see several detailed examples of netstat -a output and the corresponding Cisco output.

Linux, Unix, Android, and OS X netstat -a
Note — check the manual page for your version of netstat to find the option to only show TCP/IP and leave out the possibly voluminous Linux/Unix domain socket information. It's probably -f inet or -A inet, and -f inet6 or -A inet6 if you're running IPv6.
Iproute2 on Linux ss -a
However, on Android stick with netstat -a
Windows netstat -a
Cisco show tcp brief
show tcp

General Information

Display TCP/IP statistics (or counters)

Click here to see several detailed examples of netstat -s output and the corresponding Cisco output.

Linux, Unix and OS X netstat -s
Windows netstat -s
Cisco show interfaces
show ip traffic
show tcp statistics

Other Pages