Network configuration on an Ubuntu VPS server

Configuring the network on an Ubuntu VPS server is crucial for ensuring the server's availability on the Internet. This guide outlines the key steps for network setup on a VPS server, including configuring a static IP address, setting up DNS, and performing basic network diagnostics.

Step 1: Connect to the Server

The first step is to connect to your VPS server via SSH. Use the following command:

bash
ssh username@your_server_ip

Here, username is your username on the server, and your_server_ip is the IP address of your server.

Step 2: Check Current Network Settings

Before making changes, it's useful to check the current network settings. Execute the following command:

bash
ip addr show

This command will display the current network interfaces and their IP addresses.

Step 3: Configure a Static IP Address

To set up a static IP address on Ubuntu, you'll use the configuration file /etc/netplan/*.yaml. Open this file for editing (the filename may vary, e.g., 01-netcfg.yaml):

bash
sudo nano /etc/netplan/01-netcfg.yaml

Here's an example configuration for a static IP address:

yaml
network: version: 2 renderer: networkd ethernets: eth0: dhcp4: no addresses: - 192.168.1.100/24 gateway4: 192.168.1.1 nameservers: addresses: - 8.8.8.8 - 8.8.4.4

After making changes, save the file and apply the new configuration:

bash
sudo netplan apply

Step 4: Configure DNS Servers

To change DNS server settings, open the /etc/netplan/*.yaml file and add or modify the nameservers section as shown in the example above. After changing the configuration, apply it:

bash
sudo netplan apply

Step 5: Diagnose Network Issues

To troubleshoot network issues, use the following commands:

  • ping: Check the availability of a host.

    bash
    ping 8.8.8.8
  • traceroute: Trace the route to a host.

    bash
    traceroute google.com
  • nslookup: Check DNS queries.

    bash
    nslookup google.com
  • netstat: View network connections.

    bash
    netstat -tuln

Configuring the network on an Ubuntu VPS involves several key steps, from setting up a static IP address to configuring DNS and troubleshooting network issues. These steps help ensure the stability and availability of your server on the Internet.

  • vps, ubuntu
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

Корпоративная почта на базе собственного домена

Корпоративная почта на собственном домене не только придаёт профессиональный...

Установка и настройка Rclone

Rclone — это мощный инструмент командной строки для управления файлами на облачных хранилищах....

Apache vs Nginx: what’s the difference, how to Install, and which one to choose?

When choosing a web server for your project, Apache and Nginx often come into focus. Both of...

HTTP Errors: common causes and how to fix them

Error 403: ForbiddenDescription: The server understands the request but refuses to fulfill it....

Let's Encrypt without a control panel

Let's Encrypt SSL Certificates: How to Install and Set Up Free Automated Encryption Let's...

Powered by WHMCompleteSolution