部署完openstack后的网络配置(一)

本文详细介绍了在部署完成OpenStack后,遇到公共网络默认为VXLAN且无法创建其他类型的网络,导致新建虚拟机无法访问外网的情况。通过编辑配置文件、创建并配置网络桥接等步骤,成功解决了该问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

需求分析: 部署完成后openstack,创建出虚拟机以后发现,不能和外网相通,比如rdo默认装完,public网络默认的public网络是vxlan,并且不能创建别的类型

public网络类型的选择

这里写图片描述

创建自定义public时,让openstack支持所有网络类型

vi  /etc/neutron/plugins/ml2/ml2_conf.ini(编辑此文件)
type_drivers = local,flat,vlan,gre,vxlan

openstack-service restart neutron

新创建的虚拟机不能访问外网

新开的虚拟机不能访问外网,通过以下顺序进行排查

1、查看br-ex

ovs-vsctl show
17ce5502-609e-4024-8ede-96dafcb63fa4
    Bridge br-ex
        Port br-ex
            Interface br-ex
                type: internal
    Bridge br-tun
        fail_mode: secure
        Port patch-int
            Interface patch-int
                type: patch
                options: {peer=patch-tun}
        Port br-tun
            Interface br-tun
                type: internal
    Bridge br-int
        fail_mode: secure
        Port br-int
            Interface br-int
                type: internal
        Port patch-tun
            Interface patch-tun
                type: patch
                options: {peer=patch-int}
    ovs_version: "2.3.1"

2、若没有br-ex,则创建br-ex

  • 配置br-ex文件
cd /etc/sysconfig/network-scripts/
cp -rp ifcfg-eno1 ifcfg-br-ex
cat  > ifcfg-br-ex << OFF
> DEVICE="br-ex"
> ONBOOT=yes
> IPADDR=192.168.11.105
> PREFIX=24
> GATEWAY=192.168.11.1
> OFF
  • 配置float接口
cp -rp ifcfg-eno2 ifcfg-eno2.bak

cat ifcfg-eno1
TYPE=Ethernet
BOOTPROTO=none
NAME=eno2
UUID=fe424bda-50eb-4861-aa6f-d0ebe40250e1
DEVICE=eno2
ONBOOT=yes
  • 创建bridge br-ex
    通过ovs-vsctl show命令查看,若存在就不需要创建了,只需要修改网卡文件
ovs-vsctl add-br br-ex

把bridge和网卡绑定

ovs-vsctl add-port br-ex eno2
service network restart
openstack-service restart neutron

查看

ovs-vsctl show
17ce5502-609e-4024-8ede-96dafcb63fa4
    Bridge br-ex
        Port "eno2"
            Interface "eno2"
        Port br-ex
            Interface br-ex
                type: internal
    Bridge br-int
        fail_mode: secure
        Port br-int
            Interface br-int
                type: internal
        Port patch-tun
            Interface patch-tun
                type: patch
                options: {peer=patch-int}
    Bridge br-tun
        fail_mode: secure
        Port br-tun
            Interface br-tun
                type: internal
        Port patch-int
            Interface patch-int
                type: patch
                options: {peer=patch-tun}
    ovs_version: "2.3.1"



ifconfig

br-ex: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.11.105  netmask 255.255.255.0  broadcast 192.168.11.255
        inet6 fe80::cc5c:b4ff:fe06:ec4c  prefixlen 64  scopeid 0x20<link>
        ether 00:22:19:59:7f:b8  txqueuelen 0  (Ethernet)
        RX packets 267  bytes 24637 (24.0 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 143  bytes 19623 (19.1 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eno1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.10.105  netmask 255.255.255.0  broadcast 192.168.10.255
        inet6 fe80::222:19ff:fe59:7fb6  prefixlen 64  scopeid 0x20<link>
        ether 00:22:19:59:7f:b6  txqueuelen 1000  (Ethernet)
        RX packets 5280  bytes 6470921 (6.1 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 2491  bytes 176145 (172.0 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eno2: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.11.105  netmask 255.255.255.0  broadcast 192.168.11.255
        inet6 fe80::222:19ff:fe59:7fb8  prefixlen 64  scopeid 0x20<link>
        ether 00:22:19:59:7f:b8  txqueuelen 1000  (Ethernet)
        RX packets 296566  bytes 417062174 (397.7 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 178659  bytes 15328783 (14.6 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 0  (Local Loopback)
        RX packets 393058  bytes 46812073 (44.6 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 393058  bytes 46812073 (44.6 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值