Pike版Openstack虚拟机命令行指定ip地址的示例分析
Pike版Openstack虚拟机命令行指定ip地址的示例分析,针对这个问题,这篇文章详细介绍了相对应的分析和解答,希望可以帮助更多想解决这个问题的小伙伴找到更简单易行的方法。
创新互联专注为客户提供全方位的互联网综合服务,包含不限于成都做网站、网站设计、外贸营销网站建设、郫都网络推广、成都小程序开发、郫都网络营销、郫都企业策划、郫都品牌公关、搜索引擎seo、人物专访、企业宣传片、企业代运营等,从售前售中售后,我们都将竭诚为您服务,您的肯定,是我们最大的嘉奖;创新互联为所有大学生创业者提供郫都建站搭建服务,24小时服务热线:18980820575,官方网址:www.cdcxhl.com
查看已有的网络接口(对应虚拟机网卡)
# . admin-openrc
admin权限查看能够多看到租户id tenant_id
# neutron port-list neutron CLI is deprecated and will be removed in the future. Use openstack CLI instead. +--------------------------------------+------+----------------------------------+-------------------+--------------------------------------------------------------------------------------+ | id | name | tenant_id | mac_address | fixed_ips | +--------------------------------------+------+----------------------------------+-------------------+--------------------------------------------------------------------------------------+ | 00401677-543c-4834-9f30-d25e179e88a0 | | 9c658f84358140378e637f0b27c7ca57 | fa:16:3e:e0:d1:c2 | {"subnet_id": "c26fc89c-44ce-492b-aa88-befe9bae942c", "ip_address": "172.16.40.134"} | | e6480311-3226-49fc-8964-a15237d6ff14 | | 9c658f84358140378e637f0b27c7ca57 | fa:16:3e:67:01:eb | {"subnet_id": "c26fc89c-44ce-492b-aa88-befe9bae942c", "ip_address": "172.16.40.108"} | +--------------------------------------+------+----------------------------------+-------------------+--------------------------------------------------------------------------------------+
普通租户是看不到租户id的
# . tbg-openrc # neutron port-list neutron CLI is deprecated and will be removed in the future. Use openstack CLI instead. +--------------------------------------+------+-------------------+--------------------------------------------------------------------------------------+ | id | name | mac_address | fixed_ips | +--------------------------------------+------+-------------------+--------------------------------------------------------------------------------------+ | 00401677-543c-4834-9f30-d25e179e88a0 | | fa:16:3e:e0:d1:c2 | {"subnet_id": "c26fc89c-44ce-492b-aa88-befe9bae942c", "ip_address": "172.16.40.134"} | | e6480311-3226-49fc-8964-a15237d6ff14 | | fa:16:3e:67:01:eb | {"subnet_id": "c26fc89c-44ce-492b-aa88-befe9bae942c", "ip_address": "172.16.40.108"} | +--------------------------------------+------+-------------------+--------------------------------------------------------------------------------------+
使用admin权限创建一个网络接口,可以指定租户,指定ip地址,以及指定对应的网络
# . admin-openrc # neutron port-create --tenant-id 9c658f84358140378e637f0b27c7ca57 --fixed-ip ip_address='172.16.40.104' provider neutron CLI is deprecated and will be removed in the future. Use openstack CLI instead. Created a new port: +-----------------------+--------------------------------------------------------------------------------------+ | Field | Value | +-----------------------+--------------------------------------------------------------------------------------+ | admin_state_up | True | | allowed_address_pairs | | | binding:host_id | | | binding:profile | {} | | binding:vif_details | {} | | binding:vif_type | unbound | | binding:vnic_type | normal | | created_at | 2018-02-27T07:42:08Z | | description | | | device_id | | | device_owner | | | extra_dhcp_opts | | | fixed_ips | {"subnet_id": "c26fc89c-44ce-492b-aa88-befe9bae942c", "ip_address": "172.16.40.104"} | | id | 5e993bfd-219b-4e0e-9173-721e072e7342 | | mac_address | fa:16:3e:d8:40:0a | | name | | | network_id | c35672ab-6d14-4fd6-99a5-5b912ae1070a | | port_security_enabled | True | | project_id | 9c658f84358140378e637f0b27c7ca57 | | revision_number | 3 | | security_groups | e437d647-4c0e-42c4-bc40-f15d15364748 | | status | DOWN | | tags | | | tenant_id | 9c658f84358140378e637f0b27c7ca57 | | updated_at | 2018-02-27T07:42:08Z | +-----------------------+--------------------------------------------------------------------------------------+
将新创建的port连接到虚拟机上
# nova list +--------------------------------------+------------+---------+------------+-------------+------------------------+ | ID | Name | Status | Task State | Power State | Networks | +--------------------------------------+------------+---------+------------+-------------+------------------------+ | eddcb46e-eac5-4403-83a8-1f0d8ac34439 | hadoop-4 | ACTIVE | - | Running | provider=172.16.40.134 | | 06a43249-9258-409e-b791-541396771a9d | zxq-3 | ACTIVE | - | Running | provider=172.16.40.108 | +--------------------------------------+------------+---------+------------+-------------+------------------------+
添加连接,如果不指定port-id,则会自己创建一个新的
# nova interface-attach --port-id 5e993bfd-219b-4e0e-9173-721e072e7342 eddcb46e-eac5-4403-83a8-1f0d8ac34439 # nova interface-list eddcb46e-eac5-4403-83a8-1f0d8ac34439 +------------+--------------------------------------+--------------------------------------+---------------+-------------------+ | Port State | Port ID | Net ID | IP addresses | MAC Addr | +------------+--------------------------------------+--------------------------------------+---------------+-------------------+ | BUILD | 00401677-543c-4834-9f30-d25e179e88a0 | c35672ab-6d14-4fd6-99a5-5b912ae1070a | 172.16.40.134 | fa:16:3e:e0:d1:c2 | | BUILD | 5e993bfd-219b-4e0e-9173-721e072e7342 | c35672ab-6d14-4fd6-99a5-5b912ae1070a | 172.16.40.104 | fa:16:3e:d8:40:0a | +------------+--------------------------------------+--------------------------------------+---------------+-------------------+
分离接口
# nova interface-detach eddcb46e-eac5-4403-83a8-1f0d8ac34439 00401677-543c-4834-9f30-d25e179e88a0 # ping 172.16.40.104 PING 172.16.40.104 (172.16.40.104) 56(84) bytes of data. 64 bytes from 172.16.40.104: icmp_seq=1 ttl=64 time=3.11 ms
可以ping通,添加指定ip正常。
关于Pike版Openstack虚拟机命令行指定ip地址的示例分析问题的解答就分享到这里了,希望以上内容可以对大家有一定的帮助,如果你还有很多疑惑没有解开,可以关注创新互联行业资讯频道了解更多相关知识。
分享题目:Pike版Openstack虚拟机命令行指定ip地址的示例分析
URL地址:http://azwzsj.com/article/jgiocc.html