# Setting up a connection in MacOs

> Configure macOS VPN connection using the native IKEv2 client and WireGuard via Homebrew - profile import, tunnel activation, and DNS settings

Source: https://opennix.org/en/docs/niflheim/clients/macos/

## 1. Setting up the WireGuard client in MacOS

1.1 First of all, WireGuard must be installed. You can do this in two ways: 

- Get the client from the[App Store](https://apps.apple.com/us/app/wireguard/id1451685025?mt=12)
- Use brew by running the command: ```shell brew install wireguard-tools ```

The user should wait for the installation to complete. 

1.2 The next step is to get the configuration file. This requires the following steps: 

- Connect to the virtual machine via ssh.
- Navigate to the directory `/opt/niflheim/configs/<external_ip>`
- Copy the configuration file `wireguard/<user_name>.conf` to the PC. 

### Configuring the client

1.3 After the user has copied the configuration file it is necessary to configure the client.

If the user uses a client from appstore, it is enough to import the tunnel. To do this, press “+” and select the user's configuration file. 

If the user is using a console client, they need to open a terminal and follow the steps below:

Create a directory:

```shell
mkdir /usr/local/etc/wireguard/
```
Copy the user configuration file into it:

```shell
cp <user_name>.conf /usr/local/etc/wireguard/wg0.conf
```
Run the command:

```shell
sudo wg-quick up wg0
```
## 2. IPSEC VPN Configuration

The user must obtain a configuration file and install a profile. This requires the following steps:

- Connect to the virtual machine via ssh.
- Go to the `/opt/niflheim/configs/<external_ip>` directory.
- Select the configuration file `ipsec/<user_name>.mobileconfig`
- Copy the file to your computer; 
- Open the file by double-clicking and set the profile. 
