root / docs / examplesdir / network.rst @ 1c366ac9
History | View | Annotate | Download (6 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 |
attachments: |
45 |
cidr: 192.168.1.0/24 |
46 |
cidr6: None |
47 |
created: 2013-06-19T13:52:02.268886+00:00 |
48 |
dhcp: False |
49 |
gateway: None |
50 |
gateway6: None |
51 |
id: 3 |
52 |
name: My Private Net |
53 |
public: False |
54 |
status: ACTIVE |
55 |
tenant_id: s0m3-u53r-1d |
56 |
type: MAC_FILTERED |
57 |
updated: 2013-06-19T13:52:02.388779+00:00 |
58 |
user_id: s0m3-u53r-1d |
59 |
|
60 |
Let's create two more networks, one for virtual server 141 and one for virtual |
61 |
server 142 |
62 |
|
63 |
.. code-block:: console |
64 |
|
65 |
$ kamaki network create --name='For virtual server 141' |
66 |
... |
67 |
id: 4 |
68 |
... |
69 |
$ kamaki network create --name='For virtual server 142' |
70 |
... |
71 |
id: 5 |
72 |
... |
73 |
|
74 |
Connect and disconnect |
75 |
---------------------- |
76 |
|
77 |
Lets connect the networks to some virtual servers: |
78 |
|
79 |
.. code-block:: console |
80 |
|
81 |
$ kamaki network connect 4 141 |
82 |
$ kamaki network connect 5 142 |
83 |
|
84 |
.. note:: **network connect** is a shortcut for **port create**: |
85 |
|
86 |
.. code-block:: console |
87 |
|
88 |
$ kamaki port create --network-id=4 --device-id=141 |
89 |
$ kamaki port create --network-id=5 --device-id=142 |
90 |
|
91 |
Now, let's check the current network state. We expect to see the servers |
92 |
connected to networks with ids 4 and 5, but not 3. |
93 |
|
94 |
.. code-block:: console |
95 |
|
96 |
$ kamaki network list -l |
97 |
1 public_network |
98 |
attachments: |
99 |
10 |
100 |
. . . . . . . |
101 |
20 |
102 |
cidr: 10.0.0.0/24 |
103 |
cidr6: None |
104 |
created: 2013-05-29T17:30:03.040929+00:00 |
105 |
dhcp: True |
106 |
gateway: 10.0.0.254 |
107 |
gateway6: None |
108 |
public: True |
109 |
status: ACTIVE |
110 |
tenant_id: None |
111 |
type: CUSTOM |
112 |
updated: 2013-06-19T13:36:51.932214+00:00 |
113 |
user_id: None |
114 |
3 My Private Net |
115 |
attachments: |
116 |
cidr: 192.168.1.0/24 |
117 |
cidr6: None |
118 |
created: 2013-06-19T13:52:02.268886+00:00 |
119 |
dhcp: False |
120 |
gateway: None |
121 |
gateway6: None |
122 |
public: False |
123 |
status: ACTIVE |
124 |
tenant_id: s0m3-u53r-1d |
125 |
type: MAC_FILTERED |
126 |
updated: 2013-06-19T13:54:57.672744+00:00 |
127 |
user_id: s0m3-u53r-1d |
128 |
4 For virtual server 141 |
129 |
attachments: |
130 |
11 |
131 |
cidr: 192.168.2.0/24 |
132 |
cidr6: None |
133 |
created: 2013-06-19T13:53:02.268886+00:00 |
134 |
dhcp: False |
135 |
gateway: None |
136 |
gateway6: None |
137 |
public: False |
138 |
status: ACTIVE |
139 |
tenant_id: s0m3-u53r-1d |
140 |
type: MAC_FILTERED |
141 |
updated: 2013-06-19T13:54:57.672744+00:00 |
142 |
user_id: s0m3-u53r-1d |
143 |
5 For virtual server 142 |
144 |
attachments: |
145 |
12 |
146 |
cidr: 192.168.3.0/24 |
147 |
cidr6: None |
148 |
created: 2013-06-19T13:54:02.268886+00:00 |
149 |
dhcp: False |
150 |
gateway: None |
151 |
gateway6: None |
152 |
public: False |
153 |
status: ACTIVE |
154 |
tenant_id: s0m3-u53r-1d |
155 |
type: MAC_FILTERED |
156 |
updated: 2013-06-19T13:54:57.672744+00:00 |
157 |
user_id: s0m3-u53r-1d |
158 |
$ kamaki network |
159 |
|
160 |
It is time to make a meaningful connection: connect two servers to a private |
161 |
network |
162 |
|
163 |
.. code-block:: console |
164 |
|
165 |
$ kamaki network connect 141 3 |
166 |
$ kamaki network connect 142 3 |
167 |
|
168 |
Now the servers can communicate with each other through their shared private |
169 |
network. Let's see the network details to confirm that |
170 |
|
171 |
.. code-block:: console |
172 |
|
173 |
$ kamaki network info 3 |
174 |
attachments: |
175 |
12 |
176 |
. . . . . . . |
177 |
22 |
178 |
cidr: 192.168.1.0/24 |
179 |
cidr6: None |
180 |
created: 2013-06-19T13:52:02.268886+00:00 |
181 |
dhcp: False |
182 |
gateway: None |
183 |
gateway6: None |
184 |
name: My Private Net |
185 |
public: False |
186 |
status: ACTIVE |
187 |
tenant_id: s0m3-u53r-1d |
188 |
type: MAC_FILTERED |
189 |
updated: 2013-06-19T13:54:57.672744+00:00 |
190 |
user_id: s0m3-u53r-1d |
191 |
|
192 |
Destroy a private network |
193 |
------------------------- |
194 |
|
195 |
Attempt to destroy the public network |
196 |
|
197 |
.. code-block:: console |
198 |
|
199 |
$ kamaki network delete 1 |
200 |
(403) Network with id 1 is in use |
201 |
| FORBIDDEN forbidden (Can not delete the public network.) |
202 |
|
203 |
.. warning:: Public networks cannot be destroyed |
204 |
|
205 |
Attempt to destroy the `For virtual server 141` network |
206 |
|
207 |
.. code-block:: console |
208 |
|
209 |
$ kamaki network delete 4 |
210 |
(403) Network with id 4 is in use |
211 |
|
212 |
The attached virtual servers should be disconnected first (recall that the |
213 |
11 connects network with id 4 to virtual server with id 141) |
214 |
|
215 |
.. code-block:: console |
216 |
|
217 |
$ kamaki network disconnect 4 141 |
218 |
$ kamaki network delete 4 |
219 |
|
220 |
.. note:: **network disconnect** is a shortcut for **port delete** |
221 |
|
222 |
.. code-block:: console |
223 |
|
224 |
$ kamaki port delete 11 |
225 |
$ kamaki network delete 4 |
226 |
|
227 |
Attempt to delete the common network, after disconnecting the respective ports |
228 |
(12, 22): |
229 |
|
230 |
.. code-block:: console |
231 |
|
232 |
$ kamaki port delete 22 |
233 |
$ kamaki port delete 12 |
234 |
$ kamaki network delete 3 |