---
title: "external subnets"
canonical: "https://docs.infoblox.com/space/BloxOneCloud/52036790/external%20subnets"
format: markdown
---
> ℹ️ **IMPORTANT**
> ℹ️ 
> ℹ️ - When importing a CSV file to Infoblox Portal, Only the **HEADER-atcapi-externalsubnet**, **name**, **key**, and **items** fields are required.
> ℹ️ - The **description**, **created_time**, and **updated_time** fields are optional.
> ℹ️ - For the **key **field, **Base64** encoding should be done on the **external network name** **value**.  Make sure to remove the trailing "**=**" padding from the string before importing.

## The External Subnets Schema 

> ℹ️ **Note**: The table shown below is for schema/reference purposes only.

| **header** | **HEADER-atcapi-externalsubnet** | **type** | **encoding** | **sample** |
| --- | --- | --- | --- | --- |
| name | atcapi-externalsubnet | string | string | AWS Perf Client IPs |
| key | atcapi-externalsubnet | string | string | QVdTIFBlcmYgQ2xpZW50IElQcw |
| description | atcapi-externalsubnet | string | string | Los Angeles, CA |
| items | atcapi-externalsubnet | array | stringarray | 192.168.1.2/32 |
| created_time | atcapi-externalsubnet | string | string | 2022-04-18T12:38:34Z |
| updated_time | atcapi-externalsubnet | string | string | 2022-04-20T15:41:11Z |

Sample CSV (downloadable) showing the correct formatting for the **Key** value (without padding).

  

 

## Base64 Encoding

### **macOS**

**Method 1:** **Using the built-in base64 command**

To base64 encode on a Mac, use the built-in `base64` command in the Terminal. For strings, use `echo -n "text" | base64`, and for files, use `base64 -i inputfile -o outputfile`. These commands are available by default in macOS and provide a quick way to encode text or files without installing extra software.

> ℹ️ Note: This method adds everything together. For example, if there are multiple lines in `inputfile` i, the output file contains a single string.

**Encoding Strings in Terminal**

- **Best method (no newline):** `echo -n "your_string" | base64`
- **Alternative:** `base64 <<< "your_string"` (Note: This adds an extra newline to the output)
- **Example:** `echo -n "Hello World" | base64` produces `SGVsbG8gV29ybGQ=`.

**Decoding Strings in Terminal**

- Use the `-D` flag: `echo "SGVsbG8gV29ybGQK" | base64 -D`

**Method 2: Encoding Files in Terminal**

- **Command:** `base64 -i input_file -o output_file`
- **Example:** `base64 -i input_file.txt -o encoded_image.txt`

**Method 3:**

- **OpenSSL:** You can also use `openssl base64 -in inputfile`.

> ℹ️ This method also returns a single encoded string for all the lines in input file.

**Method 4: **

- **Python:** Use the pre-installed Python with `echo "text" | python3 -m base64`.

### **Microsoft Windows**

You can encode to Base64 in Windows using built-in command-line tools like **PowerShell** for strings and files, or the older `certutil` command for files.

**Method 1: Using PowerShell**

PowerShell is the recommended method for general use as it is modern and flexible.  
  
**Encoding a String:**

To encode a plaintext string in UTF-8, use the following command in PowerShell or Command Prompt (CMD):

Powershell:

```
powershell "[Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes('Your string here'))"

```

- **Example:** Encoding "Hello world!" gives `SGVsbG8gd29ybGQh`.

**Encoding a File:**

> ℹ️ This method **will not** generate the code as expected if there is more than 1 row in inputfile.

You can also encode the entire contents of a file to a Base64 string:

Powershell:

```
[Convert]::ToBase64String([System.IO.File]::ReadAllBytes("C:\path\to\yourfile.bin")) | Out-File -FilePath "C:\path\to\encodedfile.txt"

```

- This command reads the binary data of the input file and writes the resulting Base64 string to a specified output file.


**Method 2: Using certutil**

Using `certutil` (for files only)

The `certutil` command is a legacy Windows utility that can also perform Base64 encoding and decoding of files. The output includes "Begin" and "End" headers which may require manual trimming if you need the raw Base64 string.

- **To encode a file:**
  cmd
- The `-f` option can be added to force overwriting of an existing output file.

### **Linux**

**Method 1:** **Using the built-in base64 command**

To encode data to Base64 in Linux, the built-in `base64` command is the standard and simplest method, which is part of the [GNU Core Utilities](https://medium.com/swlh/how-to-encode-and-decode-base64-strings-with-mac-os-or-linux-778274dcf967). You can use it for both strings and files.

**Encoding a String**

To encode a string, you can use `echo` and pipe the output to the `base64` command. It is best to use `echo -n` or `printf` to avoid encoding a trailing newline character that `echo` adds by default, which can cause issues.

- **Using **`printf`** (recommended for scripts):**
  bash
- **Using **`echo -n`**:**
  bash

The encoded string will be printed to the standard output.

**Encoding a File**

To encode the contents of a file, pass the filename as an argument to the `base64` command.

- **To display the output in the terminal:**
  bash

> ℹ️ This method does not generate the code as expected if we have more than 1 row in inputfile.

- **To save the encoded output to a new file:**
  bash

> ℹ️ This method does not generate the code as expected if we have more than 1 row in inputfile.

**Additional Options**

- **Disable Line Wrapping:** By default, the `base64` command wraps output lines after 76 characters. To get the output as a single, continuous line, use the `-w 0` (or `--wrap=0`) option.
  bash

> ℹ️ This method does not generate the code as expected if we have more than 1 row in inputfile.

- **Decoding:** To decode data back to its original format, use the `-d` (or `--decode`) option.
  bash

> ℹ️ The user has to add the original encoded string. 
> ℹ️ 
> ℹ️ For example, 'echo -n 'AWS Perf Client IPs' | base64' generates string - QVdTIFBlcmYgQ2xpZW50IElQcw== and we ask users to removed '==' and import with 'QVdTIFBlcmYgQ2xpZW50IElQcw' in key column. But when user try to decode again, he can't just use 'QVdTIFBlcmYgQ2xpZW50IElQcw'
> ℹ️ 
> ℹ️ $ echo "QVdTIFBlcmYgQ2xpZW50IElQcw" | base64 -d
> ℹ️ 
> ℹ️ AWS Perf Client IPsbase64: invalid input
> ℹ️ 
> ℹ️ $ echo "QVdTIFBlcmYgQ2xpZW50IElQcw==" | base64 -d
> ℹ️ 
> ℹ️ AWS Perf Client IPs