欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

openstack 虛擬機配置VIP的實現(xiàn)步驟

 更新時間:2025年01月24日 09:32:08   作者:isxiaokun  
本文主要介紹了openstack 虛擬機配置VIP的實現(xiàn)步驟,包括查詢可用子網(wǎng)、創(chuàng)建VIP地址、綁定VIP到虛擬機端口等,具有一定的參考價值,感興趣的可以了解一下

1、查詢openstack可使用的子網(wǎng)

[root@test-opctrl ~]# openstack network list
+--------------------------------------+---------------+--------------------------------------+
| ID                                   | Name          | Subnets                              |
+--------------------------------------+---------------+--------------------------------------+
| 1c9e03f5-5983-49b9-997d-1ba5315da1e2 | net-vlan-1860 | a2204645-c397-42a4-8eb2-52e9ea181d7c |
| 2f32187f-e20a-4d67-ae9e-7c6949d03813 | net-vlan-1850 | 8cb50523-d91e-4558-8e89-cd0c84f9fb0f |
| 75084d12-883d-4c66-bf27-88cc3adb1d79 | net-vlan-1800 | fdbf0a71-3551-4092-b0be-d1a1f74a50b3 |
| 925f9243-2547-482d-a2c3-2a2bcf6e1653 | net-vlan-1870 | 049b9d6f-fc9a-4a76-9598-6bf113dac642 |
+--------------------------------------+---------------+--------------------------------------+

2、創(chuàng)建VIP地址

創(chuàng)建port來占用Vip,保證neutron不會將此IP在分配出去,避免后續(xù)虛擬機自動分配P沖突問題

命令示例:openstack port create  --fixed-ip subnet=<subnet_id>,ip-address=<vip_address> <vip-port-name>

subnet_id:openstack集群中子網(wǎng)的Subnets ID

vip_address:需要給虛擬機配置的VIP

vip-port-name:VIP的端口名稱

3、將VIP綁定至虛擬機端口

allowed_address_pairs:allowed_address_pairs 是 OpenStack Neutron 中的一個屬性,允許用戶在虛擬機(VM)接口上配置額外的 IP 地址或 MAC 地址

a)獲取虛擬機現(xiàn)有端口ID

命令示例:openstack port list --server <server-name>

[root@test-opctrl ~]# openstack port list --server test-out-nginx01
+--------------------------------------+------+-------------------+-----------------------------------------------------------------------------+--------+
| ID                                   | Name | MAC Address       | Fixed IP Addresses                                                          | Status |
+--------------------------------------+------+-------------------+-----------------------------------------------------------------------------+--------+
| c7b2115b-6bdd-4608-9229-5d53e4d2bc0b |      | fa:16:3e:ff:74:45 | ip_address='10.35.180.1', subnet_id='fdbf0a71-3551-4092-b0be-d1a1f74a50b3' | ACTIVE |
+--------------------------------------+------+-------------------+-----------------------------------------------------------------------------+--------+

[root@test-opctrl ~]# openstack port list --server test-out-nginx02
+--------------------------------------+------+-------------------+-----------------------------------------------------------------------------+--------+
| ID                                   | Name | MAC Address       | Fixed IP Addresses                                                          | Status |
+--------------------------------------+------+-------------------+-----------------------------------------------------------------------------+--------+
| a7ae1767-d10e-49bf-a7a8-12ae0ecc8fd1 |      | fa:16:3e:16:55:bc | ip_address='10.35.180.2', subnet_id='fdbf0a71-3551-4092-b0be-d1a1f74a50b3' | ACTIVE |
+--------------------------------------+------+-------------------+-----------------------------------------------------------------------------+--------+

b)為虛擬機端口添加allowed_address_pairs配置

使用 openstack port set 命令來配置 allowed_address_pairs

命令示例:openstack port set --allowed-address ip-address=<ip_address>,mac-address=<mac_address> <port_id>

只指定 IP 地址而不指定 MAC 地址。系統(tǒng)將自動允許此 IP 與當前端口的 MAC 地址配對

命令示例:openstack port set --allowed-address ip-address=&lt;ip_address&gt; &lt;port_id&gt;
[root@test-opctrl ~]# openstack port set --allowed-address ip-address=10.35.180.100 c7b2115b-6bdd-4608-9229-5d53e4d2bc0b
+-----------------------+-----------------------------------------------------------------------------+
| Field                 | Value                                                                       |
+-----------------------+-----------------------------------------------------------------------------+
| admin_state_up        | UP                                                                          |
| allowed_address_pairs | ip_address='10.35.180.100/32', mac_address='fa:16:3e:ff:74:45'               |
| binding_host_id       | test-opnode01                                                       |
| binding_profile       |                                                                             |
| binding_vif_details   | datapath_type='system', ovs_hybrid_plug='True', port_filter='True'          |
| binding_vif_type      | ovs                                                                         |
| binding_vnic_type     | normal                                                                      |
| created_at            | 2024-08-16T05:58:02Z                                                        |
| data_plane_status     | None                                                                        |
| description           |                                                                             |
| device_id             | 1ca2a3a4-875e-49ae-a27f-740e7f555526                                        |
| device_owner          | compute:nova                                                                |
| dns_assignment        | None                                                                        |
| dns_name              | None                                                                        |
| extra_dhcp_opts       |                                                                             |
| fixed_ips             | ip_address='10.35.180.1', subnet_id='fdbf0a71-3551-4092-b0be-d1a1f74a50b3' |
| id                    | c7b2115b-6bdd-4608-9229-5d53e4d2bc0b                                        |
| ip_address            | None                                                                        |
| mac_address           | fa:16:3e:ff:74:45                                                           |
| name                  |                                                                             |
| network_id            | 75084d12-883d-4c66-bf27-88cc3adb1d79                                        |
| option_name           | None                                                                        |
| option_value          | None                                                                        |
| port_security_enabled | True                                                                        |
| project_id            | b892ab684d4c4ee384c6023e68f018e9                                            |
| qos_policy_id         | None                                                                        |
| revision_number       | 12                                                                          |
| security_group_ids    | 36d985b0-ff44-49a3-a46e-504fe6ae73cd                                        |
| status                | ACTIVE                                                                      |
| subnet_id             | None                                                                        |
| tags                  |                                                                             |
| trunk_details         | None                                                                        |
| updated_at            | 2024-08-16T06:21:24Z                                                        |
+-----------------------+-----------------------------------------------------------------------------+

[root@test-opctrl ~]# openstack port set --allowed-address ip-address=10.35.180.100 a7ae1767-d10e-49bf-a7a8-12ae0ecc8fd1
+-----------------------+-----------------------------------------------------------------------------+
| Field                 | Value                                                                       |
+-----------------------+-----------------------------------------------------------------------------+
| admin_state_up        | UP                                                                          |
| allowed_address_pairs | ip_address='10.35.180.100/32', mac_address='fa:16:3e:16:55:bc'               |
| binding_host_id       | test-opnode02                                                       |
| binding_profile       |                                                                             |
| binding_vif_details   | datapath_type='system', ovs_hybrid_plug='True', port_filter='True'          |
| binding_vif_type      | ovs                                                                         |
| binding_vnic_type     | normal                                                                      |
| created_at            | 2024-08-16T05:58:15Z                                                        |
| data_plane_status     | None                                                                        |
| description           |                                                                             |
| device_id             | 3e84febd-dbf4-47cb-8336-dffcd9e59f33                                        |
| device_owner          | compute:nova                                                                |
| dns_assignment        | None                                                                        |
| dns_name              | None                                                                        |
| extra_dhcp_opts       |                                                                             |
| fixed_ips             | ip_address='10.35.180.2', subnet_id='fdbf0a71-3551-4092-b0be-d1a1f74a50b3' |
| id                    | a7ae1767-d10e-49bf-a7a8-12ae0ecc8fd1                                        |
| ip_address            | None                                                                        |
| mac_address           | fa:16:3e:16:55:bc                                                           |
| name                  |                                                                             |
| network_id            | 75084d12-883d-4c66-bf27-88cc3adb1d79                                        |
| option_name           | None                                                                        |
| option_value          | None                                                                        |
| port_security_enabled | True                                                                        |
| project_id            | b892ab684d4c4ee384c6023e68f018e9                                            |
| qos_policy_id         | None                                                                        |
| revision_number       | 12                                                                          |
| security_group_ids    | 36d985b0-ff44-49a3-a46e-504fe6ae73cd                                        |
| status                | ACTIVE                                                                      |
| subnet_id             | None                                                                        |
| tags                  |                                                                             |
| trunk_details         | None                                                                        |
| updated_at            | 2024-08-16T06:21:47Z                                                        |
+-----------------------+-----------------------------------------------------------------------------+

4、使用 Keepalived 配置高可用性 VIP

a)安裝keepalived

[root@test-nginx01 ~]# yum -y install keepalived

[root@test-nginx02 ~]# yum -y install keepalived

b)配置 Keepalived

編輯每臺虛擬機上的 Keepalived 配置文件(通常位于 /etc/keepalived/keepalived.conf)

[root@test-nginx01 ~]#  cat /etc/keepalived/keepalived.conf
! Configuration File for keepalived

global_defs {
   router_id node1
   notification_email {
    acassen@firewall.loc
    failover@firewall.loc
    sysadmin@firewall.loc
   }
   notification_email_from Alexandre.Cassen@firewall.loc
   smtp_server 127.0.0.1
   smtp_connect_timeout 30
}

#vrrp_script check_nginx {
#     script "killall -0 nginx"
#     interval 2
#     weight 2
#}

vrrp_instance VI_1 {
    state BACKUP
    interface eth0
    virtual_router_id 88
    priority 99
    advert_int 1
    authentication {
        auth_type PASS
        auth_pass cn1-test-apisix
    }
    virtual_ipaddress {
        10.35.180.100/32 dev eth0 label eth0:1
    }
    

    track_script {
        check_nginx
    }

}

c)啟動 Keepalived

在所有虛擬機上啟動并使 Keepalived 服務自動啟動

[root@test-nginx01 ~]# systemctl start keepalived
[root@test-nginx01 ~]# systemctl enable keepalived
[root@test-nginx01 ~]# 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
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether fa:16:3e:ff:74:45 brd ff:ff:ff:ff:ff:ff
    inet 10.35.180.1/24 brd 10.35.180.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet 10.35.180.100/32 scope global eth0:1
       valid_lft forever preferred_lft forever

到此這篇關(guān)于openstack 虛擬機配置VIP的實現(xiàn)步驟的文章就介紹到這了,更多相關(guān)openstack 配置VIP內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家! 

相關(guān)文章

最新評論