تحميل

Assigning a Static IP Address to the Server

Updated at
04/12/2023
Views
4997

Introduction: A static IP address ensures that your server maintains a consistent address, which is important for various server functions and network configurations. This section outlines the steps to assign a static IP address to your server running Ubuntu.

Steps:

  1. Determine Network Configuration:

    • First, identify the network interface name that you want to assign a static IP address to. You can find this information by running the following command:
      ip a
    • Note the interface name (e.g., "eth0" or "ens33") for the subsequent steps.
  2. Edit Network Configuration File:

    • Open the network configuration file for editing using a text editor. For example:
      sudo nano /etc/netplan/01-netcfg.yaml
    • Find the network configuration for the chosen interface and update it to specify the static IP settings. Replace the placeholders with your own values:
      network:
      version: 2
      renderer: networkd
      ethernets:
      eth0: # Replace with your interface name
      addresses: [YOUR_STATIC_IP/24]
      gateway4: YOUR_GATEWAY_IP
      nameservers:
      addresses: [DNS_SERVER_1, DNS_SERVER_2]
  3. Apply Network Changes:

    • After editing the configuration, save the file and apply the changes by running:
      sudo netplan apply
  4. Verify IP Configuration:

    • Confirm that the static IP address is set correctly by running:
      ip a show eth0 # Replace with your interface name
  5. Restart Networking:

    • To ensure that the static IP is properly configured, restart the networking service:
      sudo systemctl restart systemd-networkd

Conclusion: By following these steps, you have successfully assigned a static IP address to your Ubuntu server. A static IP address provides stability and predictability to your server's network configuration, making it easier to manage and access services consistently.

YottaSrc footer

لماذا تختارنا؟

أفضل الأسعار, تخزين SSD سريع و دعم فني
24/7 حقيقي

control panel icon
cPanel

إدارة موقعك من خلال CPanel بأحدث إصدار

security icon
سريع وموثوق وآمن

ضمان وقت تشغيل بنسبة 99.8٪.
لذا ركز على عملك!

support icon
دعم 24/7/365

ليلاً أو نهارًا ، مطر أو شمس ،
فريقنا هنا من أجلك!

cloud backup icon
نسخ احتياطي يومي

نسخ احتياطي يومي وأسبوعي.
ملفاتك آمنة!