2. OpenStack-Ocata 服务器网络配置

完成各个节点操作系统安装以后,你必须配置网络接口。我们推荐你禁用自动网络管理工具并手动编辑你相应版本的配置文件。

控制节点服务器

安装基本工具

yum install -y vim net-tools tree lrzsz bash-completion wget

图片[1]-2. OpenStack-Ocata 服务器网络配置-剧毒之触博客

图片[2]-2. OpenStack-Ocata 服务器网络配置-剧毒之触博客

配置网络接口

编辑网卡配置/etc/sysconfig/network-scripts/ifcfg-ens33文件

vim /etc/sysconfig/network-scripts/ifcfg-ens33
TYPE="Ethernet"
PROXY_METHOD="none"
BROWSER_ONLY="no"
BOOTPROTO="static"
DEFROUTE="yes"
IPV4_FAILURE_FATAL="no"
IPV6INIT="yes"
IPV6_AUTOCONF="yes"
IPV6_DEFROUTE="yes"
IPV6_FAILURE_FATAL="no"
IPV6_ADDR_GEN_MODE="stable-privacy"
NAME="ens33"
UUID="86fb4d7c-a361-4f6a-b082-15e7fecf0107"
DEVICE="ens33"
ONBOOT="yes"
IPADDR="控制节点IP地址"
NETMASK="255.255.255.0"
GATEWAY="网关地址"
DNS1="114.114.114.114"

图片[3]-2. OpenStack-Ocata 服务器网络配置-剧毒之触博客

重启网络服务

systemctl restart network

配置名称解析

设置节点主机名为 controller

hostnamectl set-hostname controller
hostname

图片[4]-2. OpenStack-Ocata 服务器网络配置-剧毒之触博客

编辑/etc/hosts文件

vim /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
# controller
控制节点IP地址         controller

# compute1
计算节点IP         compute1

# block1
块存储IP         block1

# object1
#192.168.145.136         object1

# object2
#192.168.145.137         object2

计算节点服务器

安装基本工具

yum install -y vim net-tools tree lrzsz bash-completion wget

图片[1]-2. OpenStack-Ocata 服务器网络配置-剧毒之触博客

图片[2]-2. OpenStack-Ocata 服务器网络配置-剧毒之触博客

配置网络接口

编辑网卡配置/etc/sysconfig/network-scripts/ifcfg-ens33文件

vim /etc/sysconfig/network-scripts/ifcfg-ens33
TYPE="Ethernet"
PROXY_METHOD="none"
BROWSER_ONLY="no"
BOOTPROTO="static"
DEFROUTE="yes"
IPV4_FAILURE_FATAL="no"
IPV6INIT="yes"
IPV6_AUTOCONF="yes"
IPV6_DEFROUTE="yes"
IPV6_FAILURE_FATAL="no"
IPV6_ADDR_GEN_MODE="stable-privacy"
NAME="ens33"
#UUID="86fb4d7c-a361-4f6a-b082-15e7fecf0107"
DEVICE="ens33"
ONBOOT="yes"
IPADDR="计算节点IP"
NETMASK="255.255.255.0"
GATEWAY="网关地址"
DNS1="114.114.114.114"

配置名称解析

设置节点主机名为 compute1

hostnamectl set-hostname compute1
hostname

图片[7]-2. OpenStack-Ocata 服务器网络配置-剧毒之触博客

编辑/etc/hosts文件

vim /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
# controller
控制节点IP地址         controller

# compute1
计算节点IP         compute1

# block1
块存储IP         block1

# object1
#192.168.145.136         object1

# object2
#192.168.145.137         object2

验证连通性

建议您在继续进行之前,验证到 Internet 和各个节点之间的连通性。

  1. controller节点,测试能否连接到 Internet:

    [root@controller ~]# ping -c 4 baidu.com
    PING baidu.com (220.181.38.148) 56(84) bytes of data.
    64 bytes from 220.181.38.148 (220.181.38.148): icmp_seq=1 ttl=128 time=30.1 ms
    64 bytes from 220.181.38.148 (220.181.38.148): icmp_seq=2 ttl=128 time=31.5 ms
    64 bytes from 220.181.38.148 (220.181.38.148): icmp_seq=3 ttl=128 time=45.6 ms
    64 bytes from 220.181.38.148 (220.181.38.148): icmp_seq=4 ttl=128 time=31.3 ms
    
    --- baidu.com ping statistics ---
    4 packets transmitted, 4 received, 0% packet loss, time 3007ms
    rtt min/avg/max/mdev = 30.127/34.671/45.644/6.361 ms
  2. controller 节点,测试到compute 节点管理网络是否连通:

    [root@controller ~]# ping -c 4 compute1
    PING compute1 (计算节点IP) 56(84) bytes of data.
    64 bytes from compute1 (计算节点IP): icmp_seq=1 ttl=64 time=0.350 ms
    64 bytes from compute1 (计算节点IP): icmp_seq=2 ttl=64 time=0.443 ms
    64 bytes from compute1 (计算节点IP): icmp_seq=3 ttl=64 time=1.00 ms
    64 bytes from compute1 (计算节点IP): icmp_seq=4 ttl=64 time=0.989 ms
    
    --- compute1 ping statistics ---
    4 packets transmitted, 4 received, 0% packet loss, time 3002ms
    rtt min/avg/max/mdev = 0.350/0.696/1.003/0.302 ms
  3. compute 节点,测试能否连接到 Internet:

    [root@compute1 ~]# ping -c 4 baidu.com
    PING baidu.com (220.181.38.148) 56(84) bytes of data.
    64 bytes from 220.181.38.148 (220.181.38.148): icmp_seq=1 ttl=128 time=35.4 ms
    64 bytes from 220.181.38.148 (220.181.38.148): icmp_seq=2 ttl=128 time=39.1 ms
    64 bytes from 220.181.38.148 (220.181.38.148): icmp_seq=3 ttl=128 time=42.4 ms
    64 bytes from 220.181.38.148 (220.181.38.148): icmp_seq=4 ttl=128 time=36.5 ms
    
    --- baidu.com ping statistics ---
    4 packets transmitted, 4 received, 0% packet loss, time 3005ms
    rtt min/avg/max/mdev = 35.404/38.369/42.433/2.714 ms
  4. compute 节点,测试到controller 节点管理网络是否连通:

[root@compute1 ~]# ping -c 4 controller
PING controller (控制节点IP地址) 56(84) bytes of data.
64 bytes from controller (控制节点IP地址): icmp_seq=1 ttl=64 time=0.215 ms
64 bytes from controller (控制节点IP地址): icmp_seq=2 ttl=64 time=0.352 ms
64 bytes from controller (控制节点IP地址): icmp_seq=3 ttl=64 time=0.400 ms
64 bytes from controller (控制节点IP地址): icmp_seq=4 ttl=64 time=0.207 ms

--- controller ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3002ms
rtt min/avg/max/mdev = 0.207/0.293/0.400/0.086 ms

关闭防火墙

SELinux

vi /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of three values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected. 
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted 

图片[8]-2. OpenStack-Ocata 服务器网络配置-剧毒之触博客

setenforce 0
//注释:
//命令临时生效:
//setenforce 0 (临时生效可以直接用setenforce 0 )
//      1 启用
//      0 告警,不启用

防火墙FireWalld

查看防火墙的状态:

systemctl status firewalld.service

//默认是启动的

我们关闭它

systemctl stop firewalld; systemctl disable firewalld

之后我们继续查看状态

systemctl status firewalld.service

图片[9]-2. OpenStack-Ocata 服务器网络配置-剧毒之触博客

已经关闭了!

© 版权声明
THE END
喜欢就支持一下吧
点赞7 分享
评论 抢沙发

请登录后发表评论