• 6.openstack之mitaka搭建网络节点


    部署网络服务

    一:控制节点配置

    1.建库建用户

    mysql -u root -p
    CREATE DATABASE neutron;
    GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'localhost' IDENTIFIED BY 'liuyao';
    GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'%' IDENTIFIED BY 'liuyao';
    flush privileges;
    

    2.keystone相关

    source admin-openrc
    openstack user create --domain default --password-prompt neutron
    
    openstack role add --project service --user neutron admin
     
    openstack service create --name neutron 
      --description "OpenStack Networking" 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
    

    3.安装软件包

    yum install openstack-neutron openstack-neutron-ml2 python-neutronclient which  -y
    

    4.配置服务器组件 =

    vim /etc/neutron/neutron.conf
    [DEFAULT]
    core_plugin = ml2
    service_plugins = router
    #下面配置:启用重叠IP地址功能
    allow_overlapping_ips = True
    rpc_backend = rabbit
    auth_strategy = keystone
    notify_nova_on_port_status_changes = True
    notify_nova_on_port_data_changes = True
    
    [oslo_messaging_rabbit]
    rabbit_host = controller
    rabbit_userid = openstack
    rabbit_password = liuyao
    
    [database]
    connection = mysql+pymysql://neutron:liuyao@controller/neutron
    
    [keystone_authtoken]
    auth_url = http://controller:5000
    memcached_servers = controller:11211
    auth_type = password
    project_domain_name = default
    user_domain_name = default
    project_name = service
    username = neutron
    password = liuyao
    
    [nova]
    auth_url = http://controller:5000
    auth_type = password
    project_domain_name = default
    user_domain_name = default
    region_name = RegionOne
    project_name = service
    username = nova
    password = liuyao
    
    [oslo_concurrency]
    lock_path = /var/lib/neutron/tmp
    
    #修改ml2配置文件
    vim /etc/neutron/plugins/ml2/ml2_conf.ini 
    [ml2]
    type_drivers = flat,vlan,vxlan,gre
    tenant_network_types = vxlan
    mechanism_drivers = openvswitch,l2population
    extension_drivers = port_security
    
    [ml2_type_flat]
    flat_networks = provider
    
    [ml2_type_vxlan]
    vni_ranges = 1:1000
    
    [securitygroup]
    enable_ipset = True
    
    #修改nova配置文件
    vim /etc/nova/nova.conf
    [neutron]
    url = http://controller:9696
    auth_url = http://controller:5000
    auth_type = password
    project_domain_name = default
    user_domain_name = default
    region_name = RegionOne
    project_name = service
    username = neutron
    password = liuyao
    service_metadata_proxy = True
    

    5.创建连接

    ln -s /etc/neutron/plugins/ml2/ml2_conf.ini /etc/neutron/plugin.ini
    

    6.同步数据库:(此处会报一些关于future的问题,自行忽略)

    su -s /bin/sh -c "neutron-db-manage --config-file /etc/neutron/neutron.conf 
     --config-file /etc/neutron/plugins/ml2/ml2_conf.ini upgrade head" neutron
    

    7.重启nova服务

    systemctl restart openstack-nova-api.service
    

    8.启动neutron服务

    systemctl enable neutron-server.service
    systemctl start neutron-server.service
    

    二:网络节点配置

    1.创建eth1

    TYPE=Ethernet
    BOOTPROTO=static
    DEFROUTE=yes
    PEERDNS=yes
    PEERROUTES=yes
    IPV4_FAILURE_FATAL=no
    IPV6INIT=yes
    IPV6_AUTOCONF=yes
    IPV6_DEFROUTE=yes
    IPV6_PEERDNS=yes
    IPV6_PEERROUTES=yes
    IPV6_FAILURE_FATAL=no
    NAME=eth1
    DEVICE=eth1
    ONBOOT=yes
    IPADDR=1.1.1.119
    NETMASK=255.255.255.0
    
    注:二层通讯 不需要网关
    

    2.修改内核参数

    vim /etc/sysctl.conf
    
    net.ipv4.ip_forward=1
    net.ipv4.conf.all.rp_filter=0
    net.ipv4.conf.default.rp_filter=0
    sysctl -p
    

    3.安装软件包

    yum install openstack-neutron openstack-neutron-ml2 openstack-neutron-openvswitch -y
    

    4.配置组件

    vim /etc/neutron/neutron.conf
    [DEFAULT]
    core_plugin = ml2
    service_plugins = router
    allow_overlapping_ips = True
    rpc_backend = rabbit
    auth_strategy = keystone
    
    
    [oslo_messaging_rabbit]
    rabbit_host = controller
    rabbit_userid = openstack
    rabbit_password = liuyao
    
    [oslo_concurrency]
    lock_path = /var/lib/neutron/tmp
    

    5.配置openvswitch_agent

    vim /etc/neutron/plugins/ml2/openvswitch_agent.ini
    [ovs]
    #下面ip为网络节点数据网络ip
    local_ip=1.1.1.119
    bridge_mappings=external:br-ex
    
    [agent]
    tunnel_types=gre,vxlan
    l2_population=True
    prevent_arp_spoofing=True
    

    6.配置L3代理

    vim /etc/neutron/l3_agent.ini
    [DEFAULT]
    interface_driver=neutron.agent.linux.interface.OVSInterfaceDriver
    external_network_bridge=br-ex
    

    7.配置DHCP代理

    vim /etc/neutron/dhcp_agent.ini
    
    [DEFAULT]
    interface_driver=neutron.agent.linux.interface.OVSInterfaceDriver
    dhcp_driver=neutron.agent.linux.dhcp.Dnsmasq
    enable_isolated_metadata=True
    

    8.配置元数据代理

    vim /etc/neutron/metadata_agent.iniW
    [DEFAULT]
    nova_metadata_ip=controller
    metadata_proxy_shared_secret=liuyao
    

    9.启动服务

    网路节点:
    systemctl start neutron-openvswitch-agent.service neutron-l3-agent.service 
    neutron-dhcp-agent.service neutron-metadata-agent.service
    
    systemctl enable neutron-openvswitch-agent.service neutron-l3-agent.service 
    neutron-dhcp-agent.service neutron-metadata-agent.service
    

    10.建网桥

    ovs-vsctl add-br br-ex
    
    
    注意,如果网卡数量有限,想用网路节点的管理网络网卡作为br-ex绑定的物理网卡
    #那么需要将网络节点管理网络网卡ip去掉,建立br-ex的配置文件,ip使用原管理网ip
    
    cat /etc/sysconfig/network-scripts/ifcfg-eth0 
    DEVICE=eth0
    TYPE=Ethernet
    ONBOOT="yes"
    BOOTPROTO="none"
    
    cat /etc/sysconfig/network-scripts/ifcfg-br-ex 
    DEVICE=br-ex
    TYPE=Ethernet
    ONBOOT="yes"
    BOOTPROTO="none"
    HWADDR=bc:ee:7b:78:7b:a7
    IPADDR=192.168.10.104
    GATEWAY=192.168.10.254
    NETMASK=255.255.255.0
    DNS1=202.106.0.20
    DNS1=8.8.8.8
    NM_CONTROLLED=no #注意加上这一句否则网卡可能启动不成功
    
    systemctl restart network
    ovs-vsctl add-port br-ex eth0
    

    三:计算节点配置

    1.修改内核参数

    vim /etc/sysctl.conf
    net.ipv4.conf.all.rp_filter=0
    net.ipv4.conf.default.rp_filter=0
    net.bridge.bridge-nf-call-iptables=1
    net.bridge.bridge-nf-call-ip6tables=1	
    sysctl -p
    

    2.创建eth1

    TYPE=Ethernet
    BOOTPROTO=static
    DEFROUTE=yes
    PEERDNS=yes
    PEERROUTES=yes
    IPV4_FAILURE_FATAL=no
    IPV6INIT=yes
    IPV6_AUTOCONF=yes
    IPV6_DEFROUTE=yes
    IPV6_PEERDNS=yes
    IPV6_PEERROUTES=yes
    IPV6_FAILURE_FATAL=no
    NAME=eth1
    DEVICE=eth1
    ONBOOT=yes
    IPADDR=1.1.1.117
    NETMASK=255.255.255.0
    

    3.安装相关包

    yum install openstack-neutron openstack-neutron-ml2 openstack-neutron-openvswitch -y
    

    4.编辑neutron配置

    vim /etc/neutron/neutron.conf
    
    [DEFAULT]
    rpc_backend = rabbit
    auth_strategy = keystone
    
    
    [oslo_messaging_rabbit]
    rabbit_host = controller
    rabbit_userid = openstack
    rabbit_password = liuyao
    
    [oslo_concurrency]
    lock_path = /var/lib/neutron/tmp
    

    5.编辑openvswitch_agent

    /etc/neutron/plugins/ml2/openvswitch_agent.ini
    
    [ovs]
    #下面ip为计算节点数据网络ip
    local_ip = 1.1.1.117
    #bridge_mappings = vlan:br-vlan
    [agent]
    tunnel_types = gre,vxlan
    l2_population = True
    prevent_arp_spoofing = True
    
    [securitygroup]
    firewall_driver = neutron.agent.linux.iptables_firewall.OVSHybridIptablesFirewallDriver
    enable_security_group = True
    

    7.编辑nova配置

    vim /etc/nova/nova.conf
    
    [neutron]
    url = http://controller:9696
    auth_url = http://controller:5000
    auth_type = password
    project_domain_name = default
    user_domain_name = default
    region_name = RegionOne
    project_name = service
    username = neutron
    password = liuyao
    

    8.启动服务

    systemctl enable neutron-openvswitch-agent.service
    systemctl start neutron-openvswitch-agent.service
    systemctl restart openstack-nova-compute.service
  • 相关阅读:
    Django入门
    Python从入门到放弃
    Python中的元类(metaclass)
    蓝鲸gse启动失败
    VS2019添加微软ReportViewer
    DevExpress WinForms各版本与 .NET、Visual Studio 的版本兼容性
    SQL语句查询每个分组的前N条记录的实现方法
    如何查看Windows安装版本号
    学习webpack
    Python3.x将代码打包成exe程序并添加图标
  • 原文地址:https://www.cnblogs.com/liu-yao/p/5988938.html
Copyright © 2020-2023  润新知