root / docs / examplesdir / network.rst @ 04c039c8
History | View | Annotate | Download (4.5 kB)
1 |
Networks |
---|---|
2 |
======== |
3 |
|
4 |
Users can create private networks to connect Virtual Machines, and can also |
5 |
manage network-related objects and properties e.i., connection to public |
6 |
networks, IPs and subnets. |
7 |
|
8 |
In the following we assume that there are two active virtual servers (ids 141 |
9 |
and 142) connected to one public network with id 1 (default set up). |
10 |
|
11 |
.. code-block:: console |
12 |
|
13 |
$ kamaki server info 141 --nics |
14 |
10 |
15 |
firewallProfile: DISABLED |
16 |
ipv4: 10.0.0.1 |
17 |
ipv6: None |
18 |
mac_address: aa:00:00:23:0d:59 |
19 |
network_id: 1 |
20 |
$ kamaki server info 142 --nics |
21 |
20 |
22 |
firewallProfile: DISABLED |
23 |
ipv4: 10.0.0.3 |
24 |
ipv6: None |
25 |
mac_address: aa:00:00:70:21:65 |
26 |
network_id: 1 |
27 |
|
28 |
Let's load kamaki for networks and have a look at the current network state. We |
29 |
expect to find at least one public network (id: 1) |
30 |
|
31 |
.. code-block:: console |
32 |
|
33 |
$ kamaki network list |
34 |
1 public_network |
35 |
|
36 |
Create a private network |
37 |
------------------------ |
38 |
|
39 |
The new network will be named 'My Private Net' |
40 |
|
41 |
.. code-block:: console |
42 |
|
43 |
$ kamaki network create --name='My Private Net' |
44 |
id: 3 |
45 |
status: ACTIVE |
46 |
router:external: True |
47 |
user_id: s0m3-u53r-1d |
48 |
updated: 2013-06-19T13:54:57.672744+00:00 |
49 |
created: 2013-06-19T13:52:02.268886+00:00 |
50 |
links: ... |
51 |
public: False |
52 |
tenant_id: s0m3-u53r-1d |
53 |
admin_state_up: True |
54 |
SNF:floating_ip_pool: False |
55 |
subnets: |
56 |
type: MAC_FILTERED |
57 |
|
58 |
Connect and disconnect |
59 |
---------------------- |
60 |
|
61 |
Lets connect the network to some virtual servers: |
62 |
|
63 |
.. code-block:: console |
64 |
|
65 |
$ kamaki network connect 3 --device-id=141 --device-id=142 |
66 |
|
67 |
.. note:: **network connect** is a shortcut for **port create**: |
68 |
|
69 |
.. code-block:: console |
70 |
|
71 |
$ kamaki port create --network-id=3 --device-id=141 |
72 |
$ kamaki port create --network-id=3 --device-id=142 |
73 |
|
74 |
Now, let's check the current network state. We expect to see the servers |
75 |
connected to networks with ids 4 and 5, but not 3. |
76 |
|
77 |
.. code-block:: console |
78 |
|
79 |
$ kamaki network list -l |
80 |
1 public_network |
81 |
status: ACTIVE |
82 |
router:external: True |
83 |
user_id: None |
84 |
updated: 2013-06-19T13:36:51.932214+00:00 |
85 |
created: 2013-05-29T17:30:03.040929+00:00 |
86 |
links: ... |
87 |
tenant_id: None |
88 |
admin_state_up: True |
89 |
SNF:floating_ip_pool: False |
90 |
public: True |
91 |
subnets: |
92 |
53 |
93 |
type: IP_LESS_ROUTED |
94 |
2 My Private Net |
95 |
status: ACTIVE |
96 |
router:external: True |
97 |
user_id: s0m3-u53r-1d |
98 |
updated: 2013-06-19T13:54:57.672744+00:00 |
99 |
created: 2013-06-19T13:52:02.268886+00:00 |
100 |
links: ... |
101 |
public: False |
102 |
tenant_id: s0m3-u53r-1d |
103 |
admin_state_up: True |
104 |
SNF:floating_ip_pool: False |
105 |
subnets: |
106 |
type: MAC_FILTERED |
107 |
|
108 |
Now the servers can communicate with each other through their shared private |
109 |
network. A look at the network details will confirm that: |
110 |
|
111 |
.. code-block:: console |
112 |
|
113 |
$ kamaki network info 3 |
114 |
attachments: |
115 |
12 |
116 |
. . . . . . . |
117 |
22 |
118 |
cidr: 192.168.1.0/24 |
119 |
cidr6: None |
120 |
created: 2013-06-19T13:52:02.268886+00:00 |
121 |
dhcp: False |
122 |
gateway: None |
123 |
gateway6: None |
124 |
name: My Private Net |
125 |
public: False |
126 |
status: ACTIVE |
127 |
tenant_id: s0m3-u53r-1d |
128 |
type: MAC_FILTERED |
129 |
updated: 2013-06-19T13:54:57.672744+00:00 |
130 |
user_id: s0m3-u53r-1d |
131 |
|
132 |
Destroy a private network |
133 |
------------------------- |
134 |
|
135 |
Attempt to destroy the public network |
136 |
|
137 |
.. code-block:: console |
138 |
|
139 |
$ kamaki network delete 1 |
140 |
(403) Network with id 1 is in use |
141 |
| FORBIDDEN forbidden (Can not delete the public network.) |
142 |
|
143 |
.. warning:: Public networks cannot be destroyed |
144 |
|
145 |
Attempt to destroy the `For virtual server 141` network |
146 |
|
147 |
.. code-block:: console |
148 |
|
149 |
$ kamaki network delete 4 |
150 |
(403) Network with id 4 is in use |
151 |
|
152 |
The attached virtual servers should be disconnected first (recall that the |
153 |
11 connects network with id 4 to virtual server with id 141) |
154 |
|
155 |
.. code-block:: console |
156 |
|
157 |
$ kamaki network disconnect 4 141 |
158 |
$ kamaki network delete 4 |
159 |
|
160 |
.. note:: **network disconnect** is a shortcut for **port delete** |
161 |
|
162 |
.. code-block:: console |
163 |
|
164 |
$ kamaki port delete 11 |
165 |
$ kamaki network delete 4 |
166 |
|
167 |
Attempt to delete the common network, after disconnecting the respective ports |
168 |
(12, 22): |
169 |
|
170 |
.. code-block:: console |
171 |
|
172 |
$ kamaki port delete 22 |
173 |
$ kamaki port delete 12 |
174 |
$ kamaki network delete 3 |