Skip to content

Static IP Configuration

To set up static IP configuration on your VPS, you have to login into Fleio.
After connecting to Fleio you can use the console to run commands

Configuration Ubuntu

  1. Login into SSH or console.

  2. Make sure you are sudo.

  3. Create a new configuration file at /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following line:

    network: {config: disabled}
    

  4. Edit the content at adress: of /etc/netplan/50-cloud-init.yaml with the following lines:

    Info To find out the subnet mask for the IPs, you can use the command ip r | grep [your ip]. Info To find out the gateway you can use the command ip r | grep default.

    dhcp: no  
    addresses:  
      - <your IPv4 address>/subnet  
      - <your IPv6 address>/subnet  
    gateway4: <your IPv4 gateway>  
    gateway6: "<your IPv6 gateway>"  
    
    Note Gateway4 and gateway6 lines should'nt be addded to the adresses under nameservers.

  5. Use the following command to apply your changes.

    netplan apply
    

Configuration for more IPs in your instance.

If you configure multiple IPs in your instance, all you need to do is add another IP to /etc/netplan/50-cloud-init.yaml

addresses:  
  - <your first IPv4 address>/subnet  
  - <your second IPv4 address>/subnet  

After the modification, you need to run the following command:

netplan apply

Configuration CentOS

  1. Login to SSH or console.

  2. Make sure you are sudo

  3. Edit file /etc/cloud/cloud.cfg.d/90-centos-networking.cfg and put in the following line.

    network: {config:disabled}
    

  4. Replace the content of /etc/sysconfig/network-scripts/ifcfg-eth0 with the following lines:

    BOOTPROTO=static  
    DEVICE=eth0  
    ONBOOT=yes  
    TYPE=Ethernet  
    IPADDR=<your IPv4 address>  
    PREFIX=24  
    GATEWAY=<your IPv4 gateway>  
    IPV6ADDR=<your IPv6 address>/64  
    IPV6_DEFAULTGW=<your IPv6 gateway>  
    

  5. Restart network using the commands or reboot

    systemctl disable dhclient6.service  
    ifdown eth0  
    ifup eth0  
    

Configuration for more IPs in your instance.

If you want to configure multiple IPs in your instance, we need to create another cfg file.
In default configuration we have ifcfg-eth0 and we have to create file with a different name like ifcfg-eth0:1 using the following command:

vim /etc/sysconfig/network-scripts/ifcfg-eth0:1  

Note We can choose eth0:1, eth0:2, eth0:3, and so on, depending on how many IPs we want to configure.

BOOTPROTO=none  
DEFROUTE=yes  
DEVICE=eth0:1  
GATEWAY=<your IPv4 gateway>  
IPADDR=<your IPv4 address>  
PREFIX=<Your IPv4 prefix>  
IPV6ADDR=<your IPv6 address/64>  
IPV6INIT=yes  
IPV6_DEFAULTGW=<your IPv6 gateway>  
ONBOOT=yes  
STARTMODE=auto  
TYPE=Ethernet  
USERCTL=no  

After the configuration is done, you have to restart network:

ifdown [file configuration]   (ifdown eth0:1)  
ifup   [file configuration]   (ifup eth0:1)