How to configure the Static IP Address & Network Card for Linux & Windows Cloud Servers

2021-10-10 By Aaron 150467 Views linux windows networking
2 reviews

Every Cloud Servers will include a public IP address through which the server can be accessed remotely. The IP can be set as either DHCP (automatic) configuration or static IP configuration. DHCP configuration detects IP address setting automatically, whereas static IP configuration requires the IP address settings to be manually set in the server.


This guide outlines the basic steps on how to configure the IP address of your server manually in your Linux or Windows Cloud Servers. The same steps can also be used to update the new IP address in the server manually.




Windows OS


  1. Click Start Menu, then click Control Panel option.

  2. Click Network & Sharing Center option.

  3. Click Change adapter settings in the left panel.

  4. Right-click adapter with the name Ethernet and select Properties.

  5. In the properties window, select Internet Protocol Version 4 (TCP/IPv4) and click Properties button.

  6. Select Use the following IP address: option and configure the static IP address.

    Example for 203.86.232.249:

    Windowsip1

    Note: The netmask is 255.255.255.0 and the gateway is 203.86.232.1.

  7. Once IP and Subnet are entered, check the box Validate Settings upon exit, click OK and then close the Ethernet property window.

  8. Windows Network Diagnostic tool will run to check to see any issues, close this window.

  9. To check if the static IP address is configured properly, right-click Start Menu, then click Command Prompt.

  10. Execute the following command for checking network configuration.

    # ipconfig
    




AlmaLinux


  1. Edit the network configuration file using the below command.

    # vi /etc/sysconfig/network-scripts/ifcfg-ens3
    

    NOTE: ens3 is the device name of the server. Please replace with the correct device name if necessary.

  2. Change the value of BOOTPROTO to static from dhcp and then add the following entries in the network card to configure the static IP address.

    Example for 203.86.232.249:

    BOOTPROTO=static
    DEFROUTE=yes
    DEVICE=ens3
    DNS1=8.8.8.8
    GATEWAY=203.86.232.1
    IPADDR=203.86.232.249
    NETMASK=255.255.255.0
    ONBOOT=yes
    STARTMODE=auto
    TYPE=Ethernet
    USERCTL=no
    

    Note: The netmask is 255.255.255.0 and the gateway is 203.86.232.1.

  3. Save the file.

  4. Restart the network service and make the changes effect.

    # nmcli networking off
    # nmcli networking on
    
  5. Check the static IP address configured properly inside the network card.

    # ip a
    




Rocky Linux


  1. Edit the network configuration file using the below command.

    # vi /etc/sysconfig/network-scripts/ifcfg-ens3
    

    NOTE: ens3 is the device name of the server. Please replace with the correct device name if necessary.

  2. Change the value of BOOTPROTO to static from dhcp and then add the following entries in the network card to configure the static IP address.

    Example for 203.86.232.142:

    BOOTPROTO=static
    DEFROUTE=yes
    DEVICE=ens3
    DNS1=8.8.8.8
    GATEWAY=203.86.232.1
    IPADDR=203.86.232.142
    NETMASK=255.255.255.0
    ONBOOT=yes
    TYPE=Ethernet
    USERCTL=no
    

    Note: The netmask is 255.255.255.0 and the gateway is 203.86.232.1.

  3. Save the file.

  4. Restart the network service and make the changes effect.

    # systemctl restart NetworkManager
    
  5. Check the static IP address configured properly inside the network card.

    # ifconfig
    




Ubuntu


  1. Edit the network configuration file using the below command.

    # /etc/network/interfaces
    
  2. Add the following entries for the network card and configure the static IP address.

    Example for 203.86.232.249:

    auto eth1
    iface eth1 inet static
    address 203.86.232.249
    netmask 255.255.255.0
    gateway 203.86.232.1
    

    Note: The netmask is 255.255.255.0 and the gateway is 203.86.232.1.

  3. Save the file.

  4. Restart the network service and make the changes effect.

    # systemctl restart network.service
    
  5. Check the static IP address configured properly inside the network card.

    # ifconfig
    


Ubuntu 17.10 and higher versions use NetPlan as the default network management tool and its configuration files are written in YAML syntax with a .yaml file extension.


  1. Edit the network configuration file using the below command.

    # vi /etc/netplan/50-cloud-init.yaml
    

    Example for 203.86.232.249:

    network:
    ethernets:
    ens3:
    dhcp4: no
    dhcp6: no
    addresses:
    - 203.86.232.249/24
    gateway4: 203.86.232.1
    nameservers:
    addresses: [1.1.1.1, 8.8.8.8]
    optional: true
    renderer: networkd
    version: 2
    

    NOTE: Change the name of the ethernet interface on your server.

  2. Update networking with the below command and then the changes will take effect.

    # netplan apply
    




Debian


  1. Edit the network configuration file using the below command.

    # /etc/network/interfaces
    
  2. Add the following entries for the network card and configure the static IP address.

    Example for 203.86.232.249:

    auto ens4
    iface ens4 inet static
    address 203.86.232.249
    netmask 255.255.255.0
    gateway 203.86.232.1
    

    Note: The netmask is 255.255.255.0 and the gateway is 203.86.232.1.

  3. Save the file.

  4. Restart the network service and make the changes effect.

    # systemctl restart network.service
    
  5. Check the static IP address configured properly inside the network card.

    # ip addr
    




CentOS – 8


  1. Edit the network configuration file using the below command.

    # /etc/sysconfig/network-scripts/ifcfg-eth1
    

    Note: eth1/ens1 is the device name of the server. Please replace with the correct device name if necessary.

  2. Change the value of BOOTPROTO to static from dhcp and then add the following entries in the network card to configure the static IP address.

    Example for 203.86.232.249:

    DEVICE=eth1
    ONBOOT=yes
    BOOTPROTO=static
    IPADDR=203.86.232.249
    NETMASK=255.255.255.0
    GATEWAY=203.86.232.1
    USERCTL=no
    

    Note: The netmask is 255.255.255.0 and the gateway is 203.86.232.1.

  3. Save the file.

  4. Restart the network service and make the changes effect.

    # systemctl restart NetworkManager.service
    
  5. Check the static IP address configured properly inside the network card.

    # ifconfig
    




CentOS – 6 / 7


  1. Edit the network configuration file using the below command.

    # /etc/sysconfig/network-scripts/ifcfg-eth1
    

    Note: eth1/ens1 is the device name of the server. Please replace with the correct device name if necessary.

  2. Change the value of BOOTPROTO to static from dhcp and then add the following entries in the network card to configure the static IP address.

    Example for 203.86.232.249:

    DEVICE=eth1
    ONBOOT=yes
    BOOTPROTO=static
    IPADDR=203.86.232.249
    NETMASK=255.255.255.0
    GATEWAY=203.86.232.1
    USERCTL=no
    

    Note: The netmask is 255.255.255.0 and the gateway is 203.86.232.1.

  3. Save the file.

  4. Restart the network service and make the changes effect.

    # systemctl restart network.service
    
  5. Check the static IP address configured properly inside the network card.

    # ifconfig
    




Fedora


  1. Edit the network configuration file using the below command.

    # /etc/sysconfig/network-scripts/ifcfg-eth1
    

    Note: eth1/ens1 is the device name of the server. Please replace with the correct device name if necessary.

  2. Change the value of BOOTPROTO to static from dhcp and then add the following entries in the network card to configure the static IP address.

    Example for 203.86.232.249:

    DEVICE=eth1
    ONBOOT=yes
    BOOTPROTO=static
    IPADDR=203.86.232.249
    NETMASK=255.255.255.0
    GATEWAY=203.86.232.1
    USERCTL=no
    

    Note: The netmask is 255.255.255.0 and the gateway is 203.86.232.1.

  3. Save the file.

  4. Restart the network service and make the changes effect.

    # systemctl restart NetworkManager.service
    
  5. Check the static IP address configured properly inside the network card.

    # ip a
    
    
    IPADDR=203.86.232.249
    NETMASK=255.255.255.0
    GATEWAY=203.86.232.1
    USERCTL=no
    

    Note: The netmask is 255.255.255.0 and the gateway is 203.86.232.1.

  6. Save the file.

  7. Restart the network service and make the changes effect.

    # systemctl restart NetworkManager.service
    
  8. Check the static IP address configured properly inside the network card.

    # ip a
    


Related Tutorials

What do you think about this article?

Rate this article
LayerStack Dedicated Cloud

About LayerStack’s Cloud Server

LayerStack is a leading Cloud Server provider in Asia, offering high performance and reliable SSD cloud computing services in our purpose-built, Tier 3+ data centers in Hong Kong, Singapore, Japan and the United States.

Try our blazing fast cloud servers with unlimited traffic and high security NOW!

WATCH DEMO
Instant Deployment in 1 Minute.

Try this guide to receive free bundled services at signup on a new free account.

Sign Up

Your Feedback Is Important

We hope you’ll give the new products and updates a try. If you have an idea for improving our products or want to vote on other user ideas so they get prioritized, please submit your feedback on our Community platform. And if you have any questions, please feel free to ask in the Community or contact our Technical Support team.

Try our NEW Dedicated Cloud Now!: Provide users with more control and flexibility over the cloud infrastructure.