For Legend look here

Network

On Unix systems you can get and configure the network from the command line.
There are also some commands, to test and analyze the local connections.

  • Pinging a host and outputing the results:

    > ping 

    This sends ECHO Requests to the specified HOST.
    Usefull for:

    1. to see if a system is available on the network
    2. to check if the network is configured correct.
      The command:
    > ping www.hsrw.eu

    Will check if your computer can resolve the domain www.hsrw.eu to an ip
    and then it will check if there is a system with that IP.

  • Listing ip addresses of all network interfaces:

    1. Compatible on nearly all unix based systems:

      > ifconfig
    2. On reasonable modern linux systems:

      > ip addr
  • Getting routing information:
    Routing, determines which interface to use to send and recieve traffic

    1. Unix systems:

      • IPv4
      > netstat -rn

      Hint: -r means: show routing table, -n show information as numbers,
      the last part is sometimes important, to avoid additional DNS request and
      response waits.

    • IPv6
      > netstat -f inet6 -rn
    1. Linux systems:
      • IPv4
        > ip route
    • IPv6
      > ip -6 route
  • Display of all active listening ports:

    > netstat -pnltu
  • Fetching whois information for domain:

    > whois domain
  • Fethcing DNS information for domain:

    > dig domain
  • Downloading a file:

    > wget file
  • Curl is a command line tool used to transfer data using any supported protocols
    As default, curl will output the response it got to the command line

    > curl option domain

    Example:

    > curl https://www.hochschule-rhein-waal.de/en
    > curl ftp://ftp.example.com/file[1-20].jpeg

SSH

SSH or Secure Shell is used to securely gain command line access to systems
over non secure networks.

  • Connection to a host as a user:

    > ssh user@host
    • Example:
      > ssh pi@192.168.0.70
  • Connection to a host on specific port as a user:

    > ssh -p port user@host
  • In order to enable a passwordless login you can use:
    This will copy the public key of the local ssh id to a special file
    authorized_keys in .ssh/ of the home folder of the user

    HINT: This requires that the next command was done before

    > ssh-copy-id user@host
  • SSH is able to use a private/public cryptographic key-pair for
    authentication.
    To generate such a key-pair, the following command can be used:

    > ssh-keygen -b 4096

    This will generate a 4096 bit length RSA key.
    It will also ask for a password to secure the key.

Next:

Goodies