Comunications B.
Commands

  1. email

    The most popular use of the internet. People have email addresses such as 'akochis@austin.cc.tx.us'. A wide variey of devices can recieve email such as phone and pagers.

    $ mail president@whitehouse.gov <good.job.memo
    $ mail vice-president@whitehouse.gov <internet.award
    
  2. ftp
    venus : ftp charon
    Connected to charon.domain.com.
    220 charon FTP server (Version 5.2 Fri Sep 7 14:09:58 CDT 1990) ready.
    Name (charon:kochis): kochis
    331 Password required for kochis.
    Password:
    230 User kochis logged in.
    ftp> cd C
    250 CWD command successful.
    ftp> get date.c
    200 PORT command successful.
    150 Opening ASCII mode data connection for date.c (2536 bytes).
    226 Transfer complete.
    local: date.c remote: date.c
    2657 bytes received in 0.048 seconds (54 Kbytes/s)
    ftp> quit
    221 Goodbye.
    
  3. rsh
    Remote command execution.
    hermes : ls
    Accounting      Mail            Outline         Tools           date.c
    Calendar        Misc            Problems        Tutdb           jbyrd.twmrc
    Code            NewDB           Remind          Xnu_tpu         med
    hermes : rsh charon -l kochi5 ls
    Accounting/    Cpr/           Problems/      Tcp/           bin/
    Acct-Scripts/  Mail/          Scripts/       Text/          nuTPU/
    
  4. telnet
    venus : telnet cochise
    Trying 129.116.16.14 ...
    Connected to cochise.domain.com.
    Escape character is '^]'.
    
    
    SunOS UNIX (cochise)
    
    login: kochis 
    Password:
    
    Last login: Tue Nov 24 09:00:27 from venus.domain.com
    SunOS Release 4.1.2 (merworth) #3: Wed Mar 25 14:54:36 CST 1992
    
    cochise : exit
    
  5. Remote login
    venus : rlogin cochise
    Last login: Tue Nov 24 09:00:50 from venus.domain.com
    SunOS Release 4.1.2 (merworth) #3: Wed Mar 25 14:54:36 CST 1992
    cochise : exit
    Connection closed.
    venus : 
    
  6. NFS
    hermes : ls /charon/home/kochis
    Accounting      Cpr             Problems        Tcp             bin
    Acct-Scripts    Mail            Scripts         Text            nuTPU
    C               Man             Tar             Zeta
    
    charon% ls /hermes/home/kochis
    Mail/        bin/         convex/      nu_tpu.def   tpu3.0/
    ask@         common/      dev/         nutpu.tar
    
  7. Remote finger sites
    $ finger quake@geophys.washington.edu
    [geophys.washington.edu] 
    Login name: quake                       In real life: Earthquake Information
    Directory: /u0/quake                    Shell: /u0/quake/run_quake
    Last login Wed Apr 13 11:05 on ttypd from carson.u.washing
    Plan:
    ATTENTION:  Earthquake information on world-wide earthquakes
    from by the National Earthquake Information Service is no longer provided here.
    One can now obtain this information directly from the NEIC with:
           finger quake@gldfs.cr.usgs.gov
    
    The following catalog is is for earthquakes (M>2) in Washington and Oregon
    produced by the Washington Regional Seismograph Network, a member of the
    Council of the National Seismic System.  Catalogs for other regions of the
    country can be obtained by using `finger quake@'  the following host computers:
    fm.gi.alaska.edu (Alaska), scec.gps.caltech.edu (souther California), 
    gldfs.cr.usgs.gov (large world-wide), slueas.slu.edu (central US),
    seismo.unr.edu  (Nevada), eqinfo.seis.utah.edu (Utah), andreas.wr.usgs.gov
    (northern California).
    Additional catalogs of the WRSN are available by anonymous ftp in:
     `ftp.geophys.washington.edu:pub/seis-net'
    DATE-TIME is in Universal Time (UTC) which is PST + 8 hours. Magnitudes are
    reported as local magnitude (Ml).  QUAL is location quality A-good, D-poor,
    Z-from automatic system and may be in error.
    
     DATE-(UTC)-TIME   LAT(N) LON(W)   DEP  MAG QUAL COMMENTS
    yy/mm/dd hh:mm:ss   deg.   deg.    km   Ml
    94/03/22 21:41:28  42.28  122.01    4.9 2.6  A   21.7 km WNW of Klamath Falls, 
    94/03/23 09:35:29  42.28  122.01    5.5 2.0  A   21.7 km WNW of Klamath Falls, 
    94/03/24 09:12:35  42.31  122.05    6.7 2.0  A   25.7 km WNW of Klamath Falls, 
    94/03/24 18:01:01  42.31  122.03    8.2 2.0  A   24.5 km WNW of Klamath Falls, 
    94/03/25 17:12:35  45.05  122.61   18.5 2.0  B   20.4 km ESE of Woodburn, OR
    94/03/26 11:01:09  46.16  120.68   10.3 2.1  B   48.8 km SSW of Yakima
    94/03/26 23:21:58  42.26  121.96    9.4 2.1  A   16.8 km WNW of Klamath Falls, 
    94/03/27 23:50:06  48.53  123.45   24.9 2.0  A   15.5 km NNW of Victoria,BC
    94/03/28 19:14:00  43.28  123.25    7.2 2.0  B   10.7 km  NE of Roseburg, OR
    94/03/28 21:46:47  44.61  122.80    8.9 2.0  C   39.3 km SSE of Salem, OR
    94/03/28 23:08:15  42.26  121.90    3.0 2.7  A   12.4 km WNW of Klamath Falls, 
    94/03/29 06:50:19  42.25  121.96   10.1 2.4  A   15.7 km   W of Klamath Falls, 
    94/04/01 03:38:48  47.65  120.13    7.6 2.9  B FELT   5.9 km   E of Entiat
    94/04/01 04:38:56  48.90  121.93    2.5 2.2  B   18.2 km NNW of Mount Baker
    94/04/03 02:34:09  42.23  121.96    9.8 2.2  A   15.6 km   W of Klamath Falls, 
    94/04/05 00:30:59  47.03  119.93    0.6 2.0  B   10.4 km NNE of Vantage
    94/04/07 22:00:07  49.16  122.30   10.0 2.2  C   38.9 km   N of Deming
    94/04/08 08:50:57  42.30  122.05    6.5 2.0  A   25.1 km WNW of Klamath Falls, 
    94/04/10 16:40:04  49.23  119.56   10.0 2.5  B   29.0 km   S of Penticton, BC
    94/04/12 17:56:45  42.20  121.81    0.0 2.2  B    4.5 km WSW of Klamath Falls, 
    


  8. Interfaces

    To see the network interfaces.

    $ netstat -i
    Name  Mtu   Network     Address         Ipkts    Ierrs Opkts    Oerrs Coll 
    lo0   1536                          574084     0   574084     0     0
    lo0   1536  127         localhost         574084     0   574084     0     0
    en0   1500                         2742135     0  2726850     0     0
    en0   1500  198.214.96  ine.domain.com   2742135     0  2726850     0     0
    tr0   1492                          220899     0   103635     0     0
    tr0   1492  198.214.100 ite.domain.com    220899     0   103635     0     0
    
  9. ifconfig
    
    $ ifconfig en0
    en0: flags=4e080863<UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST,
         GROUPRT,64BIT,PSEG>
         inet 198.214.96.7 netmask 0xffffff00 broadcast 198.214.96.255
    


  10. Routes

    To see the routing tables.

    $ netstat -r
    Routing tables
    Destination      Gateway            Flags  Refcnt Use       Interface
    default          198.214.96.3       UG         11  1876016  en0
    127              localhost          U           4    22636  lo0
    192.168          198.214.96.5       UG          0     8625  en0
    198.214.96       ine.domain.com     U           1    13864  en0
    198.214.97       router1.domain.com UG          5   673520  en0
    198.214.100      router2.domain.com U           5   615216  tr0
    


  11. ping

    To see if another host is there

    $ ping mit.edu
    PING mit.edu (18.72.2.1): 56 data bytes
    64 bytes from 18.72.2.1: icmp_seq=0 ttl=238 time=94 ms
    64 bytes from 18.72.2.1: icmp_seq=1 ttl=238 time=86 ms
    64 bytes from 18.72.2.1: icmp_seq=2 ttl=238 time=89 ms
    C64 bytes from 18.72.2.1: icmp_seq=4 ttl=238 time=89 ms
    64 bytes from 18.72.2.1: icmp_seq=5 ttl=238 time=86 ms
    ^C
    --- mit.edu ping statistics ---
    6 packets transmitted, 5 packets received, 16% packet loss
    round-trip min/avg/max = 86/88/94 ms
    


  12. Name lookup

    $ nslookup mit.edu
    Server:  ine
    Address:  0.0.0.0
    
    Non-authoritative answer:
    Name:    mit.edu
    Address:  18.72.2.1
    
    $ nslookup 18.72.2.1
    Server:  ine
    Address:  0.0.0.0
    
    Name:    MIT.MIT.EDU
    Address:  18.72.2.1
    


  13. Trace

    To see a route

    $ traceroute mit.edu
    traceroute to mit.edu (18.72.2.1), 30 hops max, 40 byte packets
     1  129.117.19.1 (129.117.19.1)  1 ms  1 ms  1 ms
     2  ut2-e3.the.net (129.117.5.17)  2 ms  2 ms  2 ms
     3  ut8-f0-0.the.net (129.117.20.8)  2 ms  2 ms  2 ms
     4  sprint-gw-h2-0.the.net (129.117.16.242)  5 ms  5 ms  5 ms
     5  sl-fw-5-H2/0-T3.sprintlink.net (144.228.35.5)  394 ms  388 ms  19 ms
     6  sl-fw-6-F0/0.sprintlink.net (144.228.30.6)  12 ms  9 ms  8 ms
     7  sl-ana-1-H2/0-T3.sprintlink.net (144.228.10.30)  32 ms  32 ms  32 ms
     8  sl-ana-2-F0/0.sprintlink.net (144.228.70.2)  33 ms  32 ms  33 ms
     9  sl-stk-6-H2/0-T3.sprintlink.net (144.228.10.25)  156 ms  208 ms  42 ms
    10  sl-stk-nap-H2/0-T3.sprintlink.net (144.228.10.50)  62 ms  47 ms  46 ms
    11  pb-F1.MCI.net (198.32.128.197)  44 ms  46 ms  45 ms
    12  borderx1-hssi3-0.SanFrancisco.mci.net (204.70.158.105)  47 ms  47 ms  46 ms
    13  core-fddi-0.SanFrancisco.mci.net (204.70.2.161)  176 ms  138 ms  219 ms
    14  core-hssi-2.Denver.mci.net (204.70.1.37)  232 ms  71 ms  70 ms
    15  core2-hssi-2.WestOrange.mci.net (204.70.1.110)  83 ms  80 ms  81 ms
    16  core1-aip-4.WestOrange.mci.net (204.70.1.65)  81 ms  129 ms  83 ms
    17  core-hssi-4.NewYork.mci.net (204.70.1.97)  82 ms  84 ms  81 ms
    18  core-hssi-3.Boston.mci.net (204.70.1.2)  86 ms  85 ms  84 ms
    19  border1-fddi-0.Boston.mci.net (204.70.2.34)  86 ms  86 ms  85 ms
    20  nearnet.Boston.mci.net (204.70.20.6)  169 ms  149 ms  238 ms
    21  w91-rtr-external-fddi.mit.edu (192.233.33.1)  87 ms  89 ms  89 ms
    22  E40-RTR-FDDI.MIT.EDU (18.168.0.2)  87 ms  86 ms  90 ms
    23  MIT.MIT.EDU (18.72.2.1)  87 ms  87 ms *
    


  14. Statistics

    to see statistics

    $ netstat -s
    ip:
            3492986 total packets received
            0 bad header checksums
            0 with size smaller than minimum
            0 with data size < data length
            0 with header length < data size
            0 with data length < header length
            0 fragments received
            0 fragments dropped (dup or out of space)
            0 fragments dropped after timeout
            230 packets forwarded
            8294 packets not forwardable
            24 redirects sent
    icmp:
            15541 calls to icmp_error
            0 errors not generated 'cuz old message was icmp
            Output histogram:
                    echo reply: 666
                    destination unreachable: 15408
                    routing redirect: 24
                    time exceeded: 6
            572 messages with bad code fields
            0 messages < minimum length
            0 bad checksums
            0 messages with bad length
            Input histogram:
                    echo reply: 589
                    destination unreachable: 11505
                    source quench: 106
                    echo: 666
                    time exceeded: 2746
                    address mask request: 23
            666 message responses generated
    tcp:
            2121934 packets sent
                    1482860 data packets (641955489 bytes)
                    48759 data packets (23147400 bytes) retransmitted
                    246444 ack-only packets (114324 delayed)
                    0 URG only packets
                    20293 window probe packets
                    268327 window update packets
                    55332 control packets
            1943939 packets received
                    852512 acks (for 640675873 bytes)
                    76699 duplicate acks
                    0 acks for unsent data
                    894473 packets (329187152 bytes) received in-sequence
                    7847 completely duplicate packets (387394 bytes)
                    106 packets with some dup. data (2906 bytes duped)
                    47897 out-of-order packets (138730 bytes)
                    19 packets (0 bytes) of data after window
                    0 window probes
                    85118 window update packets
                    50 packets received after close
                    126 discarded for bad checksums
                    0 discarded for bad header offset fields
                    0 discarded because packet too short
            7392 connection requests
            66458 connection accepts
            69329 connections established (including accepts)
            76311 connections closed (including 12420 drops)
            4967 embryonic connections dropped
            526761 segments updated rtt (of 547856 attempts)
            32339 retransmit timeouts
                    78 connections dropped by rexmit timeout
            20742 persist timeouts
            3338 keepalive timeouts
                    1263 keepalive probes sent
                    521 connections dropped by keepalive
    udp:
            0 incomplete headers
            1 bad data length field
            1 bad checksum
            0 socket buffer overflows
    
    


  15. Scripts

    It is possible to use the network commands in scripts such as

    $ cat netpulse
    #!/bin/sh
    #
    # get interface names from ifconfig
    #
    tname=`/etc/ifconfig tr0 | tail -1 | tr -s ' ' ':' | cut -d: -f2`
    iname=`/etc/ifconfig en0 | tail -1 | tr -s ' ' ':' | cut -d: -f2`
    #
    # get statisitics from netstat
    #
    q=`netstat -i | grep '^en0' | grep '198\.214' | tr -s ' ' ':'`
    r=`netstat -i | grep '^tr0' | grep '198\.214' | tr -s ' ' ':'`
    ei1=`echo $q | cut -d: -f5`
    eo1=`echo $q | cut -d: -f7`
    ti1=`echo $r | cut -d: -f5`
    to1=`echo $r | cut -d: -f7`
    #
    # wait 10 sceconds
    #
    sleep 10
    #
    # get statistics again
    #
    q=`netstat -i | grep '^en0' | grep '198\.214' | tr -s ' ' ':'`
    r=`netstat -i | grep '^tr0' | grep '198\.214' | tr -s ' ' ':'`
    ei2=`echo $q | cut -d: -f5`
    eo2=`echo $q | cut -d: -f7`
    ti2=`echo $r | cut -d: -f5`
    to2=`echo $r | cut -d: -f7`
    #
    # compute 10 second difference
    #
    eirpm=`expr $ei2 - $ei1`
    eorpm=`expr $eo2 - $eo1`
    tirpm=`expr $ti2 - $ti1`
    torpm=`expr $to2 - $to1`
    #
    # display results
    #
    echo "$iname\tI=$eirpm\tO=$eorpm"
    echo "$tname\tI=$tirpm\tO=$torpm"
    
    
    $ netpulse
    198.214.96.1    I=80    O=0
    198.214.100.239 I=3     O=2
    $ netpulse
    198.214.96.1    I=28    O=0
    198.214.100.239 I=2     O=0
    

© Allan Kochis Last revision 4/13/2000