zoukankan      html  css  js  c++  java
  • openstack-创建多网络虚机

    在openstack 中怎么创建多网络的虚机? 在虚机创建出来就拥有多网络。 虚机在创建时怎么指定ip 。 

    1. 创建虚机时指定网络,指定IP:

    nova boot --flavor <flavor_id> --image <image_name/image_id> --nic net-id=<netwrok_id>,v4-fixed-ip=<network_ip>   <vm_name>

    eg:

    nova boot --flavor 2 --image 2448645f-33d2-4bc8-b7cc-042f5c5e16f6 --nic net-id=d256042b-edf3-4578-8483-9e619434215f,v4-fixed-ip=199.199.1.123  test_vm_2 

    nova list | grep test_vm_2

    | d5bd6675-11ce-4ba9-b20e-ddd30b271cc3 | test_vm_2             | ACTIVE  | -          | Running     | Lab-Test-net=199.199.1.123 

    2. 创建虚机让虚机拥有多网络

    nova boot --flavor <flavor_id> --image <image_id> --nic net-id=<network_id_1> --nic net-id=<network_id_2>  <vm_name>

    eg:

    创建多网络虚机

    nova boot --flavor 2 --image 2448645f-33d2-4bc8-b7cc-042f5c5e16f6 --nic net-id=d256042b-edf3-4578-8483-9e619434215f --nic net-id=d256042b-edf3-4578-8483-9e619434215f  test-ykvm

    检查

    nova list | grep test-ykvm

    |b63d82cf-0466-430e-a532-596f6c489060 | test-ykvm             | ACTIVE  | -          | Running     | Lab-Test-net=199.199.1.24, 199.199.1.25  

    创建多网络虚机指定创建虚机的ip 

    nova boot --flavor 2 --image 2448645f-33d2-4bc8-b7cc-042f5c5e16f6 --nic net-id=d256042b-edf3-4578-8483-9e619434215f,v4-fixed-ip=199.199.1.100 --nic net-id=d256042b-edf3-4578-8483-9e619434215f,v4-fixed-ip=199.199.1.101   test_vm_3

    检查

    nova list | grep test_vm_3

    | 7b404bb3-6a3e-486d-a581-2c759431c1de | test_vm_3             | ACTIVE  | -          | Running     | Lab-Test-net=199.199.1.100, 199.199.1.101  

    3. nova支持对于active的虚机添加或删除网卡,对应命令如下:

    新建一个port口

    neutron  port-create  <network_id> --name <port_name>

    新建port口指定ip 

     neutron  port-create  <network_id> --name <port_name> --fixed-ip subnet_id=<subnet_id>,ip_address=<network_ip>

    nova 中添加网卡的相关命令 

    interface-attach            Attach a network interface to a server.

    interface-detach            Detach a network interface from a server.

    interface-list              List interfaces attached to a server. 

    用法:

    nova interface-attach [--port-id <port_id>] [--net-id <net_id>]

                                 [--fixed-ip <fixed_ip>]

                                 <server>

    nova interface-detach <server> <port_id>

    eg: 

    新创建一个port 口

    neutron  port-create  d256042b-edf3-4578-8483-9e619434215f --name test-port  

    检查将要给添加网口的虚机

    nova list | grep test_vm_2

    | d5bd6675-11ce-4ba9-b20e-ddd30b271cc3 | test_vm_2             | ACTIVE  | -          | Running     | Lab-Test-net=199.199.1.123            

    给虚机添加网口

    nova interface-attach  --port-id 42867e37-eba0-4c8b-85d9-06b263713f22  test_vm_2

    检查虚机,网络已经添加成功 

    nova list | grep test_vm_2

    | d5bd6675-11ce-4ba9-b20e-ddd30b271cc3 | test_vm_2             | ACTIVE  | -          | Running     | Lab-Test-net=199.199.1.123, 199.199.1.102 

  • 相关阅读:
    HTML基础
    一次由任意文件漏洞开始的渗透测试过程
    谈一谈信息泄露这件事
    浅谈任意文件下载漏洞的利用
    [原创] 一次渗透测试过程--从外网进内网
    一次绕过360+诺顿的提权过程
    漏洞挖掘高级方法
    新型勒索软件Magniber正瞄准韩国、亚太地区开展攻击
    Microsoft Edge 浏览器远程代码执行漏洞POC及细节(CVE-2017-8641)
    Office远程代码执行漏洞CVE-2017-0199复现
  • 原文地址:https://www.cnblogs.com/yk0625/p/14103529.html
Copyright © 2011-2022 走看看