instance和network的连接关系:
在neutron数据库中,ports存储了instance和端口的关系,其中device_id表示了instance的id,在nova数据库中的instances表能够查到相应的instance,还有网卡信息,如果一个机器有多个网卡,还能用mac_address信息的做key。
在ipallocations表中存储了port和网络的对应关系及分配的ip信息
在floatingips表中存储了floating ip 分配的信息
MariaDB [neutron]> select * from ports;
+----------------------------------+--------------------------------------+------+--------------------------------------+-------------------+----------------+--------+-------------------------------------------------------------------------------+--------------------------+
| tenant_id | id | name | network_id | mac_address | admin_state_up | status | device_id | device_owner |
+----------------------------------+--------------------------------------+------+--------------------------------------+-------------------+----------------+--------+-------------------------------------------------------------------------------+--------------------------+
| de8f43bfe4244a1aa315a70a43248d60 | 08f40e39-b5a2-4dd2-b385-a397966eabd3 | | 6d1096a0-8b22-4607-b392-137ae0072106 | fa:16:3e:e8:fb:db | 1 | ACTIVE | 86baaddc-3c3e-4687-87bc-2e22f53eb7ba | compute:nova |
| d67be6b4d9734ec0a3de1ae7c250db02 | 1697f536-6fb3-4a17-a379-6d5e640f661e | | e89e1697-ca8a-42e9-9cc1-5b0a6d24b307 | fa:16:3e:04:e6:bb | 1 | ACTIVE | e61af3e6-5d31-44aa-989f-bc4146dde42a | network:router_interface |
| | 1d0c2bbf-1513-4dec-8ec3-40803daec518 | | c7af4bc4-a160-4a42-992a-cdfbd3dd707c | fa:16:3e:69:85:45 | 1 | N/A | dee22b07-440c-4752-bad7-ff5ba96d8973 | network:floatingip |
| d67be6b4d9734ec0a3de1ae7c250db02 | 20f1af00-df84-4264-b0fe-21b032dc5cd5 | | e89e1697-ca8a-42e9-9cc1-5b0a6d24b307 | fa:16:3e:be:10:10 | 1 | ACTIVE | reserved_dhcp_port | network:dhcp |
| 30ede715c60246069a1e1655d2746d6e | 2bfea5a2-fba6-450d-b2bc-6a6bc1c1580a | | 5afc8548-9d50-464d-a127-4c287657d332 | fa:16:3e:a1:c0:83 | 1 | ACTIVE | reserved_dhcp_port | network:dhcp |
| 41e63787b9a64db29a0a3845a2490aa5 | 3d2b1863-3654-40f6-8a80-05f9c895f566 | | 91bc583e-bd73-49ac-b3bf-6ec0f9416e7f | fa:16:3e:be:44:3c | 1 | ACTIVE | 834877ad-ca0f-4462-bc97-2657699e61c4 | network:router_interface |
| 761f503edd7541e6840138d91ffd3254 | 524116b4-29ed-41b9-ac66-a833e22a9b3c | | a441887d-77e8-42cb-9612-02afb4dbf500 | fa:16:3e:bf:58:1f | 1 | ACTIVE | dhcp7b60c1d9-602e-5110-8c89-a9475b89732c-a441887d-77e8-42cb-9612-02afb4dbf500 | network:dhcp |
| de8f43bfe4244a1aa315a70a43248d60 | 6268e0a4-dbaf-4e77-ac64-357d2e64b3af | | 6d1096a0-8b22-4607-b392-137ae0072106 | fa:16:3e:6b:23:2d | 1 | ACTIVE | reserved_dhcp_port | network:dhcp |
| | 6c57b5d5-6e96-47c9-afd4-56b189504566 | | c7af4bc4-a160-4a42-992a-cdfbd3dd707c | fa:16:3e:06:e2:92 | 1 | ACTIVE | 3d8bf067-a4d3-44f8-84d6-f687231af340 | network:router_gateway |
| | 76690f67-6cb8-4727-946e-28108fb4ac04 | | c7af4bc4-a160-4a42-992a-cdfbd3dd707c | fa:16:3e:a2:8d:d3 | 1 | ACTIVE | c66be488-ee93-4fed-b7e7-d0fb3a3b15b8 | network:router_gateway |
| de8f43bfe4244a1aa315a70a43248d60 | 7ee5d14d-9557-48e7-abbf-1195cefc47bd | | 6d1096a0-8b22-4607-b392-137ae0072106 | fa:16:3e:15:4a:b4 | 1 | ACTIVE | 39b71578-bcc1-4107-9402-156ee46ac219 | compute:nova |
| de8f43bfe4244a1aa315a70a43248d60 | 8ae777f1-a00f-420c-bcf3-73f7373c2637 | | 6d1096a0-8b22-4607-b392-137ae0072106 | fa:16:3e:4d:4c:22 | 1 | ACTIVE | 8fd34c9e-323b-40b0-8d8a-3976fd115074 | network:router_interface |
| | 99aeb320-b17d-4acd-8377-510b35aa45b8 | | c7af4bc4-a160-4a42-992a-cdfbd3dd707c | fa:16:3e:71:66:c3 | 1 | ACTIVE | e61af3e6-5d31-44aa-989f-bc4146dde42a | network:router_gateway |
| 761f503edd7541e6840138d91ffd3254 | a3873458-f30b-413d-9cc8-6bfef04c11e8 | | a441887d-77e8-42cb-9612-02afb4dbf500 | fa:16:3e:82:33:96 | 1 | ACTIVE | 3d8bf067-a4d3-44f8-84d6-f687231af340 | network:router_interface |
| | daac2675-9b43-4ed0-abad-e4fb2c4f0b78 | | c7af4bc4-a160-4a42-992a-cdfbd3dd707c | fa:16:3e:56:1a:a0 | 1 | ACTIVE | 8fd34c9e-323b-40b0-8d8a-3976fd115074 | network:router_gateway |
| 761f503edd7541e6840138d91ffd3254 | dafd73c2-eed1-45c0-a098-f62b09d34a09 | | a441887d-77e8-42cb-9612-02afb4dbf500 | fa:16:3e:24:dc:ea | 1 | ACTIVE | 78645fed-1376-4998-acd2-0e5d59507c59 | compute:None |
| 41e63787b9a64db29a0a3845a2490aa5 | db292066-4339-4fe5-bbf5-cc09d82a1b9e | | 91bc583e-bd73-49ac-b3bf-6ec0f9416e7f | fa:16:3e:35:0f:38 | 1 | ACTIVE | reserved_dhcp_port | network:dhcp |
| 30ede715c60246069a1e1655d2746d6e | f076a973-d245-4ce5-8d89-6d4e4caecc43 | | 5afc8548-9d50-464d-a127-4c287657d332 | fa:16:3e:56:c2:e8 | 1 | ACTIVE | c66be488-ee93-4fed-b7e7-d0fb3a3b15b8 | network:router_interface |
| | f74a22ce-ffef-484e-880a-562be539d1f1 | | c7af4bc4-a160-4a42-992a-cdfbd3dd707c | fa:16:3e:01:80:b6 | 1 | ACTIVE | 834877ad-ca0f-4462-bc97-2657699e61c4 | network:router_gateway |
+----------------------------------+--------------------------------------+------+--------------------------------------+-------------------+----------------+--------+-------------------------------------------------------------------------------+--------------------------+
19 rows in set (0.00 sec)
MariaDB [neutron]> select * from networks;
+----------------------------------+--------------------------------------+-----------------+--------+----------------+--------+------+------------------+
| tenant_id | id | name | status | admin_state_up | shared | mtu | vlan_transparent |
+----------------------------------+--------------------------------------+-----------------+--------+----------------+--------+------+------------------+
| 30ede715c60246069a1e1655d2746d6e | 5afc8548-9d50-464d-a127-4c287657d332 | default_network | ACTIVE | 1 | 0 | 0 | NULL |
| de8f43bfe4244a1aa315a70a43248d60 | 6d1096a0-8b22-4607-b392-137ae0072106 | int | ACTIVE | 1 | 0 | 0 | NULL |
| 41e63787b9a64db29a0a3845a2490aa5 | 91bc583e-bd73-49ac-b3bf-6ec0f9416e7f | default_network | ACTIVE | 1 | 0 | 0 | NULL |
| 761f503edd7541e6840138d91ffd3254 | a441887d-77e8-42cb-9612-02afb4dbf500 | default_network | ACTIVE | 1 | 0 | 0 | NULL |
| de8f43bfe4244a1aa315a70a43248d60 | c7af4bc4-a160-4a42-992a-cdfbd3dd707c | ext | ACTIVE | 1 | 1 | 0 | NULL |
| d67be6b4d9734ec0a3de1ae7c250db02 | e89e1697-ca8a-42e9-9cc1-5b0a6d24b307 | default_network | ACTIVE | 1 | 0 | 0 | NULL |
+----------------------------------+--------------------------------------+-----------------+--------+----------------+--------+------+------------------+
6 rows in set (0.00 sec)
MariaDB [neutron]> select * from ipallocations ;
+--------------------------------------+---------------+--------------------------------------+--------------------------------------+
| port_id | ip_address | subnet_id | network_id |
+--------------------------------------+---------------+--------------------------------------+--------------------------------------+
| 08f40e39-b5a2-4dd2-b385-a397966eabd3 | 192.168.1.12 | dbef5acb-df7a-4f25-b181-0f1c582761cb | 6d1096a0-8b22-4607-b392-137ae0072106 |
| 1697f536-6fb3-4a17-a379-6d5e640f661e | 172.18.0.1 | 2de3d1b4-4b8b-4b6f-9556-118da5efd01d | e89e1697-ca8a-42e9-9cc1-5b0a6d24b307 |
| 1d0c2bbf-1513-4dec-8ec3-40803daec518 | 9.111.222.246 | 3ce0480c-8548-449d-99b4-b9a3bb978a64 | c7af4bc4-a160-4a42-992a-cdfbd3dd707c |
| 20f1af00-df84-4264-b0fe-21b032dc5cd5 | 172.18.0.2 | 2de3d1b4-4b8b-4b6f-9556-118da5efd01d | e89e1697-ca8a-42e9-9cc1-5b0a6d24b307 |
| 2bfea5a2-fba6-450d-b2bc-6a6bc1c1580a | 172.17.0.2 | 9cda92af-bd52-408f-9a53-c2764d9ba44f | 5afc8548-9d50-464d-a127-4c287657d332 |
| 3d2b1863-3654-40f6-8a80-05f9c895f566 | 172.19.0.1 | e2b98f15-b066-4481-8245-54d587c4fe0c | 91bc583e-bd73-49ac-b3bf-6ec0f9416e7f |
| 524116b4-29ed-41b9-ac66-a833e22a9b3c | 172.20.0.2 | 3d997f37-ef63-4612-aa7e-6ca03a2ad33a | a441887d-77e8-42cb-9612-02afb4dbf500 |
| 6268e0a4-dbaf-4e77-ac64-357d2e64b3af | 192.168.1.11 | dbef5acb-df7a-4f25-b181-0f1c582761cb | 6d1096a0-8b22-4607-b392-137ae0072106 |
| 6c57b5d5-6e96-47c9-afd4-56b189504566 | 9.111.222.244 | 3ce0480c-8548-449d-99b4-b9a3bb978a64 | c7af4bc4-a160-4a42-992a-cdfbd3dd707c |
| 76690f67-6cb8-4727-946e-28108fb4ac04 | 9.111.222.241 | 3ce0480c-8548-449d-99b4-b9a3bb978a64 | c7af4bc4-a160-4a42-992a-cdfbd3dd707c |
| 7ee5d14d-9557-48e7-abbf-1195cefc47bd | 192.168.1.15 | dbef5acb-df7a-4f25-b181-0f1c582761cb | 6d1096a0-8b22-4607-b392-137ae0072106 |
| 8ae777f1-a00f-420c-bcf3-73f7373c2637 | 192.168.1.1 | dbef5acb-df7a-4f25-b181-0f1c582761cb | 6d1096a0-8b22-4607-b392-137ae0072106 |
| 99aeb320-b17d-4acd-8377-510b35aa45b8 | 9.111.222.242 | 3ce0480c-8548-449d-99b4-b9a3bb978a64 | c7af4bc4-a160-4a42-992a-cdfbd3dd707c |
| a3873458-f30b-413d-9cc8-6bfef04c11e8 | 172.20.0.1 | 3d997f37-ef63-4612-aa7e-6ca03a2ad33a | a441887d-77e8-42cb-9612-02afb4dbf500 |
| daac2675-9b43-4ed0-abad-e4fb2c4f0b78 | 9.111.222.245 | 3ce0480c-8548-449d-99b4-b9a3bb978a64 | c7af4bc4-a160-4a42-992a-cdfbd3dd707c |
| dafd73c2-eed1-45c0-a098-f62b09d34a09 | 172.20.0.7 | 3d997f37-ef63-4612-aa7e-6ca03a2ad33a | a441887d-77e8-42cb-9612-02afb4dbf500 |
| db292066-4339-4fe5-bbf5-cc09d82a1b9e | 172.19.0.2 | e2b98f15-b066-4481-8245-54d587c4fe0c | 91bc583e-bd73-49ac-b3bf-6ec0f9416e7f |
| f076a973-d245-4ce5-8d89-6d4e4caecc43 | 172.17.0.1 | 9cda92af-bd52-408f-9a53-c2764d9ba44f | 5afc8548-9d50-464d-a127-4c287657d332 |
| f74a22ce-ffef-484e-880a-562be539d1f1 | 9.111.222.243 | 3ce0480c-8548-449d-99b4-b9a3bb978a64 | c7af4bc4-a160-4a42-992a-cdfbd3dd707c |
+--------------------------------------+---------------+--------------------------------------+--------------------------------------+
19 rows in set (0.00 sec)
MariaDB [neutron]> select * from subnets;
+----------------------------------+--------------------------------------+----------------+--------------------------------------+------------+----------------+-------------+-------------+--------+--------------+-------------------+---------------+
| tenant_id | id | name | network_id | ip_version | cidr | gateway_ip | enable_dhcp | shared | ipv6_ra_mode | ipv6_address_mode | subnetpool_id |
+----------------------------------+--------------------------------------+----------------+--------------------------------------+------------+----------------+-------------+-------------+--------+--------------+-------------------+---------------+
| d67be6b4d9734ec0a3de1ae7c250db02 | 2de3d1b4-4b8b-4b6f-9556-118da5efd01d | default_subnet | e89e1697-ca8a-42e9-9cc1-5b0a6d24b307 | 4 | 172.18.0.0/16 | 172.18.0.1 | 1 | 0 | NULL | NULL | NULL |
| de8f43bfe4244a1aa315a70a43248d60 | 3ce0480c-8548-449d-99b4-b9a3bb978a64 | ext-subnet | c7af4bc4-a160-4a42-992a-cdfbd3dd707c | 4 | 9.111.222.0/24 | 9.111.222.1 | 0 | 1 | NULL | NULL | NULL |
| 761f503edd7541e6840138d91ffd3254 | 3d997f37-ef63-4612-aa7e-6ca03a2ad33a | default_subnet | a441887d-77e8-42cb-9612-02afb4dbf500 | 4 | 172.20.0.0/16 | 172.20.0.1 | 1 | 0 | NULL | NULL | NULL |
| 30ede715c60246069a1e1655d2746d6e | 9cda92af-bd52-408f-9a53-c2764d9ba44f | default_subnet | 5afc8548-9d50-464d-a127-4c287657d332 | 4 | 172.17.0.0/16 | 172.17.0.1 | 1 | 0 | NULL | NULL | NULL |
| de8f43bfe4244a1aa315a70a43248d60 | dbef5acb-df7a-4f25-b181-0f1c582761cb | int-subnet | 6d1096a0-8b22-4607-b392-137ae0072106 | 4 | 192.168.1.0/24 | 192.168.1.1 | 1 | 0 | NULL | NULL | NULL |
| 41e63787b9a64db29a0a3845a2490aa5 | e2b98f15-b066-4481-8245-54d587c4fe0c | default_subnet | 91bc583e-bd73-49ac-b3bf-6ec0f9416e7f | 4 | 172.19.0.0/16 | 172.19.0.1 | 1 | 0 | NULL | NULL | NULL |
+----------------------------------+--------------------------------------+----------------+--------------------------------------+------------+----------------+-------------+-------------+--------+--------------+-------------------+---------------+
6 rows in set (0.00 sec)
MariaDB [neutron]> select * from floatingips ;
+----------------------------------+--------------------------------------+---------------------+--------------------------------------+--------------------------------------+--------------------------------------+------------------+--------------------------------------+----------------------+--------+
| tenant_id | id | floating_ip_address | floating_network_id | floating_port_id | fixed_port_id | fixed_ip_address | router_id | last_known_router_id | status |
+----------------------------------+--------------------------------------+---------------------+--------------------------------------+--------------------------------------+--------------------------------------+------------------+--------------------------------------+----------------------+--------+
| de8f43bfe4244a1aa315a70a43248d60 | dee22b07-440c-4752-bad7-ff5ba96d8973 | 9.111.222.246 | c7af4bc4-a160-4a42-992a-cdfbd3dd707c | 1d0c2bbf-1513-4dec-8ec3-40803daec518 | 08f40e39-b5a2-4dd2-b385-a397966eabd3 | 192.168.1.12 | 8fd34c9e-323b-40b0-8d8a-3976fd115074 | NULL | ACTIVE |
+----------------------------------+--------------------------------------+---------------------+--------------------------------------+--------------------------------------+--------------------------------------+------------------+--------------------------------------+----------------------+--------+
1 row in set (0.00 sec)
MariaDB [neutron]>