Difficulty: beginner
Estimated Time: 5 minutes

This course will let you learn about Basic Networking in Linux:

  • List the interfaces
  • Show the gateway server
  • List the DNS servers
  • Set an IP manually for an interface
  • Use DHCP to get IP for an interface
  • Modify DNS servers


You have learned the basics of Linux networking

Basic Networking in Linux

Step 1 of 6

Step 1 - List the interfaces

There are several ways to list interfaces in Linux

A classic way of doing

Run the command bellow


Here we can read so much details. Don''t worry we will try to sort it out below.

A modern way of doing

ip addr

More options

We can use grep and awk to further filter the output so we list the names only:

ifconfig | grep -v -e "^ " -e ^$ | awk '{print $1}'

lo is a loopback interface. It is the default interface and you don''t need a physical or virtual netword card for this. All machines have this address available for local access only. The IP address is and the DNS alias is localhost.

eth0 is either a physical or virtual network card which is automatically named by Linux. If you add another network card it would be probably named eth1.

We can display specific interface only

ifconfig eth0


ip addr show dev eth0

To list the IP Address and Subnet Mask

ifconfig | grep inet