# 建立数据库用户及权限
create database neutron;
grant all privileges on neutron.* to neutron@'localhost' identified by 'Abc@123';
grant all privileges on neutron.* to neutron@'%' identified by 'Abc@123';
flush privileges;
# 建立用户、角色、服务、项目、域、端点
source ~/.openstack_admin
openstack user create --domain default --project service --password Abc@123 neutron
openstack role add --project service --user neutron admin
openstack service create --name neutron --description "OpenStack Networking service" network
openstack endpoint create --region RegionOne network public http://controller:9696
openstack endpoint create --region RegionOne network internal http://controller:9696
openstack endpoint create --region RegionOne network admin http://controller:9696
```bash # 安装程序包 yum install -y openstack-neutron openstack-neutron-ml2 openstack-neutron-linuxbridge ebtables ```
```bash # 变更配置文件 mv /etc/neutron/neutron.conf /etc/neutron/neutron.conf.org
cat > /etc/neutron/neutron.conf << EOF
[DEFAULT]
core_plugin = ml2
service_plugin =
transport_url = rabbit://openstack:Abc@123@controller
auth_strategy = keystone
notify_nova_on_port_status_changes = true
notify_nova_on_port_data_changes = true
[database]
connection = mysql+pymysql://neutron:Abc@123@controller/neutron
[keystone_authtoken]
www_authenticate_uri = http://controller:5000
auth_url = http://controller:5000/v3
memcached_servers = controller:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project _name = service
username = neutron
password = Abc@123
[nova]
auth_url = http://controller:5000/v3
auth_type = password
project_domain_name = default
user_domain_name = default
project _name = service
region_name = RegionOne
username = nova
password = Abc@123
[oslo_concurrency]
lock_path = /var/lib/neutron/tmp
EOF
chmod 640 /etc/neutron/neutron.conf
chown root:neutron /etc/neutron/neutron.conf
mv /etc/neutron/plugins/ml2/ml2_conf.ini /etc/neutron/plugins/ml2/ml2_conf.ini.org
cat > /etc/neutron/plugins/ml2/ml2_conf.ini <<EOF
[DEFAULT]
[ml2]
type_drivers = flat,vlan
tenant_network_types =
mechanism_drivers = linuxbridge
extension_drivers = port_security
[ml2_type_flat]
flat_networks = provider
[securitygroup]
enable_ipet = true
EOF
chmod 640 /etc/neutron/plugins/ml2/ml2_conf.ini
chown root:neutron /etc/neutron/plugins/ml2/ml2_conf.ini
mv /etc/neutron/plugins/ml2/linuxbridge_agent.ini /etc/neutron/plugins/ml2/linuxbridge_agent.ini.org
cat > /etc/neutron/plugins/ml2/linuxbridge_agent.ini <<EOF
[DEFAULT]
[linux_bridge]
physical_interface_mappings = provider:eth1
[vxlan]
enable_vxlan = false
[securitygroup]
enable_security_group = true
firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver
EOF
chmod 640 /etc/neutron/plugins/ml2/linuxbridge_agent.ini
chown root:neutron /etc/neutron/plugins/ml2/linuxbridge_agent.ini
mv /etc/neutron/dhcp_agent.ini /etc/neutron/dhcp_agent.ini.org
cat > /etc/neutron/dhcp_agent.ini <<EOF
[DEFAULT]
interface_driver = linuxbridge
dhcp_driver = neutron.agent.linux.dhcp.Dnsmasq
enable_isolated_metadata = true
EOF
chmod 640 /etc/neutron/dhcp_agent.ini
chown root:neutron /etc/neutron/dhcp_agent.ini
/etc/neutron/metadata_agent.ini
[DEFAULT] 项目部分增加
nova_metadata_host = controller
metadata_proxy_shared_secret = Abc@123
[cache] 项目增加
memcache_servers = controller:11211
/etc/nova/nova.conf
未尾部分增加
[neutron]
url = http://controller:9696
auth_url = http://controller:5000/v3
auth_type = password
project_domain_name = default
user_domain_name = default
project _name = service
region_name = RegionOne
username = neutron
password = Abc@123
service_metadata_proxy = True
metadata_proxy_shared_secret = Abc@123
<br>
```bash
# 同步数据库
ln -s /etc/neutron/plugins/ml2/ml2_conf.ini /etc/neutron/plugin.ini
su -s /bin/bash -c "neutron-db-manage --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugin.ini upgrade head" neutron
```bash # 开启服务 systemctl restart openstack-nova-api && systemctl enable openstack-nova-api systemctl restart neutron-server && systemctl enable neutron-server systemctl restart neutron-linuxbridge-agent && systemctl enable neutron-linuxbridge-agent systemctl restart neutron-dhcp-agent && systemctl enable neutron-dhcp-agent systemctl restart neutron-metadata-agent && systemctl enable neutron-metadata-agent ```
```bash # 验证 openstack network agent list ```
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构
· AI与.NET技术实操系列(六):基于图像分类模型对图像进行分类
2018-11-16 从golang-gin-realworld-example-app项目学写httpapi (二)