[openstack-dev] [Network] Allocate MAC and IP address for a VM instance
Jay Lau
jay.lau.513 at gmail.com
Wed Feb 19 00:37:13 UTC 2014
Also thanks Tim and Amir for the input here.
Just one more question and hope can also get some help from you ;-)
I have tried that we can create VM with MAC and FIXED IP bind together,
what about floating IP? Is it possible that I also bind MAC and FLOATING IP
for a VM?
===============MAC and FIXED IP BIND===============
[root at db01b05 ~(keystone_admin)]# neutron net-list
+--------------------------------------+----------+---------------------------------------------------+
| id | name |
subnets |
+--------------------------------------+----------+---------------------------------------------------+
| 489e5aac-aedb-4d94-b908-fc8079dee25c | Int |
f307d9fd-2444-4ad0-b21a-9f490b182cbb 10.0.0.0/24 |
| 9b758062-2be8-4244-a5a9-3f878f74e006 | Ex |
b76e9845-8ee1-4794-ae81-4514ce18b428 9.21.52.0/24 |
| fb1a75f9-e468-408b-a172-5d2b3802d862 | IntAdmin |
0fff20f4-142a-4e89-add1-5c5a79c6d54d 10.0.1.0/24 |
+--------------------------------------+----------+---------------------------------------------------+
[root at db01b05 ~(keystone_admin)]# neutron subnet-list
+--------------------------------------+-------------+--------------+----------------------------------------------+
| id | name | cidr |
allocation_pools |
+--------------------------------------+-------------+--------------+----------------------------------------------+
| 0fff20f4-142a-4e89-add1-5c5a79c6d54d | SubIntAdmin | 10.0.1.0/24 |
{"start": "10.0.1.2", "end": "10.0.1.254"} |
| b76e9845-8ee1-4794-ae81-4514ce18b428 | SubEx | 9.21.52.0/24 |
{"start": "9.21.52.20", "end": "9.21.52.30"} |
| f307d9fd-2444-4ad0-b21a-9f490b182cbb | SubInt | 10.0.0.0/24 |
{"start": "10.0.0.3", "end": "10.0.0.254"} |
| | | |
{"start": "10.0.0.1", "end": "10.0.0.1"} |
+--------------------------------------+-------------+--------------+----------------------------------------------+
[root at db01b05 ~(keystone_admin)]# neutron port-create IntAdmin
--mac-address fa:16:3e:9d:e9:11 --fixed-ip ip_address=10.0.1.2
Created a new port:
+-----------------------+---------------------------------------------------------------------------------+
| Field |
Value
|
+-----------------------+---------------------------------------------------------------------------------+
| admin_state_up |
True
|
| allowed_address_pairs
|
|
| binding:capabilities | {"port_filter":
true} |
| binding:host_id
|
|
| binding:vif_type |
ovs
|
| device_id
|
|
| device_owner
|
|
| fixed_ips | {"subnet_id":
"0fff20f4-142a-4e89-add1-5c5a79c6d54d", "ip_address": "10.0.1.2"} |
| id |
75a4eca1-1edf-415e-9bce-34a228145110
|
| mac_address |
fa:16:3e:9d:e9:11
|
| name
|
|
| network_id |
fb1a75f9-e468-408b-a172-5d2b3802d862
|
| security_groups |
aa3f3025-ba71-476d-a126-25a9e3b34c9a
|
| status |
DOWN
|
| tenant_id |
f181a9c2b1b4443dbd91b1b7de716185
|
+-----------------------+---------------------------------------------------------------------------------+
[root at db01b05 ~(keystone_admin)]# neutron port-list | grep 10.0.1.2
| 75a4eca1-1edf-415e-9bce-34a228145110 | | fa:16:3e:9d:e9:11 |
{"subnet_id": "0fff20f4-142a-4e89-add1-5c5a79c6d54d", "ip_address":
"10.0.1.2"} |
[root at db01b05 ~(keystone_admin)]# nova boot --image
centos64-x86_64-cfntools --flavor 2 --key-name adminkey --nic
port-id=75a4eca1-1edf-415e-9bce-34a228145110 vm0001
+--------------------------------------+--------------------------------------+
| Property |
Value |
+--------------------------------------+--------------------------------------+
| OS-EXT-STS:task_state |
scheduling |
| image |
centos64-x86_64-cfntools |
| OS-EXT-STS:vm_state |
building |
| OS-EXT-SRV-ATTR:instance_name |
instance-00000023 |
| OS-SRV-USG:launched_at |
None |
| flavor |
m1.small |
| id |
9af14d06-6fa8-4757-8eb7-118ea01d3fdb |
| security_groups | [{u'name':
u'default'}] |
| user_id |
345dd87da2364fa78ffe97ed349bb71b |
| OS-DCF:diskConfig |
MANUAL |
| accessIPv4
| |
| accessIPv6
| |
| progress |
0 |
| OS-EXT-STS:power_state |
0 |
| OS-EXT-AZ:availability_zone |
nova |
| config_drive
| |
| status |
BUILD |
| updated |
2014-02-19T00:07:20Z |
| hostId
| |
| OS-EXT-SRV-ATTR:host |
None |
| OS-SRV-USG:terminated_at |
None |
| key_name |
adminkey |
| OS-EXT-SRV-ATTR:hypervisor_hostname |
None |
| name |
vm0001 |
| adminPass |
6zHF9aXBHs5t |
| tenant_id |
f181a9c2b1b4443dbd91b1b7de716185 |
| created |
2014-02-19T00:07:20Z |
| os-extended-volumes:volumes_attached |
[] |
| metadata |
{} |
+--------------------------------------+--------------------------------------+
Thanks,
Jay
2014-02-19 8:11 GMT+08:00 Jay Lau <jay.lau.513 at gmail.com>:
> Thanks Dong for the great help, it does worked with command line!
>
> This seems not available via dashboard, right?
>
> Thanks,
>
> Jay
>
>
>
> 2014-02-19 1:11 GMT+08:00 Dong Liu <willowd878 at gmail.com>:
>
> Hi Jay,
>>
>> In neutron API, you could create port with specified mac_address and
>> fix_ip, and then create vm with this port.
>> But the mapping of them need to manage by yourself.
>>
>>
>> 在 2014年2月18日,22:41,Jay Lau <jay.lau.513 at gmail.com> 写道:
>>
>> > Greetings,
>> >
>> > Not sure if it is suitable to ask this question in openstack-dev list.
>> Here come a question related to network and want to get some input or
>> comments from you experts.
>> >
>> > My case is as this: For some security issue, I want to put both MAC and
>> internal IP address to a pool and when create VM, I can get MAC and its
>> mapped IP address and assign the MAC and IP address to the VM.
>> >
>> > For example, suppose I have following MAC and IP pool:
>> > 1) 78:2b:cb:af:78:b0, 192.168.0.10
>> > 2) 78:2b:cb:af:78:b1, 192.168.0.11
>> > 3) 78:2b:cb:af:78:b2, 192.168.0.12
>> > 4) 78:2b:cb:af:78:b3, 192.168.0.13
>> >
>> > Then I can create four VMs using above MAC and IP address, each row in
>> above can be mapped to a VM.
>> >
>> > Does any of you have any idea for the solution of this?
>> >
>> > --
>> > Thanks,
>> >
>> > Jay
>> > _______________________________________________
>> > OpenStack-dev mailing list
>> > OpenStack-dev at lists.openstack.org
>> > http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>>
>>
>> _______________________________________________
>> OpenStack-dev mailing list
>> OpenStack-dev at lists.openstack.org
>> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>>
>
>
>
> --
> Thanks,
>
> Jay
>
--
Thanks,
Jay
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20140219/d0ede12c/attachment-0001.html>
More information about the OpenStack-dev
mailing list