[VM trunk ports]opensatck VM 单网卡,多VLAN配置
描述
需求产生场景
1、用户在虚机运行 K8S ,采用 VLAN 模式组网,要求 VM 端口要支持 trunk,支持多个 VLAN 网络数据在同一虚拟网卡上传输。
2、需要动态的增删虚拟机上的网络接口。通过增删vlan相对来说更加简单和快捷。
环境描述
openstack version:train
网络名称 | 模式 | vlan id |
---|---|---|
Vm_Trunk_Net_500 | vlan | 500 |
Vm_Sub_Net_501 | vlan | 501 |
Vm_Sub_Net_502 | vlan | 502 |
配置实现
在 neuteon server plugin 中启用 trunk
1、kolla-ansible部署openstack的修改方式
$ vim /etc/kolla/conf/neutron.conf
service_plugins=router,trunk
# 执行让neutron配置生效
$ kolla-ansible -i /etc/ansible/hosts -t neutron deploy
2、手工部署opensatck修改方式
$ vim ${neutron_path}/neutron.conf
[DEFAULT]
service_plugins = router,trunk
# 重启neutron相关服务
创建VM trunk ports
# 从Vm_Trunk_Net_500网络创建一个端口作为父端口
$ openstack port create --network Vm_Trunk_Net_500 parent-trunk-port
点击查看创建父端口详情
$ openstack port create --network Vm_Trunk_Net_500 parent-trunk-port
+-------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Field | Value |
+-------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| admin_state_up | UP |
| allowed_address_pairs | |
| binding_host_id | |
| binding_profile | |
| binding_vif_details | |
| binding_vif_type | unbound |
| binding_vnic_type | normal |
| created_at | 2022-02-28T00:27:33Z |
| data_plane_status | None |
| description | |
| device_id | |
| device_owner | |
| dns_assignment | None |
| dns_domain | None |
| dns_name | None |
| extra_dhcp_opts | |
| fixed_ips | ip_address='10.0.1.53', subnet_id='adc1d30e-b08f-46e9-8f09-45ad06eaed12' |
| id | 1f7835f4-fe89-46fc-ba8c-7ce93d9a5bb2 |
| location | cloud='', project.domain_id=, project.domain_name='Default', project.id='a3f435fc08854b828b3346aa1581d39f', project.name='admin', region_name='RegionOne', zone= |
| mac_address | fa:16:3e:7f:ca:16 |
| name | parent-trunk-port |
| network_id | 96485d8a-0600-44b1-a535-c813fe9a7a86 |
| port_security_enabled | False |
| project_id | a3f435fc08854b828b3346aa1581d39f |
| propagate_uplink_status | None |
| qos_policy_id | None |
| resource_request | None |
| revision_number | 1 |
| security_group_ids | |
| status | DOWN |
| tags | |
| trunk_details | None |
| updated_at | 2022-02-28T00:27:33Z |
+-------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+
# 创建一个trunk connection,关联父端口(parent-trunk-port),trunk名字为parent-trunk
$ openstack network trunk create --parent-port parent-trunk-port parent-trunk
+-----------------+--------------------------------------+
| Field | Value |
+-----------------+--------------------------------------+
| admin_state_up | UP |
| created_at | 2022-02-28T00:28:53Z |
| description | |
| id | 5e579416-218e-4fca-8743-bee2654f3d4a |
| name | parent-trunk |
| port_id | 1f7835f4-fe89-46fc-ba8c-7ce93d9a5bb2 |
| project_id | a3f435fc08854b828b3346aa1581d39f |
| revision_number | 0 |
| status | DOWN |
| sub_ports | |
| tags | [] |
| tenant_id | a3f435fc08854b828b3346aa1581d39f |
| updated_at | 2022-02-28T00:28:53Z |
+-----------------+--------------------------------------+
# 查看创建好的trunk口(最后会把trunk口挂给VM作为port)
$ openstack network trunk list
+--------------------------------------+--------------+--------------------------------------+-------------+
| ID | Name | Parent Port | Description |
+--------------------------------------+--------------+--------------------------------------+-------------+
| 5e579416-218e-4fca-8743-bee2654f3d4a | parent-trunk | 1f7835f4-fe89-46fc-ba8c-7ce93d9a5bb2 | |
+--------------------------------------+--------------+--------------------------------------+-------------+
# 创建两个 subports,作为trunk 的子接口,也就是实际放通的vlan
$ openstack port create --network Vm_Sub_Net_501 subport-trunk-port-vlan501
$ openstack port create --network Vm_Sub_Net_502 subport-trunk-port-vlan502
点击查看创建subports详情
$ openstack port create --network Vm_Sub_Net_501 subport-trunk-port-vlan501
+-------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Field | Value |
+-------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| admin_state_up | UP |
| allowed_address_pairs | |
| binding_host_id | |
| binding_profile | |
| binding_vif_details | |
| binding_vif_type | unbound |
| binding_vnic_type | normal |
| created_at | 2022-02-28T00:35:26Z |
| data_plane_status | None |
| description | |
| device_id | |
| device_owner | |
| dns_assignment | None |
| dns_domain | None |
| dns_name | None |
| extra_dhcp_opts | |
| fixed_ips | ip_address='192.168.2.189', subnet_id='f1931d63-c58b-4a5e-a627-b0c3e0cfe108' |
| id | ccb00cc7-8ef5-4c98-9778-c86c11a9da2d |
| location | cloud='', project.domain_id=, project.domain_name='Default', project.id='a3f435fc08854b828b3346aa1581d39f', project.name='admin', region_name='RegionOne', zone= |
| mac_address | fa:16:3e:2e:76:25 |
| name | subport-trunk-port-vlan501 |
| network_id | 8fc28fb7-d24c-4dc5-97f1-bcdb7116323d |
| port_security_enabled | False |
| project_id | a3f435fc08854b828b3346aa1581d39f |
| propagate_uplink_status | None |
| qos_policy_id | None |
| resource_request | None |
| revision_number | 1 |
| security_group_ids | |
| status | DOWN |
| tags | |
| trunk_details | None |
| updated_at | 2022-02-28T00:35:26Z |
+-------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+
$ openstack port create --network Vm_Sub_Net_502 subport-trunk-port-vlan502
+-------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Field | Value |
+-------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| admin_state_up | UP |
| allowed_address_pairs | |
| binding_host_id | |
| binding_profile | |
| binding_vif_details | |
| binding_vif_type | unbound |
| binding_vnic_type | normal |
| created_at | 2022-02-28T00:35:51Z |
| data_plane_status | None |
| description | |
| device_id | |
| device_owner | |
| dns_assignment | None |
| dns_domain | None |
| dns_name | None |
| extra_dhcp_opts | |
| fixed_ips | ip_address='192.168.2.157', subnet_id='c1a6e47d-babe-4cd8-b953-07e7773015ef' |
| id | 04b64548-4499-4997-a8eb-340c47fe6e03 |
| location | cloud='', project.domain_id=, project.domain_name='Default', project.id='a3f435fc08854b828b3346aa1581d39f', project.name='admin', region_name='RegionOne', zone= |
| mac_address | fa:16:3e:b8:64:de |
| name | subport-trunk-port-vlan502 |
| network_id | 0c590e19-9aca-4cb6-ae70-0e7124160a39 |
| port_security_enabled | False |
| project_id | a3f435fc08854b828b3346aa1581d39f |
| propagate_uplink_status | None |
| qos_policy_id | None |
| resource_request | None |
| revision_number | 1 |
| security_group_ids | |
| status | DOWN |
| tags | |
| trunk_details | None |
| updated_at | 2022-02-28T00:35:51Z |
+-------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+
# 把subport关联到trunk(parent-trunk)
# subport-trunk-port-vlan501 = ccb00cc7-8ef5-4c98-9778-c86c11a9da2d
# subport-trunk-port-vlan502 = 04b64548-4499-4997-a8eb-340c47fe6e03
# port=subport-id,segmentation-type=网络模式,segmentation-id=subport-vlan-id
$ openstack network trunk set --subport port=ccb00cc7-8ef5-4c98-9778-c86c11a9da2d,segmentation-type=vlan,segmentation-id=501 parent-trunk
$ openstack network trunk set --subport port=04b64548-4499-4997-a8eb-340c47fe6e03,segmentation-type=vlan,segmentation-id=502 parent-trunk
# 查看trunk口的信息,看看是否把subport关联到trunk口成功, sub_ports字段有你关联的子接口即为成功。
$ openstack network trunk show parent-trunk
+-----------------+-------------------------------------------------------------------------------------------------+
| Field | Value |
+-----------------+-------------------------------------------------------------------------------------------------+
| admin_state_up | UP |
| created_at | 2022-02-28T00:28:53Z |
| description | |
| id | 5e579416-218e-4fca-8743-bee2654f3d4a |
| name | parent-trunk |
| port_id | 1f7835f4-fe89-46fc-ba8c-7ce93d9a5bb2 |
| project_id | a3f435fc08854b828b3346aa1581d39f |
| revision_number | 2 |
| status | DOWN |
| sub_ports | port_id='ccb00cc7-8ef5-4c98-9778-c86c11a9da2d', segmentation_id='501', segmentation_type='vlan' |
| | port_id='04b64548-4499-4997-a8eb-340c47fe6e03', segmentation_id='502', segmentation_type='vlan' |
| tags | [] |
| tenant_id | a3f435fc08854b828b3346aa1581d39f |
| updated_at | 2022-02-28T00:41:11Z |
+-----------------+-------------------------------------------------------------------------------------------------+
把trunk口挂给虚拟机使用。
# nova interface-attach ${vm-id} --port-id ${trunk-port-id}
$ nova interface-attach 072beefc-ff79-4baa-bb8c-6e7f754399c2 --port-id 5e579416-218e-4fca-8743-bee2654f3d4a
# 接下来可分别在centos虚拟机,创建两个子接口,vlan分别为501,502。
# 可采用tcpdump -i ${interface} -nne icmp 抓虚拟机所在宿主机物理口的流量,看看是否打上相应的tag出去。
[VM trunk ports]opensatck VM 单网卡,多VLAN配置的更多相关文章
- 使用Squid做代理服务器,Squid单网卡透明代理配置详解(转)
使用Squid做代理服务器 说到代理服务器,我们最先想到的可能是一些专门的代理服务器网站,某些情况下,通过它们能加快访问互联网的速度.其实,在需要访问外部的局域网中,我们自己就能设置代理,把访问次数较 ...
- Centos7单网卡带VLAN多IP配置
1.需要使用到vconfig软件,首先yum安装vconfig: 使用指令yum install vconfig:(若是本机找不到vconfig安装包,可以通过其他centos7安装yum-utils ...
- windows2003 单网卡 搭建vpn ,windows 2008 R2 类似吧。网上转的,自己加了点经验总结
先说说可能的坑,也就是我自己搭建的时候碰到的问题. 其实搭建起来很简单,我不知道我总结的对还是不对,但是按下面这样操作做绝对能搭好!因为我就是按这样搭起来的,但是我发现,好像pptp已经被墙了,我也不 ...
- Azure ARM (19) 将传统的ASM VM迁移到ARM VM (2)
<Windows Azure Platform 系列文章目录> 因为我们在上一节中: Azure ARM (18) 将传统的ASM VM迁移到ARM VM (1) 已经创建了Azure V ...
- [vt][xen]xenserver初始安装增加第二块硬盘&xen图形界面安装vm&设置xen里vm开机启动
为XenServer挂载/增加第二块硬盘的方法 注意: xen6.x和xen7.x vm导出导入是不兼容的.这点有点蛋疼 新买机器后安装xenserver(一般都买刻录机+dvd来刻录xen官网的io ...
- 烂泥:nagios监控单网卡双IP
本文由秀依林枫提供友情赞助,首发于烂泥行天下. 公司的业务有几台服务器存放在IDC机房中,说是双线路.但是我看到网卡的配置是单网卡双IP的形式.如下: 而公司这边的线路是联通的IP,如下: nagio ...
- Windows Server 2003/2008 单网卡搭建VPN
Windows Server 2003/2008 单网卡搭建VPN 1.打开[控制面板] --> [管理工具] --> [路由和远程访问] 2.鼠标右击你要管理的电脑 在弹出式菜单中选中[ ...
- Windows Server 2003单网卡搭建VPN
Windows Server 2003单网卡搭建VPN 1.打开[控制面板] --> [管理工具] --> [路由和远程访问] 2.鼠标右击你要管理的电脑 在弹出式菜单中选中[配置并启 ...
- LINUX单网卡绑定多个IP
在linux下,我们有时候需要给单网卡设置不同的IP地址,这样就涉及到单网卡绑定多个IP地址的情况.使用本方法可以方便的为单网卡绑定多个IP地址.笔者使用的环境是centos5.6,应该在fedora ...
随机推荐
- Java库中的LocalDate类
Java库中的LocalDate类 类库设计者决定将保存时间与给时间点命名分开.所以标准Java类库分别包含了两个类:一个用来表示时间点的Date类:另一个是用来表示大家熟悉的日历表示法的LocalD ...
- CMake语法—缓存变量(Cache Variable)
目录 CMake语法-缓存变量(Cache Variable) 1 CMake缓存变量 2 定义缓存变量 2.1 定义格式 2.2 定义示例代码 2.3 运行结果 2.4 小结 3 CMakeCach ...
- python-pip使用出现的问题
总结在pip过程中出现的问题 1.pip 安装指定数据源 默认情况下 pip 使用的是国外的镜像,在下载的时候速度非常慢 可以直接在 pip 命令中使用 -i 参数来指定镜像地址 例如:pip ins ...
- python利用正则表达式提取文本中特定内容
正则表达式是一个特殊的字符序列,它能帮助你方便的检查一个字符串是否与某种模式匹配. Python 自1.5版本起增加了re 模块,它提供 Perl 风格的正则表达式模式. re 模块使 Python ...
- docker daemon
docker启动最先加载Docker Daemon. Docker Daemon的启动文件放在/etc/systemd/system/docker.service.d目录中,如果没有则手工创建该目录并 ...
- numpy 矩阵在作为函数参数传递时的奇怪点
numpy 矩阵在作为函数参数传递时的奇怪点 import numpy as np class simpleNet: def __init__(self): self.W = np.array([1, ...
- 常见线程池之 newCacheThreadPool 缓存线程池 简单使用
package com.aaa.threaddemo; import java.util.concurrent.BlockingQueue; import java.util.concurrent.E ...
- Java流程控制02:Scanner进阶
Scanner进阶使用 import java.util.Scanner;public class Demo04 { public static void main(String[] args ...
- Redis 的持久化有哪几种方式?
面试题 redis 的持久化有哪几种方式? 不同的持久化机制都有什么优缺点? 持久化机制具体底层是如何实现的? 面试官心理分析 redis 如果仅仅只是将数据缓存在内存里面,如果 redis 宕机了再 ...
- Tomcat下 session 持久化问题(重启服务器session 仍然存在)
感谢大佬:https://www.iteye.com/blog/xiaolongfeixiang-560800 关于在线人数统计,大都使用SessionListener监听器实现. SessionLi ...