步骤:
一、登陆到openstack后台,根据路径 项目->网络→网络, 找到对应网络
![](https://i-blog.csdnimg.cn/blog_migrate/6c9913641859a96996d5a1db3a363782.png)
二、进入网络详情界面,创建端口
![](https://imgconvert.csdnimg.cn/aHR0cHM6Ly93aWtpLnZtZWV0aW5nLmNuOjEzMDEvZG93bmxvYWQvdGh1bWJuYWlscy84MTYwMDg0L2ltYWdlMjAyMC00LTI0XzE0LTU4LTI4LnBuZw?x-oss-process=image/format,png)
![](https://i-blog.csdnimg.cn/blog_migrate/efa316038d0153a4d383e3d3292562dc.png)
![](https://i-blog.csdnimg.cn/blog_migrate/a36895a39ee0aa97691a06116ffbdea0.png)
三、根目录(环境变量所在目录),执行环境变量
[root@controller ~] # source admin-openrc |
四、执行neutron port-list, 找到需配置虚地址机器的网络port-id
10.300.0.117/10.300.0.118为需要配置虚地址的机器IP , 53e13274-9589-45bf-8b26-7617848ac54b/10a28179-368b-4e8c-9f71-046d24bb6ec7 为对应网络port-id
[root@controller ~] # neutron port-list|grep 10.300.0.117 neutron CLI is deprecated and will be removed in the future. Use openstack CLI instead. | 53e13274-9589-45bf-8b26-7617848ac54b | kh-v300-117 | 2098c535c358495cbcae0564d0d66037 | fa:16:3e:33:17:72 | { "subnet_id" : "2da3c97e-d6ba-4384-ae18-3d919dc28920" , "ip_address" : "10.300.0.117" } | [root@controller ~] # neutron port-list|grep 10.300.0.118 neutron CLI is deprecated and will be removed in the future. Use openstack CLI instead. | 10a28179-368b-4e8c-9f71-046d24bb6ec7 | kh-v300-118 | 2098c535c358495cbcae0564d0d66037 | fa:16:3e:16:d5:bb | { "subnet_id" : "2da3c97e-d6ba-4384-ae18-3d919dc28920" , "ip_address" : "10.300.0.118" } | |
五、执行neutron port-update, 增加allow_address_pairs属性
neutron port-update xxx(port-id) --allowed_address_pairs list=true type=dict ip_address=10.300.0.217(虚地址)
[root@controller ~] # neutron port-update 53e13274-9589-45bf-8b26-7617848ac54b --allowed_address_pairs list=true type=dict ip_address=10.300.0.217 neutron CLI is deprecated and will be removed in the future. Use openstack CLI instead. Updated port: 53e13274-9589-45bf-8b26-7617848ac54b [root@controller ~] # neutron port-update 10a28179-368b-4e8c-9f71-046d24bb6ec7 --allowed_address_pairs list=true type=dict ip_address=10.300.0.217 neutron CLI is deprecated and will be removed in the future. Use openstack CLI instead. Updated port: 10a28179-368b-4e8c-9f71-046d24bb6ec7 |