练习题

1

在eNSP中使用S5700交换机进行配置,通过一条命令划分vlan 2、vlan 3、vlan 1004,通过端口组的方式配置端口1-5为access模式,并添加至vlan2中。配置端口10为trunk模式,并放行vlan3。创建三层vlan 2,配置IP地址为:172.16.2.1/24,创建三层vlan1004,配置IP地址为:192.168.4.2/30。通过命令添加默认路由,下一跳为192.168.4.1。(使用完整命令)

 [Huawei]vlan batch 2 3 1004

[Huawei]port-group 1

[Huawei-port-group-1]group-member GigabitEthernet 0/0/1 to GigabitEthernet 0/0/5

[Huawei-port-group-1]port link-type access

[Huawei-port-group-1]port default vlan 2

[Huawei]interface GigabitEthernet 0/0/10

[Huawei-GigabitEthernet0/0/10]port link-type trunk

[Huawei-GigabitEthernet0/0/10]port trunk allow-pass vlan 3

[Huawei]interface Vlanif 2

[Huawei-Vlanif2]ip address 172.16.2.1 24

[Huawei]interface Vlanif 1004

[Huawei-Vlanif1004]ip address 192.168.4.2 30

[Huawei]ip route-static 0.0.0.0 0 192.168.4.1

2

当前有一个centos7.2-1511.iso的镜像文件,使用这个文件配置yum源,要求将这个镜像文件挂载在/opt/centos目录,请问如何配置自己的local.repo文件,使得可以使用该镜像中的软件包,安装软件。

[centos]

name=centos

baseurl=file:///opt/centos

gpgcheck=0

enabled=1

3

登录mysql数据库,使用keystone数据库,查询本地用户表中的所有信息并按照id的降序排序。依次将操作命令和返回结果以文本形式提交到答题框。(数据库用户名root,密码000000;关于数据库的命令均使用小写)

 [root@xiandian ~]# mysql -uroot -p000000

Welcome to the MariaDB monitor.  Commands end with ; or \g.

Your MariaDB connection id is 36787

Server version: 10.1.17-MariaDB MariaDB Server

 

Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.

 

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

 

MariaDB [(none)]> use keystone

Reading table information for completion of table and column names

You can turn off this feature to get a quicker startup with -A

 

Database changed

MariaDB [keystone]> show tables;

+------------------------+

| Tables_in_keystone     |

+------------------------+

| access_token           |

| assignment             |

| config_register        |

| consumer               |

| credential             |

| domain                 |

| endpoint               |

| endpoint_group         |

| federated_user         |

| federation_protocol    |

| group                  |

| id_mapping             |

| identity_provider      |

| idp_remote_ids         |

| implied_role           |

| local_user             |

| mapping                |

| migrate_version        |

| password               |

| policy                 |

| policy_association     |

| project                |

| project_endpoint       |

| project_endpoint_group |

| region                 |

| request_token          |

| revocation_event       |

| role                   |

| sensitive_config       |

| service                |

| service_provider       |

| token                  |

| trust                  |

| trust_role             |

| user                   |

| user_group_membership  |

| whitelisted_config     |

+------------------------+

37 rows in set (0.00 sec)

 

MariaDB [keystone]> select * from local_user order by id desc;

+----+----------------------------------+----------------------------------+-------------------+

| id | user_id                          | domain_id                        | name              |

+----+----------------------------------+----------------------------------+-------------------+

| 13 | 372c371d6c4a4d5aa099376499fa21ef | 3ac89594c8e944a9b5bb567fca4e75aa | aodh              |

| 10 | d46602d109214aea92ec4f9f0e4223e2 | 3ac89594c8e944a9b5bb567fca4e75aa | ceilometer        |

|  9 | 020cce9b69a44aef984fa8aba5135f3f | d457e4c70e884effa73eeaea735f985e | heat_domain_admin |

|  8 | 413c222a0c0d476fa77e3a096f9da216 | 3ac89594c8e944a9b5bb567fca4e75aa | heat              |

|  7 | 97dcfcb9a3b84dd5a47d40c01425e8f5 | 3ac89594c8e944a9b5bb567fca4e75aa | swift             |

|  6 | 95f197fef75a490cbe926350d2688512 | 3ac89594c8e944a9b5bb567fca4e75aa | cinder            |

|  5 | 2c8b1e282f804fc58bc8cdfe7518d80f | 3ac89594c8e944a9b5bb567fca4e75aa | neutron           |

|  4 | a0024f4b405745b999aaa1276844dec6 | 3ac89594c8e944a9b5bb567fca4e75aa | nova              |

|  3 | 46faed53c3534611a83f586d55951246 | 3ac89594c8e944a9b5bb567fca4e75aa | glance            |

|  2 | 73191a8367e4410da4bf764263ade04c | 3ac89594c8e944a9b5bb567fca4e75aa | demo              |

|  1 | 53a1cf0ad2924532aa4b7b0750dec282 | 3ac89594c8e944a9b5bb567fca4e75aa | admin             |

+----+----------------------------------+----------------------------------+-------------------+

11 rows in set (0.00 sec)

4

登录云主机,使用openstack命令,创建名为examtest的容器并查询,上传一个aaa.txt(可自行创建)文件到这个容器中并查询。

 [root@xiandian ~]# openstack container create examtest

+---------------------------------------+-----------+------------------------------------+

| account                               | container | x-trans-id                         |

+---------------------------------------+-----------+------------------------------------+

| AUTH_0ab2dbde4f754b699e22461426cd0774 | examtest  | tx9e7b54f8042d4a6ca5ccf-005a93daf3 |

+---------------------------------------+-----------+------------------------------------+

[root@xiandian ~]# openstack container list

+----------+

| Name     |

+----------+

| examtest |

+----------+

[root@xiandian ~]# openstack object create examtest aaa.txt

+---------+-----------+----------------------------------+

| object  | container | etag                             |

+---------+-----------+----------------------------------+

| aaa.txt | examtest  | 45226aa24b72ce0ccc4ff73eefe2e26f |

+---------+-----------+----------------------------------+

[root@xiandian ~]# openstack object list examtest

+---------+

| Name    |

+---------+

| aaa.txt |

+---------+

 

5

在云主机中,存在一个大小为20G的硬盘为/dev/vdb,使用fdisk命令对该硬盘进形分区,要求分出两个大小为5G的分区。使用这两个分区,创建名为/dev/md0raid级别为1的磁盘阵列。创建完成后使用xfs文件系统进形格式化,并挂载到/mnt目录下。

[root@xiandian ~]# mdadm -D /dev/md0

/dev/md0:

        Version : 1.2

  Creation Time : Wed Oct 23 17:08:07 2019

     Raid Level : raid1

     Array Size : 5238784 (5.00 GiB 5.36 GB)

  Used Dev Size : 5238784 (5.00 GiB 5.36 GB)

   Raid Devices : 2

  Total Devices : 2

    Persistence : Superblock is persistent

 

    Update Time : Wed Oct 23 17:13:37 2019

          State : clean

 Active Devices : 2

Working Devices : 2

 Failed Devices : 0

  Spare Devices : 0

 

           Name : xiandian:0  (local to host xiandian)

           UUID : 71123d35:b354bc98:2e36589d:f0ed3491

         Events : 17

 

    Number   Major   Minor   RaidDevice State

       0     253       17        0      active sync   /dev/vdb1

       1     253       18        1      active sync   /dev/vdb2

[root@xiandian ~]# df -h

Filesystem      Size  Used Avail Use% Mounted on

/dev/vda1        41G  2.4G   39G   6% /

devtmpfs        3.9G     0  3.9G   0% /dev

tmpfs           3.9G  4.0K  3.9G   1% /dev/shm

tmpfs           3.9G   17M  3.9G   1% /run

tmpfs           3.9G     0  3.9G   0% /sys/fs/cgroup

/dev/loop0      2.8G   33M  2.8G   2% /swift/node

tmpfs           799M     0  799M   0% /run/user/0

/dev/md0        5.0G   33M  5.0G   1% /mnt

6

使用crt的传输工具将提供的cirros-0.3.4-x86_64-disk.img镜像上传至“iaas-all”节点的/root目录下;使用glance命令将镜像上传,并命名为mycirros,最后使用glance命令查看该镜像的详细信息。

 [root@xiandian ~]# source /etc/keystone/admin-openrc.sh

[root@xiandian ~]# glance image-create --name mycirros --disk-format qcow2 --container-format bare --progress < cirros-0.3.4-x86_64-disk.img

[=============================>] 100%

+------------------+--------------------------------------+

| Property         | Value                                |

+------------------+--------------------------------------+

| checksum         | ee1eca47dc88f4879d8a229cc70a07c6     |

| container_format | bare                                 |

| created_at       | 2019-10-24T10:16:52Z                 |

| disk_format      | qcow2                                |

| id               | d3663be2-3ebf-443a-b3fc-b3e39bda8783 |

| min_disk         | 0                                    |

| min_ram          | 0                                    |

| name             | mycirros                             |

| owner            | 0ab2dbde4f754b699e22461426cd0774     |

| protected        | False                                |

| size             | 13287936                             |

| status           | active                               |

| tags             | []                                   |

| updated_at       | 2019-10-24T10:16:52Z                 |

| virtual_size     | None                                 |

| visibility       | private                              |

+------------------+--------------------------------------+

[root@xiandian ~]# glance image-show d3663be2-3ebf-443a-b3fc-b3e39bda8783

+------------------+--------------------------------------+

| Property         | Value                                |

+------------------+--------------------------------------+

| checksum         | ee1eca47dc88f4879d8a229cc70a07c6     |

| container_format | bare                                 |

| created_at       | 2019-10-24T10:16:52Z                 |

| disk_format      | qcow2                                |

| id               | d3663be2-3ebf-443a-b3fc-b3e39bda8783 |

| min_disk         | 0                                    |

| min_ram          | 0                                    |

| name             | mycirros                             |

| owner            | 0ab2dbde4f754b699e22461426cd0774     |

| protected        | False                                |

| size             | 13287936                             |

| status           | active                               |

| tags             | []                                   |

| updated_at       | 2019-10-24T10:16:52Z                 |

| virtual_size     | None                                 |

| visibility       | private                              |

+------------------+--------------------------------------+

 

7.nova管理

登录云主机的dashboard界面(用户名:admin;密码:000000)按照要求设置安全组和配置网络。设置完之后,使用nova boot命令,镜像使用mycirros,flavor使用m1.tiny,网络使用自己配置的子网,创建名为xcloud的云主机,最后使用nova命令查询该云主机的详细信息。

[root@xiandian ~]# nova boot --flavor m1.tiny --image mycirros --nic net-id=3d4eccf3-8967-4bc4-8c9c-78191e03f0c6 xcloud

+--------------------------------------+--------------------------------------------------+

| Property                             | Value                                            |

+--------------------------------------+--------------------------------------------------+

| OS-DCF:diskConfig                    | MANUAL                                           |

| OS-EXT-AZ:availability_zone          |                                                  |

| OS-EXT-SRV-ATTR:host                 | -                                                |

| OS-EXT-SRV-ATTR:hostname             | xcloud                                          |

| OS-EXT-SRV-ATTR:hypervisor_hostname  | -                                                |

| OS-EXT-SRV-ATTR:instance_name        | instance-0000011f                                |

| OS-EXT-SRV-ATTR:kernel_id            |                                                  |

| OS-EXT-SRV-ATTR:launch_index         | 0                                                |

| OS-EXT-SRV-ATTR:ramdisk_id           |                                                  |

| OS-EXT-SRV-ATTR:reservation_id       | r-a94xz7zd                                       |

| OS-EXT-SRV-ATTR:root_device_name     | -                                                |

| OS-EXT-SRV-ATTR:user_data            | -                                                |

| OS-EXT-STS:power_state               | 0                                                |

| OS-EXT-STS:task_state                | scheduling                                       |

| OS-EXT-STS:vm_state                  | building                                         |

| OS-SRV-USG:launched_at               | -                                                |

| OS-SRV-USG:terminated_at             | -                                                |

| accessIPv4                           |                                                  |

| accessIPv6                           |                                                  |

| adminPass                            | Rvb8uXiV4aD7                                     |

| config_drive                         |                                                  |

| created                              | 2018-01-17T05:56:32Z                             |

| description                          | -                                                |

| flavor                               | m1.tiny (2)                                     |

| hostId                               |                                                  |

| host_status                          |                                                  |

| id                                   | 707032d1-290f-4e67-b9d6-2d7d762eb45f             |

| image                                | mycirros (ccfcb758-8fe6-4351-977f-098a5081d432) |

| key_name                             | -                                                |

| locked                               | False                                            |

| metadata                             | {}                                               |

| name                                 | xcloud                                          |

| os-extended-volumes:volumes_attached | []                                               |

| progress                             | 0                                                |

| security_groups                      | default                                          |

| status                               | BUILD                                            |

| tenant_id                            | 38e4fd41edaf40189d152dda18935b97                 |

| updated                              | 2018-01-17T05:56:33Z                             |

| user_id                              | 1cec67695fdb49c6adc528fd6803b036                 |

+--------------------------------------+--------------------------------------------------+

 

8

使用提供的软件包和vmware提供的centos7.2操作系统,完成单节点应用系统部署。

 

 

你可能感兴趣的:(练习题)