We use cookies
We use cookies to optimize our website. By continuing to browse the site, you agree to our use of cookies.
New design
Control panel
  • Русский
  • Українська
  • English
  • UAH
  • USD
  • RUB
  • EUR
  • 0-800-307-307 Hotline
  • +38 (044) 392-74-33 Kiev
  • +38 (057) 728-39-00 Kharkiv
  • +38 (056) 794-38-31 Dnipro
  • +38 (032) 229-58-93 Lviv
  • +38 (048) 738-57-70 Odessa
  • +38(093) 170-15-42  Life
  • +38 (067) 400-88-44 Kievstar
  • +1(888)393-24-51  USA, Toll free
  • +44(131)507-01-14  Great Britain
  • +7 (499) 348-28-61 Moscow

4.4.3. Activating an additional IP address

To add an additional IP address to the VPS, you need to connect to the server using SSH or VNC, edit the network interface configuration file and restart the network service. Different distributions perform these operations differently.

  1. Go to directory /etc/sysconfig/network-scripts:
    cd /etc/sysconfig/network-scripts/
  2. Copy the existing file ifcfg-eth0 under the name ifcfg-eth0:0:
    cp ifcfg-eth0 ifcfg-eth0:0
  3. Open this file using any convenient editor:
    vi ifcfg-eth0:0
  4. Remove the lines related to IPv6 (this is the line # IPv6 and those that follow it - they all contain IPv6 at the beginning).
  5. Change the line DEVICEby adding at the end :0:
    DEVICE=eth0:0
  6. And change the line IPADDRby specifying your new IP:
    IPADDR=185.25.111.111
  7. Then restart the service with the command:
    service network restart

Note

After completing all the actions on the command ifconfig you will see that you have an additional interface: eth:0.

  1. Open the file for editing /etc/network/interfaces:
    nano /etc/network/interfaces
  2. At the end of a group of lines related to setting eth0 inet, before the IPv6 address settings (eth0 inet6), add the following lines:
    up ip addr add 185.25.111.111/22 dev eth0
    down ip addr add 185.25.111.111/22 dev eth0

    Instead 185.25.111.111 you need to specify your new IP, and instead of 22 - the correct netmask.

  3. Save changes and restart the interface by running the appropriate command:
    • For Debian 6:
      ifdown eth0 && ifup eth0
    • For Debian 7:
      ifdown --force eth0; ifup --force eth0

Note

You can check the correctness of adding the address with the command ip addr... You should display lines like this:

2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000 link / ether 10: 36: 3f: 04: 27: 47 brd ff: ff: ff: ff: ff: ff inet <old_IP> / 22 brd 185.25.111.255 scope global eth0 inet <new_IP>/22 scope global secondary eth0
In Ubuntu prior to version 17.10, the settings must be made in the file /etc/network/interfaces... In subsequent versions, the settings are made in "Netplan».

Note

If you are using a non-root user, then at the beginning of most commands you may need to specify sudo and after entering the password.

  1. Open the file for editing /etc/network/interfaces:
    nano /etc/network/interfaces
  2. At the end of this file add the following lines:
    auto eth0:0
    iface eth0:0 inet static
    address 185.25.111.111
    netmask 255.255.252.0

    Instead 185.25.111.111 enter your new IP instead of 255.255.252.0 - the network mask that you have specified above.

  3. Save changes and restart the interface:
    /etc/init.d/networking restart

Note

You can check the correctness of adding the address with the command ifconfig... You should have an interface eth0:0.

To configure interfaces in Netplan you need to do the following:

  1. Generate a config file if it doesn't exist. You can do it like this:
    netplan generate

    To check for existing files, you need to run:

    ls -l /etc/netplan/

    If the output contains total 0, then file generation is required.

  2. Check which interfaces already exist on the system. To do this, run:
    ifconfig -a
  3. Open the configuration file for editing:
    nano /etc/netplan/XXXXX.yaml

    Important! Instead XXXXX you need to specify the correct name of the existing file.

  4. In section ethernet specify the following lines:
    eth1:
    dhcp4: no
    dhcp6: no
    addresses: [XXX.XXX.XXX.XXX/YY, XXX.XXX.XXX.XXX/YY]
    gateway4: XXX.XXX.XXX.XXX
    nameservers:
      addresses: [XXX.XXX.XXX.XXX, XXX.XXX.XXX.XXX]

    This instruction will change the interface settings:

    • eth1 - interface name. You need to specify the interface that you plan to configure.
    • dhcp4 and dhcp6 - DHCP settings for IPv4 and IPv6. Need to indicate no, since the IP will be set manually.
    • addresses - a sequence of IP addresses. Instead XXX.XXX.XXX.XXX you should specify the required IP, instead of YY - the desired mask.
      Important! When specifying IPv6, be sure to wrap the address in quotation marks, for example “'2a05:410:0:9b5b::3/64'».
    • gateway4 - specifying the default gateway for IPv4. Instead XXX.XXX.XXX.XXX you need to specify a standard gateway.
    • nameservers - nameserver settings.
      • addresses - sequence of IP addresses (indication in the block nameservers parameter addresses indicates the IP addresses of nameservers).
  5. After all the changes and saving the file, to accept the new settings, you need to do:
    netplan apply

Note

You can check the correctness of adding the address with the command ifconfig... You should have an interface eth1.

  1. Open the file for editing /etc/conf.d/net:
    nano /etc/conf.d/net
  2. On the first line of this file, you will have your current IP address. Insert another line after it, indicating the new IP, and then after the slash - the same netmask as for the first address:
    config_eth0="<old_IP> / 22 <new_IP>/22
  3. Save changes by clicking Ctrl-X, and then y to confirm writing the file, and Enter.
  4. Restart the interface:
    /etc/init.d/net.eth0 restart

Note

You can check the correctness of adding the address with the command ifconfig... You should have an interface eth0:1.

  1. Open the file /etc/sysconfig/network/ifcfg-eth0:
    vim /etc/sysconfig/network/ifcfg-eth0
  2. Press the key ito enter edit mode.
  3. Scroll down to the very bottom of the file and add the lines at the end:
    IPADDR_2='185.25.111.111'
    NETMASK_2='255.255.252.0'

    Instead 185.25.111.111 you need to enter your new IP. Instead 255.255.252.0 - you need to specify the value that you have indicated above in the line NETMASK.

  4. Restart the service with the command:
    service network restart

Note

You can check the correctness of adding the address using service network status... You should have lines like this:

network[13632]: eth0 IP address: <old_IP>
network[13632]: secondary eth0 IP address: <new_IP>
network[13632]: eth0 IP address: <IPv6>
network[13632]: eth0 is up
  1. Open the file /etc/sysconfig/network/ifcfg-eth0:
    vi /etc/sysconfig/network/ifcfg-eth0
  2. Press the key ito enter edit mode.
  3. After the line GATEWAY add the following lines:
    IPADDR0=185.25.111.111
    NETMASK0=255.255.252.0

    Instead 185.25.111.111 you need to enter your new IP. Instead 255.255.252.0 - you need to specify the value that you have indicated above in the line NETMASK.

  4. Restart the service with the command:
    service network restart

Note

You can check the correctness of adding the address with the command ip addr... You should display lines like this:

2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000 link / ether 10: 36: 3f: 04: 27: 47 brd ff: ff: ff: ff: ff: ff inet <old_IP> / 22 brd 185.25.111.255 scope global eth0 inet <new_IP>/22 scope global secondary eth0
Adding an address through ISPmanager is much easier - you need to go to this control panel, in the left column open the section “Server Tuning → List of IP addresses"And at the top right click the button"Create a ».
To add an additional address in this operating system, connect to it via RDP and in the system tray, right-click on the network connection icon. Select "Network and Sharing Center". In section "View active networks" click the link "LAN connection", And in the window that opens, click"Properties". Now select the line "Internet Protocol version 4" and press "Properties". In the new window, click “Additionally". Now click on the "Add to»And enter your new address and netmask. You must specify the network mask the same as that of the existing address.