Connect a Linux server
A Linux server connects to your address as a single device with wg-quick, WireGuard’s standard tool.
Steps
First, in the panel, add the server as a “Single device” on a site in “Inbound only” and download its .conf file.
Install the tools
On Debian or Ubuntu install
wireguard-tools. On other distributions look for the package with the same name.sudo apt install wireguard-toolsSave the configuration
Copy the file to
/etc/wireguard/portuno.conf, readable by root only. The file name is the interface name and cannot be longer than 15 characters, which is why it is calledportuno.conf. Change the path to your file’s.sudo install -m 600 ./portuno-site-device.conf /etc/wireguard/portuno.confBring the tunnel up
Start it now and at every boot:
sudo systemctl enable --now wg-quick@portunoCheck the handshake
The “latest handshake” line says how many seconds ago the handshake happened. In the panel, the device shows its last handshake.
sudo wg show portunoOpen the port in the firewall
If the server runs a firewall, allow your service’s port from
10.77.0.1on theportunointerface. With ufw, for example for443:sudo ufw allow in on portuno from 10.77.0.1 to any port 443 proto tcpCreate the mapping
In the panel’s Mappings, create a mapping to this server. The destination IP is its tunnel address: the
Addressline of the file, without the/32.
Your service must listen on every interface (0.0.0.0) or on the tunnel address, not only on 127.0.0.1.
Keeping the client’s address
On a site in “Inbound, keeping the client’s address”, your server sees the real IP of whoever connects. The panel’s file already comes with Table = off and AllowedIPs = 0.0.0.0/0; add these lines to its [Interface] section. They mark the connections that arrive through the tunnel and send only their replies back through it. The server’s default route does not change.
Table = off
PostUp = iptables -t mangle -A PREROUTING -i %i -m conntrack --ctstate NEW -j CONNMARK --set-mark 0x77
PostUp = iptables -t mangle -A OUTPUT -m connmark --mark 0x77 -j MARK --set-mark 0x77
PostUp = ip rule add fwmark 0x77 table 77 priority 1077
PostUp = ip route add default dev %i table 77
PostUp = sysctl -qw net.ipv4.conf.%i.rp_filter=2
PostDown = ip rule del fwmark 0x77 table 77 priority 1077
PostDown = ip route flush table 77
PostDown = iptables -t mangle -D OUTPUT -m connmark --mark 0x77 -j MARK --set-mark 0x77
PostDown = iptables -t mangle -D PREROUTING -i %i -m conntrack --ctstate NEW -j CONNMARK --set-mark 0x77Restart the tunnel with sudo systemctl restart wg-quick@portuno and open your service’s port on the portuno interface from any source, for example sudo ufw allow in on portuno to any port 443 proto tcp.
If this Linux box is the site’s router and the services run on other devices of your network, use the recipe the panel shows: it changes one of these lines and adds the forwarding to the device.
“Outbound through the tunnel”, only with approved outbound: the file without Table = off, with AllowedIPs = 0.0.0.0/0. While the tunnel is up, all of the server’s internet goes out through portuno, with no fallback to your provider.