Question: how to add new peer to WireGuard VPN via API

Question: how to add new peer to WireGuard VPN via API

14 Reply
Re:Question: how to add new peer to WireGuard VPN via API
2 weeks ago

Hi @Vincent-TP,

 

it seems, there is still a small misunderstanding regarding my question...

  • I know exactly how to create WireGuard site2site VPN - I have replaced the unstable SD-WAN with WireGuard, which is very stable
  • I have currently two WireGuard VPNs configured per site:
    • one site2site as SD-WAN replacement
    • second one for mobile client access
  • I'm trying to add new peer to existing WireGuard via API (to the second one - for mobile clients) using "Modify site-to-site VPN by manual" API call - that's where I still have problems to pass parameters in correct format - always getting error "-1001 Invalid request parameters"......

 

 

/BR ZoloNN ----------------------------------------------------------------------- Omada 2x ER605(UN) v2.0 + SG2008P(UN) V3.20 + SG2218 V1.20 + 2x SG2008 V4.20 + 3x EAP615-Wall(EU) V1.0 CET (GMT+1)
  0  
  0  
#12
Options
Re:Question: how to add new peer to WireGuard VPN via API-Solution
Thursday - last edited Thursday

Hi  @ZoloNN 

 

Sorry for the late reply. Here are the intructions:

  1. Use this API to retrieve existing wired guard VPNs and related peer parameters: GET /openapi/v2/{omadacId}/sites/{siteId}/vpn/site-to-site-vpns/{vpnId}
  2. Based on the above information, identify the VPN ID to be modified and the existing parameter details. Then use the following PATCH method to add corresponding peer information (i.e., remote subset): PATCH /openapi/v2/{omadacId}/sites/{siteId}/vpn/site-to-site-vpns/{vpnId}

 

 

Error -1001 Invalid request parameters indicates that the parameters are unavailable. It is likely that the input information was not formatted as required. Please check whether the parameters are complete and formatted in accordance with the document requirements.

 

If the situation is still the same, don't hesitate to let us know.

Recommended Solution
  0  
  0  
#13
Options
Re:Question: how to add new peer to WireGuard VPN via API
Thursday

Hi @Vincent-TP,

 

it seems, that the API call PATCH /openapi/v2/{omadacId}/sites/{siteId}/vpn/site-to-site-vpns/{vpnId} expects the whole information set inclusive VPN name, VPN type, service port, etc... not only new peer info - which is IMHO overkill when I will only add one new peer....

 

currently I'm using the deprecated POST /openapi/v1/{omadacId}/sites/{siteId}/vpn/wireguard-peers which is working fine - just the question is, how long....

will try to experiment to get it running, but the usage isn't apparently that simple as the old API call.

 

I would like to see similar API call in the new API structure

 

/BR ZoloNN ----------------------------------------------------------------------- Omada 2x ER605(UN) v2.0 + SG2008P(UN) V3.20 + SG2218 V1.20 + 2x SG2008 V4.20 + 3x EAP615-Wall(EU) V1.0 CET (GMT+1)
  0  
  0  
#14
Options
Re:Question: how to add new peer to WireGuard VPN via API
Friday

Hi  @ZoloNN 

 

Here is an example for your reference:

{
    "vpnType": 4,
    "name": "1",
    "status": true,
    "mtu": 1420,
    "servicePort": 51820,
    "networkType": 0,
    "networkList": [
        "69e829c2c0522377a132f389"
    ],
    "tunnelIp": "172.16.0.2",
    "privateKey": "2CpCHWuZZoe7nU/wZ56v3jzo2rl7ykL6HwKy3Bkb0l0=",
    "publicKey": "yiYmWgY85IxEGRO2MZKjVZftNwatN3fRb6XD8jsmaSQ=",
    "peers": [
        {
            "name": "Peer_1",
            "status": true,
            "serverPublicKey": "112233445566778899112233445566778899001122+=",
            "remoteIp": "",
            "remoteSubnet": [
                "1.1.1.1/24"
            ],
            "keepAlive": 25
        }
    ],
    "siteVpnType": 1,
    "id": "69e97959c0522377a1330613"
}

  0  
  0  
#15
Options