Linux Network Administration with ping and ip Commands – POFTUT

Linux Network Administration with ping and ip Commands

Linux network stack is very powerful. Network stack provides a lot of functionalities where most of the enterprise network products can not offer. Here we will look basic and everyday network administration commands.

Check Network and Internet Connectivity

Network connectivity can be checked easily with ping and telnet tools. One method to check internet connectivity is ping to Google.

  • ping sends icmp packets
  • is the destination of the icmp packets
  • line 3 and4 shows that responds to our icmp packets
  • In line 2 is the ip address of the and seeing this means our system can resolve domain names

Some  times ping can not be a feasible method to check internet connectivity. Because some network administrators disables icmp traffic in the network for security reasons. Here our alternative is telnet

  • telnet is the tool to make tcp connection
  • is the destination system
  • 80 is port number of the system
  • Line 3 means there is no problem to make tcp connection to the

If we see other than Line 3 it means there is a problem.

List Network Interfaces

Linux system can have multiple interfaces. Listing them can be done different ways but most used and modern way is using ip commands.

We issue ip link command and get all interfaces. Interfaces are numbered to be easily indentified.

LEARN MORE  How To Get Mac Addresses Of Hosts With Nmap?

After the interface name came like ens .

After interface name the status of the interface cames. There are different options but most important is UP and DOWN option. If there is DOWN status it shows there is a problem or the interface is not set UP .

And there is MAC address like 52:54:00:ea:3f:9c .

echo '

Setting Interface UP/DOWN

We can set an interface with ip link command by using set .

We have set down the interface and than list the status of the interface. Now we can set up the interface again. Keep in mind if an interface is set down the network communication about the interface will be down.

Good, everything works as what is expected. We simple used up argument instead of down . If there is an dhcp server in the interface network it will get an ip address as soon as possible.

List IP Adress

Listing ip address is easy. All interfaces ip addresses will be listed.

We may want to list specific ip address. Because in enterprise systems there will be a lot of interface and ip addreses.

LEARN MORE  What is Microsoft Powershell ? How Can I Automate Tasks?

Setting IP Address

We want to set ip address statically. If dhcp is enable in the interface network it will get automatically an ip address.

Our interface has all ready an ip address.

  • add specifies that we want to add an ip address
  • is ip address and netmask
  • dev ens3 is the interface we want to set ip address
LEARN MORE  Windows Performance Recorder (wpr) Command Tutorial with Examples To Record Performance Metrics

Remove IP Address

Removing ip address is similar to adding just add command is substituted with del command.

As we see previously added ip address is removed.

List Routing Table

Routing table is a crucial part of the networking because the network packets are sent to the destination according to routing table. We can check routing table like below

  • route means we will use routing submodule
  • show lists the routing table content

Add Static Routing

Static route is a new route that is inserted by system administrator. Normally routing entries are inserted by system itself.

  • add used to add new route entry
  • specifies destination network
  • via sets next hoop to destination network
  • dev ens3 is the network interface where packet go out for the destination network

Remove Static Route

Removing static route is easier than adding it.

  • del issued for removel
  • specifies the destination network which route will be removed

Adding Default Gateway

Default gateway is a route too. But default gateway is special because if there is no entry on the route table about destination network, packets are forwarded through default gateway.

  • default means the destination is all networks
  • via specifies default gateway ip address

Removing Default Gateway

Default gateway can be removed easyli just changing add in the adding command to del like below

  • del delete this route
  • default route is default gateway
  • via the ip address of default gateway

Leave a Reply

Your email address will not be published. Required fields are marked *