Answered by the Webhosting Experts

TCP/IP Information in Linux

TCP/IP (Transmission Control Protocol/Internet Protocol) is the fundamental communication protocol suite that underpins the internet and networking in Linux-based web hosting environments. It not only ensures reliable transmission of data across networks but also enables seamless connectivity between servers, clients, and other network devices. For web hosting professionals, understanding TCP/IP in a Linux environment is crucial because it empowers them to configure and troubleshoot network issues effectively, ultimately ensuring the smooth operation of hosted websites and applications. Furthermore, this article will delve into the essentials of TCP/IP within Linux, thoroughly covering key concepts such as IP addressing and routing.

TCP/IP Within a Linux OS

Overview

In this example, we will review the networking information within AlmaLinux, a RHEL-based distribution.

To display network interface details, you can use the ip addr command. Additionally, this command and its output prove particularly useful, as they help users understand which configurations are currently running and on which interface within the system. Moreover, this information aids in troubleshooting and effectively managing network settings.

ip addr Output to Display Network Interface Details

ip addr Output to Display Network Interface Details

ip addr Information Breakdown

  • Interface Information:
    • Each network interface is represented by a numbered section (e.g., 1: for lo and 2: for ens18).
    • The name of the interface follows the number. Here, lo is the loopback interface, and ens18 is the Ethernet interface.
    • The status (UP/DOWN) and the MTU (Maximum Transmission Unit) size are listed:
      • mtu 65536 for lo means it can handle packet sizes up to 65536 bytes.
      • mtu 1500 for ens18 means it can handle packet sizes up to 1500 bytes, a typical value for Ethernet.
  • Link Information:
    • link/loopback for lo indicates that it is a loopback interface, which is used for internal communication within the host.
    • link/ether for ens18 shows that this is an Ethernet interface.
    • The MAC address is listed after link/ether. For example, b6:ea:ae:71:00:c3 is the MAC address of the ens18 interface.
  • IPv4 Address:
    • The line inet 127.0.0.1/8 for lo indicates the loopback address, which is commonly used for internal server communication.
    • In contrast, inet 23.111.182.195/29 for ens18 is the public IP address assigned to this server. The /29 denotes the subnet mask, which means that this address is part of a network with up to 8 IP addresses.
  • Broadcast Address:
    • Furthermore, brd represents the broadcast address used for sending data to all devices in the network. Specifically, for ens18, brd 23.111.182.199 serves as the broadcast address within the /29 subnet.
  • Scope:
    • Additionally, scope host means that the address is limited to the host itself, which is typical for the loopback interface (127.0.0.1). On the other hand, scope global indicates that the address is publicly accessible and used for external communication, as seen with 23.111.182.195.
  • IPv6 Address:
    • inet6 shows IPv6 addresses assigned to the interface. 2604:4500:6:6db::2/64 is a global IPv6 address, while fe80::b4ea:aeff:fe71:c3/64 is a link-local address, used for communication within the local network.
  • Status and Additional Information:
    • The state keyword indicates the current state of the interface:
      • UNKNOWN for lo means it is not associated with an actual physical link.
      • UP for ens18 means the interface is active and ready to send/receive data.
    • qlen 1000 shows the queue length, which determines how many packets can be held in the queue before being processed.

Checking Routing Information

Routing is a fundamental aspect of network configuration within the TCP/IP protocol, especially on Linux servers used in web hosting. It involves determining the path that data packets take to reach their destination across interconnected networks. Proper routing is crucial because it ensures that data travels efficiently from one network to another, thereby enabling smooth communication between clients, servers, and other networked devices.

Additionally, a routing table is a set of rules that the Linux kernel uses as part of the TCP/IP protocol to determine where to forward network traffic. Specifically, each entry in the table specifies a destination network and how to reach it. Furthermore, the routing table helps the system make decisions about the most efficient routes, ensuring optimal network performance and connectivity.

To review the current routes in the system ip route command can be used. 

ip route Used to Show the Routing Table of the Linux Server
ip route Used to Show the Routing Table of the Linux Server

ip route Information Breakdown

  1. The default route is used for any network traffic that does not match a more specific route.

    1. default via 23.111.182.193 dev ens18 which indicates the default route, via the gateway IP, using dev (Network interface) ens18.

  2. The Local Network Route 23.111.182.192/29 dev ens18 proto kernel scope link src 23.111.182.195 represents the network route, with /29 as the subnet mask, the ens18 network interface, and proto kernel indicating that the kernel added the route. The src specifies the source IP used when sending packets.

  3. The link-local route handles traffic for the 169.254.0.0/16 range, which devices typically use when they cannot obtain an IP address via DHCP. You can observe this behavior even if you do not enable DHCP, thanks to the automatic functions of the network stack.

Network Configuration Files

Network configuration in Linux involving the TCP/IP protocol establishes how a system connects to networks by defining IP addresses, gateways, and DNS servers. Consequently, this configuration enables communication within local networks or with the internet, ensuring proper data routing. Moreover, tools like ifcfg files, netplan, or /etc/network/interfaces manage this across different distributions, allowing for stable and secure network connections.

Furthermore, the configuration varies between each OS, and we will detail it below according to the main OSs that Hivelocity offers.

AlmaLinux/CentOS Configuration

  • The configuration file location should be present at “/etc/sysconfig/network-scripts/ifcfg-<interface_name>”.
    • Note that AlmaLinux does come equipped with NetworkManager in some cases and might require utilizing nmtui instead of performing the in-file configuration changes.
  • You can find the example configuration below.

TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=none
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=no
NAME=ens18
UUID=910cd91f-8798-4435-9070-dcf556b3f82b
DEVICE=ens18
ONBOOT=yes
IPADDR=192.168.1.100
PREFIX=24
GATEWAY=192.168.1.1
DNS1=8.8.8.8
DNS2=8.8.4.4
IPV6ADDR=2604:4500:6:6db::2/64
IPV6_DEFAULTGW=2604:4500:6:6db::1

Ubuntu Configuration

  • The configuration file location should be present at “/etc/netplan/*.yaml”.
    • The settings are applied using the netplan apply command.
    • Note that the spacing in the file is crucial.
  • You can find the example configuration below.
network:
  version: 2
  ethernets:
      ens18:
          dhcp4: no
          addresses:
               – 192.168.1.100/24
          gateway4: 192.168.1.1
          nameservers:
               addresses:
                    – 8.8.8.8
                    – 8.8.4.4

Debian Configuration

  • The configuration file location should be present at “/etc/network/interfaces”.
  • You can find the example configuration below.

auto ens18
iface ens18 inet static
  address 192.168.1.100
  netmask 255.255.255.0
  gateway 192.168.1.1
  dns-nameservers 8.8.8.8 8.8.4.4

Further Assistance

For any further assistance involving TCP/IP and configuration, do not hesitate to reach out to the Hivelocity Support team via a chat, support ticket, or phone at 888-869-4678. The team can assist with recommendations, explanations, and reviewing/adjusting configuration files in your Linux OS.

Need More Personalized Help?

If you have any further issues, questions, or would like some assistance checking on this or anything else, please reach out to us from your my.hivelocity.net account and provide your server credentials within the encrypted field for the best possible security and support.

If you are unable to reach your my.hivelocity.net account or if you are on the go, please reach out from your valid my.hivelocity.net account email to us here at: support@hivelocity.net. We are also available to you through our phone and live chat system 24/7/365.