经常有客户咨询阿里云服务器怎么实现绑定多IP地址? 阿里云服务器多个弹性公网IP是否可以绑定到一台实例上?本文通过实操的方式为大家介绍,步骤相对较多阿里云控制台步骤有所简化,如果有什么不理解可以联系我们。
Is it possible to bind multiple flexi-net IPs to an example? By doing so, this paper describes the relatively large number of steps that have been simplified, and if there is a lack of understanding, we can be contacted.
配置前须知
pre-configuration
1、参考实例规格族绑定弹性网卡和内网IP的个数限制:https://help.aliyun.com/document_detail/25378.html
1. Number of limitations on elastic net cards and IPs for reference example specification groups:
阿里云服务器支持绑定的IP数(固定Ip和弹性公网IP之和):(弹性网卡-1)*单网卡私有IP+1
Aliyun servers support binding IPs (fixed Ip and elastic public network IP sum): (flexible net card-1)* private Internet card IP+1
以hfc7实例规格“2核4G”为例可绑定的IP数为:(2-1)*6+1=7个;
The number of IPs to be bound by the lfc7 example specification "2 Nuclear 4G " is: (2-1)* 6+1 = 7;
注意:云服务器封顶绑定IP数21个,因为弹性公网IP一个地域仅支持申请20个。
Note: Cloud server tops are tied to 21 IPs, as only 20 applications are supported in one geographic area of the Flexible Net IP.
2、配置弹性网卡:https://help.aliyun.com/document_detail/56955.html
3、分配辅助私网IP地址:https://help.aliyun.com/document_detail/101180.htm
3. Allocation of assistive IP addresses:
5、建议您服务器创建快照备份。操作流程请参见创建快照
5. It is recommended that your server create a snapshot backup. See .
CPU&内存:1核1 GiB
CPU & Memory: 1 N1 GIB
操作系统:CentOS 7.8 64位
Operating system: CentOS 7.8 64-bit
实例规格:ecs.s6-c1m1.small
Example Specifications: ecs.s6-c1m1.small
实例规格族:ecs.s6
Example family: ecs.s6
2、创建弹性网卡绑定阿里云服务器
3、创建两个弹性公网ip绑定到,分别绑定到辅助网卡的主私网IP和辅助私网IP上。
3, to create two flexi-net ips to be tied to the backnet IP and backnet IP of the backnet card.
下图已经绑定完成
The following chart has been tied to
br/>br/>br/>
[root@iZ7u1o01onqjo4Z ~]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 00:16:3e:02:3b:0b brd ff:ff:ff:ff:ff:ff
inet 172.19.6.126/24 brd 172.19.6.255 scope global dynamic eth0
valid_lft 315359681sec preferred_lft 315359681sec
inet6 fe80::216:3eff:fe02:3b0b/64 scope link
valid_lft forever preferred_lft forever
3: eth1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
link/ether 00:16:3e:26:67:2e brd ff:ff:ff:ff:ff:ff
[root@iZ7u1o01onqjo4Z ~]# wget https://image-offline.oss-cn-hangzhou.aliyuncs.com/multi-nic-util/multi-nic-util-0.6.tgz
--2021-06-16 20:30:44-- https://image-offline.oss-cn-hangzhou.aliyuncs.com/multi-nic-util/multi-nic-util-0.6.tgz
正在解析主机 image-offline.oss-cn-hangzhou.aliyuncs.com (image-offline.oss-cn-hangzhou.aliyuncs.com)... 118.31.232.173
Resolving host Image-offline.oss-cn-hangzhou.aliyuncs.com (image-offline.oss-cn-hangzhou.aliyuncs.com) 118.31.232.173
正在连接 image-offline.oss-cn-hangzhou.aliyuncs.com (image-offline.oss-cn-hangzhou.aliyuncs.com)|118.31.232.173|:443... 已连接。
Connecting Image-offline.oss-cn-hangzhou.aliyuncs.com (image-offline.oss-cn-hangzhou.aliyuncs.com) 118.31.232.173:443 is connected.
已发出 HTTP 请求,正在等待回应... 200 OK
HTTP request sent, awaiting response... 200 OK
长度:9149 (8.9K) [application/x-gzip]
Length: 9149 (8.9K) [application/x-gzip]
正在保存至: “multi-nic-util-0.6.tgz”
Saved to: "multi-nic-util-0.6.tgz"
100%[======================================>] 9,149 --.-K/s 用时 0s
100% [= = = = = = = = = = = = = = = = = = = = = = = = >] 9,149 & nbsp; --.-K/s uses 0s & nbsp; & nbsp;
2021-06-16 20:30:44 (52.0 MB/s) - 已保存 “multi-nic-util-0.6.tgz” [9149/9149])
2021-06-16 2030:44 (52.0 MB/s) - saved "multi-nic-util-0.6.tgz" [9149/9149])
[root@iZ7u1o01onqjo4Z ~]# tar -zxvf multi-nic-util-0.6.tgz
multi-nic-util-0.6/
multi-nic-util-0.6/install.sh
multi-nic-util-0.6/src/
multi-nic-util-0.6/src/dhcp/
multi-nic-util-0.6/src/dhcp/dhclient-exit-hooks
multi-nic-util-0.6/src/dhcp/dhclient-exit-hooks-for-debug
multi-nic-util-0.6/src/dhcp/dhclient-down-hooks
multi-nic-util-0.6/src/udev/
multi-nic-util-0.6/src/udev/rule_generator.functions
multi-nic-util-0.6/src/udev/write_net_rules
multi-nic-util-0.6/src/udev-rules/
multi-nic-util-0.6/src/udev-rules/61-eni.rules
multi-nic-util-0.6/src/udev-rules/75-persistent-net-generator.rules
multi-nic-util-0.6/src/udev-rules/60-net.rules
multi-nic-util-0.6/src/eni-utils/
multi-nic-util-0.6/src/eni-utils/eni-hotplug
multi-nic-util-0.6/src/eni-utils/eni-function
multi-nic-util-0.6/src/eni-utils/net.hotplug
multi-nic-util-0.6/src/eni-utils/eni-cleanup
multi-nic-util-0.6/src/eni-utils/eni-ifscan
multi-nic-util-0.6/src/eni-utils/eni-version
multi-nic-util-0.6/src/eni-utils/eni-helper
multi-nic-util-0.6/src/boot/
multi-nic-util-0.6/src/boot/eni.service
multi-nic-util-0.6/src/boot/systemd-udevd.service
multi-nic-util-0.6/src/boot/eni-service
multi-nic-util-0.6/src/lib/
multi-nic-util-0.6/src/lib/distro.sh
[root@iZ7u1o01onqjo4Z ~]# cd multi-nic-util-0.6
[root@iZ7u1o01onqjo4Z multi-nic-util-0.6]# bash install.sh
the file /lib/udev/write_net_rules NOT exist...
the file /lib/udev/rule_generator.functions NOT exist...
delete the file: /etc/udev/rules.d/70-persistent-net.rules
replace the file: /lib/udev/rules.d/60-net.rules
Created symlink from /etc/systemd/system/multi-user.target.wants/eni.service to /usr/lib/systemd/system/eni.service.
ecs_mq.service enabled
[root@iZ7u1o01onqjo4Z multi-nic-util-0.6]# systemctl restart eni.service
[root@iZ7u1o01onqjo4Z multi-nic-util-0.6]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 00:16:3e:02:3b:0b brd ff:ff:ff:ff:ff:ff
inet 172.19.6.126/24 brd 172.19.6.255 scope global dynamic eth0
valid_lft 315359623sec preferred_lft 315359623sec
inet6 fe80::216:3eff:fe02:3b0b/64 scope link
valid_lft forever preferred_lft forever
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 00:16:3e:26:67:2e brd ff:ff:ff:ff:ff:ff
inet6 fe80::216:3eff:fe26:672e/64 scope link tentative
valid_lft forever preferred_lft forever
[root@iZ7u1o01onqjo4Z multi-nic-util-0.6]# cat /etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE=eth1
BOOTPROTO=dhcp
ONBOOT=yes
TYPE=Ethernet
USERCTL=yes
PEERDNS=no
IPV6INIT=no
PERSISTENT_DHCLIENT=yes
HWADDR=00:16:3e:26:67:2e
DEFROUTE=no
[root@iZ7u1o01onqjo4Z multi-nic-util-0.6]#
[root@iZ7u1o01onqjo4Z multi-nic-util-0.6]# vi /etc/sysconfig/network-scripts/ifcfg-eth1
[root@iZ7u1o01onqjo4Z multi-nic-util-0.6]#
[root@iZ7u1o01onqjo4Z multi-nic-util-0.6]# cat /etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE=eth1
BOOTPROTO=no
ONBOOT=yes
TYPE=Ethernet
USERCTL=yes
PEERDNS=no
IPV6INIT=no
PERSISTENT_DHCLIENT=yes
HWADDR=00:16:3e:26:67:2e
IPADDR0=172.19.6.127
IPADDR1=172.19.6.129
DEFROUTE=no
[root@iZ7u1o01onqjo4Z multi-nic-util-0.6]#
[root@iZ7u1o01onqjo4Z multi-nic-util-0.6]# service network restart
Restarting network (via systemctl): [ OK ]
[root@iZ7u1o01onqjo4Z multi-nic-util-0.6]#
[root@iZ7u1o01onqjo4Z multi-nic-util-0.6]#
[root@iZ7u1o01onqjo4Z multi-nic-util-0.6]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 00:16:3e:02:3b:0b brd ff:ff:ff:ff:ff:ff
inet 172.19.6.126/24 brd 172.19.6.255 scope global dynamic eth0
valid_lft 315359953sec preferred_lft 315359953sec
inet6 fe80::216:3eff:fe02:3b0b/64 scope link
valid_lft forever preferred_lft forever
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 00:16:3e:26:67:2e brd ff:ff:ff:ff:ff:ff
inet 172.19.6.127/16 brd 172.19.255.255 scope global eth1
valid_lft forever preferred_lft forever
inet 172.19.6.129/16 brd 172.19.255.255 scope global secondary eth1
valid_lft forever preferred_lft forever
inet6 fe80::216:3eff:fe26:672e/64 scope link
valid_lft forever preferred_lft forever
分别访问三个公网IP地址,均可以正常访问了,说明配置没问题。
Each of the three IP addresses on the Internet is regularly visited, indicating that the configuration is not a problem.
注册有任何问题请添加 微信:MVIP619 拉你进入群
打开微信扫一扫
添加客服
进入交流群
发表评论