Posts in Category: networking

Data Packets, packet headers, and the OSI model

When 2 devices wants to communicate with each other over a network, it does so by constructing packets of data and then sending them to each other. A data packet is basically a structured data (similar to xml), where the actual payload data is nested inside header tags. The header tag’s data contains information to help routing the data packets. These header tags are nested inside other header tags, which in turn are nested inside other header tags.

You can imagine a data packet being similar to a hand written letter (data payload) that is put inside an envelope and an address written on that envelope (packet header, along with it’s information), which in turn is put inside a bigger envelope with another address written on it (another header)….and

Using arp

arp translates ip address to mac addresses.

The arp command let’s you see which one of your interfaces has access to the default gateway, and therefore can access the internet.

the following shows which interface has access to the the default gateway:

$ arp
Address                  HWtype  HWaddress           Flags Mask            Iface             ether   08:00:27:88:f1:e5   C                     enp0s10   															

The DHCP server

A dhcp (dynamic host configuration protocol) server provides configuration to boxes that joins it’s network.

The dhcp often acts as the default gateway too.

Using mtr

Sometimes that ping and traceroute command doesn’t work due to network security reasons:

Note: I couldn’t get arping to work either.

That’s where mtr can come in handy. mtr is a combination of the ping and traceroute command.

$ yum install mtr

Then do:

$ mtr

This starts up a text based display (a bit like how the top command does) that is constantly refreshing. It looks something like this:

                                     My traceroute  [v0.85]
localhost.localdomain (                      															

Network troubleshooting process

What’s the first step you take when you encounter problem such as ‘firefox isn’t working’?

This article outlines a standard set of steps to take to try to identify which part of the whole setup is causing the problem.

At it’s heart, the troubleshooting process we take is in line with the OSI model. In that respect our approach involves isolating in which network layer the problem resides in. The OSI network layer is

  1. Physical Layer – e.g. cable not plugged in properly, or network adapters have developed a physical fault
  2. Data Link Layer – e.g. does ‘ip addr show’ shows ip addresss for each network. also try using ping to ping other devices in the same box, e.g. the default gateway. then trying pinging outside the network. Also try ‘arp -a’
  3. Network Layer –

Linux Networking Introduction

This is gives a practical hands on walkthrough on understanding, configuring, and troubleshooting network related problems. We will be exclusively using CentOS throughout this series.

Using netstat

The netstat (network statistics) command is often used for checking what ports your CentOS machine is listening on. A commonly used command is:

 netstat -tulpen
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       User       Inode      PID/Program name
tcp        0      0   *               LISTEN      0