[Interface]
PrivateKey = <закрытый_ключ>
Address = <IP-адрес_сервера>
ListenPort = <Порт>
PostUp = iptables -A FORWARD -i %i -j ACCEPT; iptables -t nat -A POSTROUTING -o <Интерфейс> -j MASQUERADE 
PostDown = iptables -D FORWARD -i %i -j ACCEPT; iptables -t nat -D POSTROUTING -o <Интерфейс> -j MASQUERADE

поменяй скрипт для

C:\Users\79685>ssh root@87.120.186.61
The authenticity of host '87.120.186.61 (87.120.186.61)' can't be established.
ED25519 key fingerprint is SHA256:b3P8mPTIj2ni86aj06+cLubJ0vOk/M3FWdSuDNfSY0U.
This key is not known by any other names.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '87.120.186.61' (ED25519) to the list of known hosts.
root@87.120.186.61's password:
Welcome to Ubuntu 22.04.5 LTS (GNU/Linux 5.15.0-125-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/pro

This system has been minimized by removing packages and content that are
not required on a system that users do not log into.

To restore this content, you can run the 'unminimize' command.
root@fortinside-cd:~# sudo apt update
Hit:1 http://archive.ubuntu.com/ubuntu jammy InRelease
Hit:2 http://archive.ubuntu.com/ubuntu jammy-updates InRelease
Hit:3 http://archive.ubuntu.com/ubuntu jammy-backports InRelease
Hit:4 http://archive.ubuntu.com/ubuntu jammy-security InRelease
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
1 package can be upgraded. Run 'apt list --upgradable' to see it.
root@fortinside-cd:~# sudo apt install wireguard
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
wireguard is already the newest version (1.0.20210914-1ubuntu2).
The following packages were automatically installed and are no longer required:
  linux-headers-5.15.0-73 linux-headers-5.15.0-73-generic linux-image-5.15.0-73-generic
  linux-modules-5.15.0-73-generic
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
root@fortinside-cd:~# cd /etc/wireguard/
root@fortinside-cd:/etc/wireguard# wg genkey | tee /etc/wireguard/server_privatekey | wg pubkey | tee /etc/wireguard/server_publickey
0I2DuJGy3dlqiR5cZ/oXctNmHtqoYYo1B0vWA9DT7D4=
root@fortinside-cd:/etc/wireguard# cat server_privatekey
QJvfkg1dQ4qCAm1O0HcUYxLnWggQFVlZSFMYHa9AxmA=
root@fortinside-cd:/etc/wireguard# cat server_publickey
0I2DuJGy3dlqiR5cZ/oXctNmHtqoYYo1B0vWA9DT7D4=
root@fortinside-cd:/etc/wireguard# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: ens3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 52:54:00:ca:a2:9a brd ff:ff:ff:ff:ff:ff
    altname enp0s3
    inet 87.120.186.61/32 brd 87.120.186.61 scope global ens3
       valid_lft forever preferred_lft forever
    inet6 fe80::5054:ff:feca:a29a/64 scope link
       valid_lft forever preferred_lft forever
3: wg0: <POINTOPOINT,NOARP,UP,LOWER_UP> mtu 1420 qdisc noqueue state UNKNOWN group default qlen 1000
    link/none
    inet 192.168.15.1/24 scope global wg0
       valid_lft forever preferred_lft forever
root@fortinside-cd:/etc/wireguard#