[Openstack] [QA] How to attach multiple NICs to an instance VM?

Danny Choi (dannchoi) dannchoi at cisco.com
Wed Oct 15 21:07:09 UTC 2014


Hi,

“nova help boot” shows the following:


  --nic <net-id=net-uuid,v4-fixed-ip=ip-addr,v6-fixed-ip=ip-addr,port-id=port-uuid>

                                Create a NIC on the server. Specify option

                                multiple times to create multiple NICs. net-

                                id: attach NIC to network with this UUID

                                (either port-id or net-id must be provided),

                                v4-fixed-ip: IPv4 fixed address for NIC

                                (optional), v6-fixed-ip: IPv6 fixed address

                                for NIC (optional), port-id: attach NIC to

                                port with this UUID (either port-id or net-id

                                must be provided).


NOTE: >>>>> Specify option multiple times to create multiple NICs. <<<<<


I have two private networks and one public network (for floating IPs) configured.


localadmin at qa4:~/devstack$ nova net-list

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

| ID                                   | Label         | CIDR |

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

| 6905cf7d-74d7-455b-b9d0-8cea972ec522 | private       | None |

| 8c25e33b-47be-47eb-a945-e0ac2ad6756a | Private_net20 | None |

| faa138e6-4774-41ad-8b5f-9795788eca43 | public        | None |

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

When I launch an instance, I specify the “—nic” option twice.


localadmin at qa4:~/devstack$ nova boot --image cirros-0.3.2-x86_64-uec --flavor 1 --nic net-id=6905cf7d-74d7-455b-b9d0-8cea972ec522 --nic net-id=8c25e33b-47be-47eb-a945-e0ac2ad6756a vm10


And then I associate a floating IP to the instance.


localadmin at qa4:~/devstack$ nova list

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

| ID                                   | Name | Status | Task State | Power State | Networks                                                 |

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

| e6a13d2e-756b-4b96-bf0c-438c2c875675 | vm10 | ACTIVE | -          | Running     | Private_net20=20.0.0.10; private=10.0.0.7, 172.29.173.13 |


localadmin at qa4:~/devstack$ nova show vm10

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

| Property                             | Value                                                          |

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

| OS-DCF:diskConfig                    | MANUAL                                                         |

| OS-EXT-AZ:availability_zone          | nova                                                           |

| OS-EXT-STS:power_state               | 1                                                              |

| OS-EXT-STS:task_state                | -                                                              |

| OS-EXT-STS:vm_state                  | active                                                         |

| OS-SRV-USG:launched_at               | 2014-10-15T20:22:50.000000                                     |

| OS-SRV-USG:terminated_at             | -                                                              |

| Private_net20 network                | 20.0.0.10                                                      |

| accessIPv4                           |                                                                |

| accessIPv6                           |                                                                |

| config_drive                         |                                                                |

| created                              | 2014-10-15T20:21:54Z                                           |

| flavor                               | m1.tiny (1)                                                    |

| hostId                               | 4660a679d319992f764bcb245b71048212fe8cd67b769400d82382b7       |

| id                                   | e6a13d2e-756b-4b96-bf0c-438c2c875675                           |

| image                                | cirros-0.3.2-x86_64-uec (feaec710-c1cc-4071-aefa-c3dc2b915ab1) |

| key_name                             | -                                                              |

| metadata                             | {}                                                             |

| name                                 | vm10                                                           |

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

| private network                      | 10.0.0.7, 172.29.173.13                                        |

| progress                             | 0                                                              |

| security_groups                      | default                                                        |

| status                               | ACTIVE                                                         |

| tenant_id                            | a9dea87cd1114f61996c10456a17604f                               |

| updated                              | 2014-10-15T20:22:03Z                                           |

| user_id                              | bc353f0fc8b44c0883a220898c6c8262                               |

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

It looks like both private network addresses are attached to the instance.

However, ssh to the instance via the floating IP, its configuration shows only the 10 net address is configured.


DANNCHOI-M-G07T:~ dannychoi$ ssh -l cirros 172.29.173.13

The authenticity of host '172.29.173.13 (172.29.173.13)' can't be established.

RSA key fingerprint is a5:e1:ef:f5:5e:a6:af:06:de:1b:f6:23:0a:5a:48:91.

Are you sure you want to continue connecting (yes/no)? yes

Warning: Permanently added '172.29.173.13' (RSA) to the list of known hosts.

cirros at 172.29.173.13's password:

$ ifconfig -a

eth0      Link encap:Ethernet  HWaddr FA:16:3E:7A:49:1E

          inet addr:10.0.0.7  Bcast:10.0.0.255  Mask:255.255.255.0

          inet6 addr: fe80::f816:3eff:fe7a:491e/64 Scope:Link

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:87 errors:0 dropped:0 overruns:0 frame:0

          TX packets:52 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000

          RX bytes:10509 (10.2 KiB)  TX bytes:6194 (6.0 KiB)


eth1      Link encap:Ethernet  HWaddr FA:16:3E:73:C7:F0

          BROADCAST MULTICAST  MTU:1500  Metric:1

          RX packets:0 errors:0 dropped:0 overruns:0 frame:0

          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000

          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)


lo        Link encap:Local Loopback

          inet addr:127.0.0.1  Mask:255.0.0.0

          inet6 addr: ::1/128 Scope:Host

          UP LOOPBACK RUNNING  MTU:16436  Metric:1

          RX packets:0 errors:0 dropped:0 overruns:0 frame:0

          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0

          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)


$ ping 20.0.0.10

PING 20.0.0.10 (20.0.0.10): 56 data bytes

^C

--- 20.0.0.10 ping statistics ---

9 packets transmitted, 0 packets received, 100% packet loss   <<<<<[FAILURE]

$ ping 10.0.0.7

PING 10.0.0.7 (10.0.0.7): 56 data bytes

64 bytes from 10.0.0.7: seq=0 ttl=64 time=0.164 ms

64 bytes from 10.0.0.7: seq=1 ttl=64 time=0.041 ms

^C

--- 10.0.0.7 ping statistics ---

2 packets transmitted, 2 packets received, 0% packet loss

round-trip min/avg/max = 0.041/0.102/0.164 ms

$


Is this the correct way to attach multiple NICs to an instance?

Thanks,
Danny

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack/attachments/20141015/a7d37f46/attachment.html>


More information about the Openstack mailing list