IP Addresses and Interfaces in Networking (hostname, dhcpd, ifconfig, ping) - BunksAllowed

BunksAllowed is an effort to facilitate Self Learning process through the provision of quality tutorials.

Random Posts

IP Addresses and Interfaces in Networking (hostname, dhcpd, ifconfig, ping)

Share This

ifconfig command

The ifconfig in short “interface configuration” utility for system/network administration in Unix/Linux operating systems to configure, manage, and query network interface parameters via command-line interface or in a system configuration scripts.
The “ifconfig” command is used for displaying current network configuration information, setting up an ip address, netmask, or broadcast address to a network interface, creating an alias for the network interface, setting up hardware address, and enabling or disabling network interfaces.
The ifconfig is used to make an interface accessible to the kernel networking layer. This involves the assignment of an IP address and other parameters, and activation of the interface, also known as "bringing up" the interface. Being active here means that the kernel will send and receive IP datagrams through the interface. The simplest way to invoke it is with:
ifconfig interface ip-address

Setting the Hostname

Most, if not all, network applications rely on you to set the local host's name to some reasonable value. This setting is usually made by executing the hostname command during the boot procedure. To set the hostname to name, enter:
# hostname  name 
Using the unqualified hostname without specifying the domain name is common practice. For instance, if we had a site called the Virtual Brewery (an imaginary but typical small network used in several chapters of this book) a host might be called vale.vbrew.com or vlager.vbrew.com. These are their official fully qualified domain names (FQDNs). Their local hostnames would be the first component of the name, such as vale. However, because the local hostname is frequently used to look up the host's IP address, you have to make sure that the resolver library is able to look up the host's IP address. This usually means you must enter the name in /etc/hosts.

Using DHCP to Obtain an IP Address

Obtaining an IP address via DHCP is simple and is accomplished by issuing the following command:
vlager#  dhcpcd eth0
vlager#
The daemon will at this point, reconfigure your eth0 interface, not only assigning an IP address, but also properly configuring the subnetting. Many DHCP servers will also provide default route and DNS information. In the case of the latter, your /etc/resolv.conf file will be rewritten with the updated DNS server information. If for some reason you do not want the daemon to rewrite your resolv.conf file, you can specify -R on the command line. There are a number of additional command-line options available for dhcpcd, which may be needed in some environments. For a list of these, please contact the dhcpcd manpage. The resolv.conf file will be discussed in greater detail in the chapter on DNS.


ping command

The ping or Packet Internet Groper is a well-loved Linux command! Its main purpose is to manage the network connectivity status between a source and a device with the help of an IP network. In this tutorial, you’ll learn how it can help your project and how to start using it!

With the Linux ping command, we can also access the time duration for sending and receiving responses from a network. It works by sending a series of Internet Control Message Protocol (ICMP) messages to the target host and waiting for an ICMP echo message from and to the host and Device. That informs us about the execution of the network.

Essentially it sends the ECHO_REQUEST message and awaits ECHO_RESPONSE. If the message shows “fast ping low latency” it means that the connection is fast. It’s measured in milliseconds. Nowadays, every modern computer, VPS, or device has PING pre-installed, because of its many uses. It’s a quick and straightforward way to check the performance between the device and the host.

The Ping test between your computer and the target host will allow you to determine: 
  • Status of the Target host: whether it is reachable 
  • Measurement of time between the round trip (Host–Computer-Host) 
  • Percentage of lost packets

Happy Exploring!

No comments:

Post a Comment