2
2
Google Cloud Platform
3
3
#####################
4
4
5
- Deploy VM
6
- ---------
5
+ This guide provides step-by-step instructions for deploying a VyOS instance with two NICs and the required resources on Google Cloud Platform (GCP).
6
+
7
+ Prerequisites
8
+ ========
9
+
10
+ Before proceeding, ensure the following:
11
+
12
+ - A GCP account with billing enabled.
13
+ - Permissions to deploy Marketplace images.
14
+ - Access to enable APIs and create resources (e.g., Compute Engine Admin, Network Admin).
15
+ - An SSH key pair for VyOS instance access.
16
+ - GA Google Cloud Project.
7
17
8
- To deploy VyOS on GCP (Google Cloud Platform)
18
+ Deployment Steps
19
+ ========
9
20
10
- 1. Generate SSH key pair type **ssh-rsa ** from the host that will connect to
11
- VyOS.
21
+ Step 1: Add SSH Key
22
+ -------------------
23
+
24
+ 1. If you don’t already have SSH keys, generate an SSH key pair of type ``ssh-rsa `` on your local machine:
12
25
13
26
Example:
14
27
@@ -17,42 +30,248 @@ To deploy VyOS on GCP (Google Cloud Platform)
17
30
ssh-keygen -t rsa -f ~/.ssh/vyos_gcp -C "vyos@mypc"
18
31
19
32
20
- .. note :: In name "vyos@mypc" The first value must be "**vyos**". Because
21
- default user is vyos and google api uses this option.
22
-
33
+ .. note :: In the comment ``vyos@mypc``, the username must start with vyos.
34
+ This is because the default user in the VyOS image is ``vyos ``, and the Google Cloud API uses this value for SSH access.
23
35
24
- 2. Open GCP console and navigate to the menu ** Metadata **. Choose
25
- **SSH Keys ** and click `` edit `` .
36
+ 2. Open GCP console and navigate to the ** Compute Engine ** > ** Metadata ** > ** SSH Keys **. Choose
37
+ **SSH Keys **.
26
38
27
39
.. figure :: /_static/images/cloud-gcp-01.png
28
40
29
41
30
- Click **Add item ** and paste your public ssh key. Click ``Save ``.
42
+ 3. Click **edit ** and **Add item **.
43
+
44
+ 4. Paste your public ssh key and **Save **.
31
45
32
46
.. figure :: /_static/images/cloud-gcp-02.png
33
47
48
+ For more information, please visit the official Google Cloud documentation:
49
+
50
+ https://cloud.google.com/compute/docs/connect/add-ssh-keys
51
+
52
+ https://cloud.google.com/compute/docs/connect/create-ssh-keys
53
+
54
+
55
+ Step 2: Create a Service Account (If You Don't Have One)
56
+ -------------------------------
57
+
58
+ 1. In the Google Cloud console **IAM & Admin > Service Accounts **.
59
+
60
+ 2. Select select a project.
61
+
62
+ .. figure :: /_static/images/cloud-gcp-proj.png
63
+
64
+ 3. Click **Create Service Account **:
65
+
66
+ - Name: e.g., ``vyos-test ``
67
+
68
+ - Service account ID: e.g., ``vyos-test ``
69
+
70
+ - Description: e.g., ``VyOS Test Service Account ``
71
+
72
+ 4. Click **Done **.
73
+
74
+ .. figure :: /_static/images/cloud-gcp-svc.png
75
+
76
+ For more information, please visit the official Google Cloud documentation:
77
+
78
+ https://cloud.google.com/iam/docs/service-accounts-create
79
+
80
+ https://cloud.google.com/iam/docs/service-account-overview
81
+
82
+
83
+ Step 3: Create VPC Networks and Subnets
84
+ -------------------------------
85
+
86
+ 1. In the Google Cloud console **VPC Network > VPC Networks ** https://console.cloud.google.com/networking/networks/list
87
+
88
+ 2. Select select a project.
89
+
90
+ .. figure :: /_static/images/cloud-gcp-proj.png
91
+
92
+ 3. Click **Create VPC Network **.
93
+
94
+ **Public VPC **:
95
+
96
+ - Name: e.g., ``vyos-public-vpc ``
97
+
98
+ - Subnet creation mode: ``Custom ``
99
+
100
+ - Subnet name: e.g., ``vyos-public-subnet ``
101
+
102
+ - Region: e.g., ``europe-west1 ``
103
+
104
+ - IP range: e.g., ``10.0.1.0/24 ``
105
+
106
+ - Leave all other settings at default, then click **Create **.
107
+
108
+ .. figure :: /_static/images/cloud-gcp-vpc-01.png
109
+
110
+ .. figure :: /_static/images/cloud-gcp-vpc-02.png
111
+
112
+ **Private VPC **:
113
+
114
+ - Name: ``vyos-private-vpc ``
115
+
116
+ - Subnet creation mode: ``Custom ``
117
+
118
+ - Subnet name: ``vyos-private-subnet ``
119
+
120
+ - Region: e.g., ``europe-west1 ``
121
+
122
+ - IP range: ``10.0.11.0/24 ``
123
+
124
+ - Leave all other settings at default, then click **Create **.
125
+
126
+ .. figure :: /_static/images/cloud-gcp-vpc-03.png
127
+
128
+ .. figure :: /_static/images/cloud-gcp-vpc-04.png
129
+
130
+ 4. Add firewall rules to allow specific network traffic from the Internet. By default all incoming traffic from outside a network is blocked.
131
+
132
+ .. figure :: /_static/images/cloud-gcp-vpc-05.png
133
+
134
+ .. figure :: /_static/images/cloud-gcp-vpc-06.png
135
+
136
+ .. figure :: /_static/images/cloud-gcp-vpc-07.png
34
137
35
- 2. On marketplace search "VyOS"
138
+ For more information, please visit the official Google Cloud documentation:
36
139
37
- 3. Change Deployment name/Zone/Machine type and click `` Deploy ``
140
+ https://cloud.google.com/vpc/docs/create-modify-vpc-networks
38
141
39
- .. figure :: /_static/images/cloud-gcp-03.png
40
142
41
- 4. After few seconds click to ``instance ``
143
+ Step 4: Deploy VyOS instance from Marketplace
144
+ ---------
145
+
146
+ 1. Go to the Google Cloud Marketplace page in the Google Cloud console https://console.cloud.google.com/marketplace
147
+
148
+ 2. Choose the project where you want to deploy the VyOS instance.
149
+
150
+ .. figure :: /_static/images/cloud-gcp-proj.png
151
+
152
+ 3. In the search bar, type ``vyos `` to find the VyOS image in the Marketplace.
153
+
154
+ .. figure :: /_static/images/cloud-gcp-market-01.png
155
+
156
+ .. figure :: /_static/images/cloud-gcp-market-02.png
157
+
158
+ 4. On the next page, review details such as support, pricing, and other details.
159
+
160
+ .. figure :: /_static/images/cloud-gcp-market-03.png
161
+
162
+ 5. Click the ``GET STARTED `` button to start deployment process.
163
+
164
+ .. figure :: /_static/images/cloud-gcp-market-04.png
165
+
166
+ .. figure :: /_static/images/cloud-gcp-market-05.png
167
+
168
+ 6. General settings.
169
+
170
+ - Deployment name: e.g., ``vyos-test-vm ``
171
+
172
+ - Select a Service Account: Select the service account created earlier.
173
+
174
+ - Image: Select VyOS image for deployment.
175
+
176
+ - Zone: e.g., ``europe-west1-b ``
177
+
178
+ - Machine type: Choose based on performance and resource needs.
179
+
180
+ .. figure :: /_static/images/cloud-gcp-vm-01.png
181
+
182
+ .. figure :: /_static/images/cloud-gcp-vm-02.png
183
+
184
+ 7. Configure the network interfaces.
185
+
186
+ **Public Network interface: **
187
+
188
+ Edit the first (default) network interface and select following settings:
189
+
190
+ - Network: ``vyos-public-vpc ``
191
+
192
+ - Subnetwork: ``vyos-public-subnet ``
193
+
194
+ - External IP: ``Ephemeral ``
195
+
196
+ - Private Network interface:
42
197
43
- .. figure :: /_static/images/cloud-gcp-04.png
198
+ **Private Network Interface: **
199
+
200
+ Click **ADD A NETWORK INTERFACE ** button to create a second (private) interface, and select following settings:
44
201
45
- 5. Find out your external IP address
202
+ - Network: `` vyos-private-vpc ``
46
203
47
- .. figure :: /_static/images/cloud-gcp-05.png
204
+ - Subnetwork: `` vyos-private-subnet ``
48
205
49
- 6. Connect to the instance. SSH key was generated in the first step.
206
+ - External IP: ``None ``
207
+
208
+ .. figure :: /_static/images/cloud-gcp-vm-03.png
209
+
210
+ 8. Deployment automation.
211
+
212
+ - You can use ``cloud-init `` ``User Data `` to automatically inject specific configuration commands into the VyOS instance during deployment.
213
+
214
+ - Example:
215
+
216
+ .. code-block :: none
217
+
218
+ #cloud-config
219
+ vyos_config_commands:
220
+ - set system host-name 'VyOS-for-GCP'
221
+ - set system login banner pre-login 'Welcome to the VyOS for on GCP'
222
+ - set interfaces ethernet eth0 description 'WAN'
223
+ - set interfaces ethernet eth1 description 'LAN'
224
+ - set interfaces ethernet eth1 address 'dhcp'
225
+ - set interfaces ethernet eth1 dhcp-options no-default-route
226
+
227
+ For more information, please visit the official VyOS documentation:
228
+
229
+ https://docs.vyos.io/en/stable/automation/cloud-init.html#module-vyos-userdata
230
+
231
+ .. figure :: /_static/images/cloud-gcp-vm-09.png
232
+
233
+ 9. Click ``Deploy `` button.
234
+
235
+ .. figure :: /_static/images/cloud-gcp-vm-06.png
236
+
237
+ .. figure :: /_static/images/cloud-gcp-vm-07.png
238
+
239
+
240
+ Connect to the VyOS instance
241
+ -----------
242
+
243
+ To connect to the VyOS instance, use the SSH key that was generated in the first step.
244
+
245
+ To retrieve the public IP address, go to the **Google Cloud Console ** and navigate to: **Compute Engine ** > **VM instances ** https://console.cloud.google.com/compute/instances?project=vyos-images
246
+
247
+ .. figure :: /_static/images/cloud-gcp-vm-08.png
248
+
249
+ Example:
50
250
51
251
.. code-block :: none
52
252
53
- ssh -i ~/.ssh/vyos_gcp [email protected]
54
- vyos@vyos-r1-vm:~$
253
+ ssh [email protected] -i .ssh/vyos_gcp
254
+
255
+ The authenticity of host '35.233.97.132 (35.233.97.132)' can't be established.
256
+ ED25519 key fingerprint is SHA256:KCsCnwCGhwX2ba5RcPUAO3ZUSNzS4sXIkujFoScCd0g.
257
+ This key is not known by any other names
258
+ Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
259
+ Warning: Permanently added '35.233.97.132' (ED25519) to the list of known hosts.
260
+ Welcome to the VyOS for on GCP
261
+ Welcome to VyOS!
262
+
263
+ ┌── ┐
264
+ . VyOS 1.4.2
265
+ └ ──┘ sagitta
266
+
267
+ * Documentation: https://docs.vyos.io/en/sagitta
268
+ * Project news: https://blog.vyos.io
269
+ * Bug reports: https://vyos.dev
270
+
271
+ You can change this banner using "set system login banner post-login" command.
272
+
273
+ VyOS is a free software distribution that includes multiple components,
274
+ you can check individual component licenses under /usr/share/doc/*/copyright
275
+ vyos@VyOS-for-GCP:~$
276
+
55
277
56
- References
57
- ----------
58
- https://console.cloud.google.com/
0 commit comments