Score:0

wg-quick: public-interface not found

cn flag
elk

I am trying to configure WireGuard on remote Ubuntu 22.04 server executed the following commands on the Server

sudo apt install wireguard

Created private and public key on Server

wg genkey | tee privatekey | wg pubkey > publickey

created the configuration file /etc/wireguard/wg0.conf

[Interface]
PrivateKey=+******n1+uTWXU=
Address=10.0.0.1/8
SaveConfig=true
PostUp = iptables -A FORWARD -i wg0 -j ACCEPT; iptables -t nat -A POSTROUTING -o <public-interface> -j MASQUERADE;
PostDown = iptables -D FORWARD -i wg0 -j ACCEPT; iptables -t nat -D POSTROUTING -o <public-interface> -j MASQUERADE;::
ListenPort = somePort

when I enable the wg0 interface with the following command

wg-quick up wg0

It says "public-interface: No such file or directory"

root@srv173:~# wg-quick up wg0
[#] ip link add wg0 type wireguard
[#] wg setconf wg0 /dev/fd/63
[#] ip -4 address add 10.0.0.1/8 dev wg0
[#] ip link set mtu 1420 up dev wg0
[#] iptables -A FORWARD -i wg0 -j ACCEPT; iptables -t nat -A POSTROUTING -o <public-interface> -j MASQUERADE;
/usr/bin/wg-quick: line 295: public-interface: No such file or directory
[#] ip link delete dev wg0
root@srv173:~#

What is wrong with my configuration?

  root@srv173:~# 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: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel  state UP group default qlen 1000
  link/ether 00:16:3c:d2:2d:42 brd ff:ff:ff:ff:ff:ff
  altname enp0s3
  altname ens3
  inet 198.244.224.67/32 brd 198.244.224.67 scope global eth0
   valid_lft forever preferred_lft forever
  inet6 2001:41d0:800:400e::de7c:4d7f/64 scope global
   valid_lft forever preferred_lft forever
  inet6 2001:41d0:800:400e::9cfb:78a5/64 scope global
   valid_lft forever preferred_lft forever
  inet6 2001:41d0:800:400e::6f9c:586e/64 scope global
   valid_lft forever preferred_lft forever
  inet6 2001:41d0:800:400e::30e6:4cdf/64 scope global
   valid_lft forever preferred_lft forever
  inet6 fe80::216:3cff:fed2:2d42/64 scope link
   valid_lft forever preferred_lft forever


  root@srv173:~# netstat -ni
  Kernel Interface table
  Iface      MTU    RX-OK RX-ERR RX-DRP RX-OVR    TX-OK TX-ERR TX-  DRP TX-OVR Flg
  eth0      1500   188775      0      0 0        129368      0      0      0 BMRU
  lo       65536       59      0      0 0            59      0      0      0 LRU
FedKad avatar
cn flag
Did you replace the string `<public-interface>` with the **real (public) interface** of the system? Use the `ip a` or `netstat -ni` command to find the interface name.
elk avatar
cn flag
elk
Could you be more spesific how should I replace the string <public-interface> with the real (public) interface of the system? I uploaded output of ip and netstat -ni
elk avatar
cn flag
elk
I replaced the <public-interface> with eth0 in wg0.conf and it solved the problem ! thanks to FedKad
Artur Meinild avatar
vn flag
I assume you're using 22.04, unless proven otherwise..
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.