Computer on the network

Network is a collection of two or more hosts (computers) that communicates with each other. Communication can be via a wired connection or wireless. Internet is an example of a network. It connects millions of computers throughout a publically accessible network. Many people use the Internet to surf web pages and send or receive e-mail, but the Internet has many additional capabilities besides these. Router is a device that connects computers from one network to another. For example, if you are in office, the computers within the company can all communicate via the local network. To access the Internet, the computers would have to communicate with a router that would be used to forward network communications to the Internet. An IP (Internet Protocol) address is a unique number assigned to a host (computer) on a network. Hosts use these numbers for network communication between them. There are two different types of IP addresses: IPv4 and IPv6. IPv4 (IP version 4) was used by all computers for many years. In IPv4 address, a total of four 8-bit (8-bit = numbers from 0 to 255) numbers are used to define the address. For example, this is considered a 32-bit address (4 x 8-bit = 32): Each host on the Internet must have a unique IP address. In an IPv4 environment, there is a technical limit of IP addresses. However, many of these IP addresses have been assigned to organizations. While it seems like there should be plenty of IP addresses, the Internet started running out of IP addresses. This problem encouraged the development of IPv6 (IP version 6). In IPv6 network the addresses are much larger, 128-bit addresses that look like this: 2001:0db8:85a3:0042:1000:8a2e:0370:7334. The difference between IPv4 and IPv6 isn't just more IP addresses. IPv6 has many other advanced features that address some of IPv4's limitations. The majority of network devices in the world still use IPv4. Most experts agree that IPv6 will eventually replace IPv4.

When a computer is asked to access a website, such as www.example.com, it does not necessarily know what IP address to use. In order for the computer to associate an IP address with the URL or hostname request, the computer relies upon the DNS. The address of the DNS server is stored in the /etc/resolv.conf file. This file is automatically generated. The nameserver is often set to the IP address of the DNS server.

$ cat /etc/resolv.conf

It is common to have multiple nameserver if one DNS server isn't responding. /etc/hosts file contains a table of hostnames to IP addresses. It can be used to supplement a DNS server.

$ cat /etc/hosts

The ifconfig stands for "interface configuration" and is used to display network configuration information. The ifconfig is being replaced with a ip addr show in some Linux distributions. Router (or gateway) is a device that will allow hosts from one network to communicate with another network. To view a table that describes where network packages are sent, use route. default or refers to "all other machines". route is being replaced with ip route show in some Linux distributions. ping can be used to determine if another host is reachable. If ping can send a network package to another host and receive a response, then you should be able to connect to that host. By default, the ping will continue sending packages. To limit how many pings to send, use the -c option.

$ ping -c 5 google.com

Some administrators configure their hosts to not respond to ping requests. This is because a server can be attacked and overwhelmed by a massive number of network packets. By ignoring ping requests, the server is less vulnerable. ping may be useful for checking the availability of local hosts. The netstat is a powerful tool that provides a large amount of network information. For example, use -i option to display statistics regarding network traffic. Use the -r option if you want to display routing information. The netstat is also used to display open ports. A port is a unique number that is associated with a service provided by a host. If the port is open, then the service is available for other hosts. To see a list of all currently open ports, you can use -tl option. -t stands for TCP (protocol) and -l stands for "listening" (which ports are listening). If you want to show numbers, not names, add -n option. On some distributions netstat is obsolete. While no further development is being done on the netstat, it is still an excellent tool for displaying network information and widely used. The goal is to eventually replace netstat with ss and ip. However, this may take some time. host works with DNS to associate a hostname with an IP address.

$ host ajkule.org

The host can be used if an IP address is known, but the domain name is not.

$ host

Other options exist to query the various aspects of a DNS such as -t CNAME, -t SOA or a comprehensive list of DNS information using the -a (all) option.

If you have a desktop environment, you will also have access to a tool that will allow you to configure your network. If your network doesn't automatically assign network settings to your computer, you may have to manually enter the settings yourself. The following examples were performed in Debian desktop environment. To manually set your network settings, open the "Activities" overview and start typing "Settings", then click on "Settings".

If you are connected to the network with a cable, click "Network". Otherwise click "Wi-Fi", then click the settings icon next to the active network.

You can see connection details

or select the IPv4 or IPv6 tab and change the "Method" to "Manual".