Warning: mysqli_num_fields() expects parameter 1 to be mysqli_result, boolean given in /www/wwwroot/dev.zhalaotie.com/wp-includes/wp-db.php on line 3215

Warning: mysqli_num_fields() expects parameter 1 to be mysqli_result, boolean given in /www/wwwroot/dev.zhalaotie.com/wp-includes/wp-db.php on line 3215
Vultr VPS CentOS 7 添加额外 IP – 扎老铁
Warning: mysqli_num_fields() expects parameter 1 to be mysqli_result, boolean given in /www/wwwroot/dev.zhalaotie.com/wp-includes/wp-db.php on line 3215

Warning: mysqli_num_fields() expects parameter 1 to be mysqli_result, boolean given in /www/wwwroot/dev.zhalaotie.com/wp-includes/wp-db.php on line 3215
Warning: mysqli_num_fields() expects parameter 1 to be mysqli_result, boolean given in /www/wwwroot/dev.zhalaotie.com/wp-includes/wp-db.php on line 3215
class="post-53342 post type-post status-publish format-standard hentry">

Vultr VPS CentOS 7 添加额外 IP

This tutorial explains how to setup an additional IPv4 address on your Vultr VPS. We will assume the following:

  • The Main IP Address of your VPS is 1.2.3.4.
  • You have purchased an additional IP address through the Vultr control panel, and you were assigned 1.2.3.5.

After purchasing an additional IPv4 address you must restart the VPS using the “Server Restart” feature from within the Vultr control panel. This must be done regardless of the installed operating system.

Each example below will configure the secondary IP address to become automatically available, and remain configured even after your server is rebooted. You can test if the IP address is configured by pinging it with the ping utility on your client computer.

 

 

 

centos 如何将独立IP配置到Vultr VPS上:

1、SSH登录到VPS,vi打开/etc/sysconfig/network-scripts/ifcfg-eth0

vi /etc/sysconfig/network-scripts/ifcfg-eth0

删掉原来的内容,添加下面的代码,IPADDR,NETMASK,GATEWAY替换成你自己的:

DEVICE="eth0"
BOOTPROTO="static"
ONBOOT="yes"
TYPE="Ethernet"
NM_CONTROLLED="no"
IPADDR=xxx.xxx.xxx.xxx
NETMASK=xxx.xxx.xxx.xxx
GATEWAY=xxx.xxx.xxx.xxx

保存后,运行命令在线激活配置:

ifup eth0

系统返回类似下面语句,说明配置正确:
RTNETLINK answers: File exists

2、创建一个文件:/etc/sysconfig/network-scripts/ifcfg-eth0:1

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

添加如下内容(IPADDR是刚购买的IP地址),保存:

DEVICE=eth0:1
BOOTPROTO=static
IPADDR=xxx.xxx.xxx.xxx
ONBOOT=yes

3、使IP生效,执行

ifup eth0:1

系统返回类似下面语句,说明配置正确:
Determining if ip address 108.61.xxx.xxx is already in use for device eth0…
RTNETLINK answers: File exists

网关不用修改,也只需要原来的那一组,需要添加 eth0:0 , eth0:1 , eth0:X 一直下去。修改之后,用命令/etc/init.d/networking restart 重启网络

最后在Vultr后台的控制面板重启VPS即可!

 

=======

 

Centos为例
编辑eth0,网关和子网掩码可以通过ifconfig查看.

vi /etc/sysconfig/network-scripts/ifcfg-eth0

# Configuration for eth0

DEVICE=eth0

BOOTPROTO=none

# This line ensures that the interface will be brought up during boot.

ONBOOT=yes

# eth0 – This is the main IP address that will be used for most outbound connections.

# The address, netmask and gateway are all necessary.

IPADDR=12.34.56.78  (这里是你的第一个IP地址)

NETMASK=255.255.255.0 (这里是子网掩码)

GATEWAY=12.34.56.1 (网关)

添加第二个IP, File: /etc/sysconfig/network-scripts/ifcfg-eth0:1

vi /etc/sysconfig/network-scripts/ifcfg-eth0:0

# Configuration for eth0:0

DEVICE=eth0:0

BOOTPROTO=none

# This line ensures that the interface will be brought up during boot.

ONBOOT=yes

# eth0:0

IPADDR=34.56.78.90

NETMASK=255.255.255.0

GATEWAY=12.34.56.1

搞定
此时重启网络就可以了

service network restart

https://www.vultr.com/docs/add-secondary-ipv4-address

另外表示换了二十几个 IP,才换到一个没被墙掉的 IP。。。。

发表评论

电子邮件地址不会被公开。