LECTION 1: NETWORKING

Table of Contents

Slides
Home

1. CONFIGURING

  • Setting/changing an IP address
    There are several ways to set an IP address in Ubuntu:
    • CLI:

              sudo ifconfig eth0 192.168.0.110 netmask 255.255.255.0
      

      to add a default gateway:

              sudo route add default gw 192.168.0.1 eth0
      
    • GUI: I do not it that way!
    • /etc/network/interfaces
      In /etc/network/interfaces the basic configuration of interfeces is stored To obtain IP address dynamically, edit the file adding the following:

                      auto eth1 iface eth1 inet dhcp
      

      save the file and restart networking services using the below command:

                  sudo systemctl restart networking
      

      To set IP address staticly, add the below lines to the file:

              auto eth1
              iface eth1 inet static address 192.168.0.111
      
  • Setting up/ changing hostname
    The hostname of Ubuntu is configures in the file /etc/hostname

            sudo vim /etc/hostname
    

    The following is useful when I do not want to remember the IP addres, instead of that, I can map the hostname to IP address editing the /etc/hosts file.

            sudo vim /etc/hosts
            192.160.0.120 myOwnHostName
    

    save and reboot the system to apply changes.

  • Enable or disable an specific interface.
    The ifup command allows enable an specific interface, for example:

            sudo ifup eth0
    

    The ifdown command allows disable an specific interface, for example:

            sudo ifdown eth0
    

2. MONITORING-DEBUGGING-TROUBLESHOOTING

  • Ping command
    Packet INternet Groper is the best way to test connectivity between two nodes, PING uses ICMP (Internet Control Message Protocol) to communicate to other devices.
  • Traceroute
    It is a network troubleshoot utility which shows number of hops taken to reach destination and also determine packet traveling path

            traceroute 8.8.8.8
            traceroute epa.com
    
  • Netstat (Network statistic)
    It displays routing table and connection information, to display the routing table information is useful to use the option -r:

            netstat -r
    
  • Dig (domain information groper)
    Dig query DNS related information like A Record, CNAME, MX Record etc. This command mainly use to troubleshoot DNS related query.
  • nslookup
    This command also use to find out DNS related query
  • route
    Route command also shows and manipulate ip routing table.
  • host
    It is a command to find name to IP or IP to name in IPv4 or IPv6 and also query DNS records.
  • (cURL) curl
    It is a command-line tool for getting or sending data including files using URL syntax. Since cURL uses libcurl, it supports every protocol libcurl supports
  • wget: GNU Wget is a free utility for non-interactive download of files from the Web.
    It supports HTTP, HTTPS, and FTP protocols, as well as retrieval through HTTP proxies. Wget is non-interactive, meaning that it can work in the background, while the user is not logged on. This allows you to start a retrieval and disconnect from the system, letting Wget finish the work. By contrast, most of the Web browsers require constant user’s presence, which can be a great hindrance when transferring a lot of data. if while the downloading lost the connection, when restart the download not start from zero but start from it losted the connection
  • Nmap
    nmap is a free and open source utility for network discovery and security auditing. It is useful to see which host are running in our networking
  • tcpdump
    It is a command line utility that allows me to capture and analyze network traffic going through my system. It is often used to help troubleshoot network issues, as well as a security tool.
  • TELNET & RLOGIN These are not good for communicating in networking because it sends passwords in plain text and we could use tcpdump or wireshark to capture these passwords.

Home

Author: Andres Amezquita

Created: 2023-04-16 dom 00:50