Vultr设置浮动ip保留IP教程

在Vultr的后台Network中有个Reserved IPs功能用来保留ip,也就是DO中的浮动IP功能

1665209647 image - Vultr设置浮动ip保留IP教程

该功能会分配一个ip来保留你vps的IP地址,当IP ping不通的时候避免频繁申请新容器来更换IP。

只需重新分配保留IP来解析即可。

Vultr的保留IP功能是收费的,一个IP每月3美金。

使用方面没有DO方便,申请并挂靠容器成功后,需要在vps中修改配置才能生效,之后解析到域名即可。

申请并挂靠:

1665210343 image - Vultr设置浮动ip保留IP教程

之后在容器设置中参考教程设置:

1665210409 image 1024x467 - Vultr设置浮动ip保留IP教程

以下是官方关于设置的教程。

Important Information

  • In most cases, you should not need to adjust these files. Instances are normally configured using DHCP. You only really need to change these files if you are trying to enable additional IPs.
  • Changing to the examples below will cause problems if you take a snapshot of an instance and restore it. We recommend reverting back to DHCP before taking a snapshot.
  • You must restart your server via the control panel after adding extra IPs.

CentOS 8

Populate the /etc/sysconfig/network-scripts/ifcfg-enp1s0 file with the following text.

TYPE="Ethernet"
DEVICE="enp1s0"
ONBOOT="yes"
BOOTPROTO="none"
IPADDR=139.180.207.244
PREFIX=23
GATEWAY=139.180.206.1
DNS1=108.61.10.10
IPADDR1=108.61.161.107
PREFIX1=32
IPV6INIT="yes"
IPV6_AUTOCONF="yes"

Restart the connection, or reboot.

nmcli con load /etc/sysconfig/network-scripts/ifcfg-enp1s0
nmcli con up 'System enp1s0'

CentOS 7

Populate the /etc/sysconfig/network-scripts/ifcfg-eth0 file with the following text.

DEVICE=eth0
ONBOOT=yes
BOOTPROTO=static
IPADDR=139.180.207.244
NETMASK=255.255.254.0
GATEWAY=139.180.206.1
DNS1=108.61.10.10

IPV6INIT=yes
IPV6ADDR="2401:c080:1000:48aa:5400:04ff:fe1e:bcac/64"
IPV6_AUTOCONF="yes"
DNS2=2001:19f0:300:1704::6

Populate the /etc/sysconfig/network-scripts/route-eth0 file with the following text.

169.254.0.0/16 dev eth0

Populate the /etc/sysconfig/network-scripts/ifcfg-eth0:1 file with the following text.

DEVICE=eth0:1
BOOTPROTO=static
IPADDR=108.61.161.107
NETMASK=255.255.255.255
ONBOOT=yes

Restart networking or reboot.

service network restart

CentOS 6

Populate the /etc/sysconfig/network-scripts/ifcfg-enp1s0 file with the following text.

DEVICE=enp1s0
ONBOOT=yes
BOOTPROTO=static
IPADDR=139.180.207.244
NETMASK=255.255.254.0
GATEWAY=139.180.206.1
DNS1=108.61.10.10

IPV6INIT=yes
IPV6ADDR="2401:c080:1000:48aa:5400:04ff:fe1e:bcac/64"
IPV6_AUTOCONF="yes"
DNS2=2001:19f0:300:1704::6

Populate the /etc/sysconfig/network-scripts/route-enp1s0 file with the following text.

169.254.0.0/16 dev enp1s0

Populate the /etc/sysconfig/network-scripts/ifcfg-enp1s0:1 file with the following text.

DEVICE=enp1s0:1
BOOTPROTO=static
IPADDR=108.61.161.107
NETMASK=255.255.255.255
ONBOOT=yes

Restart networking or reboot.

service network restart

Debian 7, Debian 8

Populate the /etc/network/interfaces file with the following text.

auto lo
iface lo inet loopback

auto enp1s0
iface enp1s0 inet static
	address 139.180.207.244
	netmask 255.255.254.0
	gateway 139.180.206.1
	dns-nameservers 108.61.10.10
	post-up ip route add 169.254.0.0/16 dev enp1s0

iface enp1s0 inet6 static
	address 2401:c080:1000:48aa:5400:04ff:fe1e:bcac
	netmask 64
	dns-nameservers 2001:19f0:300:1704::6

auto enp1s0:1
iface enp1s0:1 inet static
	address 108.61.161.107
	netmask 255.255.255.255

Restart networking or reboot.

systemctl restart networking.service

Debian 9, Debian 10

Populate the /etc/network/interfaces file with the following text.

auto lo
iface lo inet loopback

auto enp1s0
iface enp1s0 inet static
	address 139.180.207.244
	netmask 255.255.254.0
	gateway 139.180.206.1
	dns-nameservers 108.61.10.10
	post-up ip route add 169.254.0.0/16 dev enp1s0

iface enp1s0 inet6 static
	address 2401:c080:1000:48aa:5400:04ff:fe1e:bcac
	netmask 64
	dns-nameservers 2001:19f0:300:1704::6

auto enp1s0:1
iface enp1s0:1 inet static
	address 108.61.161.107
	netmask 255.255.255.255

Restart networking or reboot.

systemctl restart networking.service

Fedora 24 - 28

Populate the /etc/sysconfig/network-scripts/ifcfg-enp1s0 file with the following text.

DEVICE=enp1s0
ONBOOT=yes
NM_CONTROLLED=no
BOOTPROTO=static
NOZEROCONF=yes
IPADDR=139.180.207.244
NETMASK=255.255.254.0
GATEWAY=139.180.206.1
DNS1=108.61.10.10

IPV6INIT=yes
IPV6ADDR="2401:c080:1000:48aa:5400:04ff:fe1e:bcac/64"
IPV6_AUTOCONF="yes"
DNS2=2001:19f0:300:1704::6

Populate the /etc/sysconfig/network-scripts/route-enp1s0 file with the following text.

169.254.0.0/16 dev enp1s0

Populate the /etc/sysconfig/network-scripts/ifcfg-enp1s0:1 file with the following text.

DEVICE=enp1s0:1
BOOTPROTO=static
IPADDR=108.61.161.107
NETMASK=255.255.255.255
ONBOOT=yes

Restart networking or reboot.

systemctl restart network.service

Fedora 29 - 31

Run the following commands to configure the public network.

nmcli con add con-name public-net ifname enp1s0 type ethernet ipv4.method 'manual' ipv4.addresses '139.180.207.244/23' ipv4.gateway '139.180.206.1' ipv4.dns ''
nmcli con mod public-net +ipv4.addresses '108.61.161.107'
nmcli con mod public-net +ipv4.dns '108.61.10.10'

nmcli con mod public-net ipv6.method 'auto' ipv6.addresses ''
nmcli con up public-net

FreeBSD 10.x, FreeBSD 11.x, FreeBSD 12.x

Populate the /etc/rc.conf file with the following text.

static_routes="linklocal"
route_linklocal="-net 169.254.0.0/16 -interface vtnet0"
ifconfig_vtnet0="inet 139.180.207.244 netmask 255.255.254.0"
defaultrouter="139.180.206.1"
ifconfig_vtnet0_alias0="108.61.161.107 netmask 255.255.255.255"

rtsold_enable="YES"
ipv6_activate_all_interfaces="YES"
rtsold_flags="-aF"
ifconfig_vtnet0_ipv6="inet6 2401:c080:1000:48aa:5400:04ff:fe1e:bcac prefixlen 64"

Reboot the system.

reboot

OpenBSD 6.0 - OpenBSD 6.2

Populate the /etc/mygate file with the following text.

139.180.206.1

Populate the /etc/hostname.vio0 file with the following text.

inet 139.180.207.244 255.255.254.0 NONE
inet alias 108.61.161.107 255.255.255.255
inet6 autoconf -autoconfprivacy

Populate the /etc/resolv.conf file with the following text.

nameserver 108.61.10.10
lookup file bind

Reboot the system.

reboot

OpenBSD 6.3 - OpenBSD 6.8

Populate the /etc/mygate file with the following text.

139.180.206.1

Populate the /etc/hostname.vio0 file with the following text.

inet 139.180.207.244 255.255.254.0 NONE
inet alias 108.61.161.107 255.255.255.255
inet6 autoconf -autoconfprivacy -soii

Populate the /etc/resolv.conf file with the following text.

nameserver 108.61.10.10
lookup file bind

Reboot the system.

reboot

OpenBSD 6.9

Populate the /etc/mygate file with the following text.

139.180.206.1

Populate the /etc/hostname.vio0 file with the following text.

inet 139.180.207.244 255.255.254.0 NONE
inet alias 108.61.161.107 255.255.255.255
inet6 autoconf -soii -temporary

Populate the /etc/resolv.conf file with the following text.

nameserver 108.61.10.10
lookup file bind

Reboot the system.

reboot

Ubuntu 12.xx - Ubuntu 15.xx

Populate the /etc/network/interfaces file with the following text.

auto lo
iface lo inet loopback

auto enp1s0
iface enp1s0 inet static
	address 139.180.207.244
	netmask 255.255.254.0
	gateway 139.180.206.1
	dns-nameservers 108.61.10.10
	post-up ip route add 169.254.0.0/16 dev enp1s0

iface enp1s0 inet6 static
	address 2401:c080:1000:48aa:5400:04ff:fe1e:bcac
	netmask 64
	dns-nameservers 2001:19f0:300:1704::6

auto enp1s0:1
iface enp1s0:1 inet static
	address 108.61.161.107
	netmask 255.255.255.255

Start each interface or reboot the system.

ifup eth0

Ubuntu 16.xx, Ubuntu 17.04

Populate the /etc/network/interfaces file with the following text.

auto lo
iface lo inet loopback

auto enp1s0
iface enp1s0 inet static
	address 139.180.207.244
	netmask 255.255.254.0
	gateway 139.180.206.1
	dns-nameservers 108.61.10.10
	post-up ip route add 169.254.0.0/16 dev enp1s0

iface enp1s0 inet6 static
	address 2401:c080:1000:48aa:5400:04ff:fe1e:bcac
	netmask 64
	dns-nameservers 2001:19f0:300:1704::6

auto enp1s0:1
iface enp1s0:1 inet static
	address 108.61.161.107
	netmask 255.255.255.255

Start each interface or reboot the system.

ifup enp1s0

Ubuntu 17.10, Ubuntu 18.xx, Ubuntu 19.xx, Ubuntu 20.xx

Populate the /etc/netplan/10-ens3.yaml file with the following text.

network:
  version: 2
  renderer: networkd
  ethernets:
    enp1s0:
      dhcp4: no
      addresses: [139.180.207.244/23,108.61.161.107/32,'2401:c080:1000:48aa:5400:04ff:fe1e:bcac/64']
      gateway4: 139.180.206.1
      nameservers:
        addresses: [108.61.10.10]
      routes:
      - to: 169.254.0.0/16
        via: 139.180.206.1
        metric: 100

Update networking or reboot.

netplan apply

Windows Server 2012 R2, Windows Server 2016, Windows Server 2019

To configure the main IPv4 manually:

  1. Open the windows control panel. You can access it from the start menu.
  2. Click "Network and Internet".
  3. Click "Network and Sharing Center".
  4. Click "Change adapter settings".
  5. Right click on the primary ethernet adapter, and click "Properties". The "Ethernet Properties" window will open.
  6. Select "Internet Protocol Version 4 (TCP/IPv4)", then click the "Properties" button. The "Internet Protocol Version 4 (TCP/IPv4) Properties" window will open.
  7. Check the box that reads "Use the following IP address:". Populate the fields:
    • IP address: 139.180.207.244
    • Subnet mask: 255.255.254.0
    • Default gateway: 139.180.206.1
  8. Check the box that reads "Use the following DNS server addresses:". Populate the fields
    • Preferred DNS server: 108.61.10.10
    • Alternate DNS server: (blank)
  9. Click "OK". Then click "OK" on the "Ethernet Properties" window. The main IPv4 has been configured manually. Note that it is normal for the connection to hiccup after pressing "OK".

The main IPv4 address must be configured manually before adding more IPv4 addresses. To add your additional IPv4 addresses:

  1. Follow the steps above and navigate to the "Internet Protocol Version 4 (TCP/IPv4) Properties" window for the primary ethernet adapter.
  2. Click "Advanced...". The "Advanced TCP/IP Settings" window will open.
  3. In the "IP addresses" group, click "Add...". The "TCP/IP Address" window will open. Add addresses:
    • IP address: 108.61.161.107, Subnet mask: 255.255.255.255
  4. Click "OK" on the "Advanced TCP/IP Settings" window. This window will close.
  5. Click "OK" on the "Internet Protocol Version 4 (TCP/IPv4) Properties" window. This window will close.
  6. Click "OK" on the "Ethernet Properties" window. This window will close, and your additional IP addresses will be configured. Note that it is normal for the connection to hiccup after pressing "OK".

0