I have created a “Ubuntu” droplet and have installed “Wireguard” I have it working fine where I can connect to it from my PC and the tunnel works.
I have a small “Gli Net” router where you can load the VPN details onto it and connect to the “Droplet” this also works.
I have one device that is connected to the LAN port of this router and it’s issued an IP address (VPN) but the port is “restricted” when I run Nmap from a Raspberry Pi on my network.
pi@raspberrypi:~ $ nmap -Pn -p 44158 18.104.22.168 --reason Starting Nmap 7.70 ( https://nmap.org ) at 2022-04-09 12:43 BST Nmap scan report for 22.214.171.124 Host is up, received user-set. PORT STATE SERVICE REASON 44158/tcp filtered unknown no-response
I’m a little new to hosted VPS servers, it’s good fun learning, I know there are “IPTables” and also “UFW” and I also notice that you can do “Firewall” settings via the Digital Ocean dashboard.
This is my UFW status
Last login: Sun Apr 10 10:19:20 2022 from 126.96.36.199 root@ubuntu-s-1vcpu-1gb-lon1-01:~# sudo ufw statusStatus: active To Action From -- ------ ---- 51820/udp ALLOW Anywhere OpenSSH ALLOW Anywhere 51820/udp (v6) ALLOW Anywhere (v6) OpenSSH (v6) ALLOW Anywhere (v6) Anywhere on eth0 ALLOW FWD Anywhere on wg0 Anywhere (v6) on eth0 ALLOW FWD Anywhere (v6) on wg0
and this below is my wg0.conf
[Interface] Address = 10.0.0.1/24 ListenPort = 51820 PrivateKey = xxxxxxx PostUp = iptables -A FORWARD -i %i -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE PostDown = iptables -D FORWARD -i %i -j ACCEPT; iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE PostUp = ufw route allow in on wg0 out on eth0 PostUp = iptables -t nat -I POSTROUTING -o eth0 -j MASQUERADE PostUp = ip6tables -t nat -I POSTROUTING -o eth0 -j MASQUERADE PreDown = ufw route delete allow in on wg0 out on eth0 PreDown = iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE PreDown = ip6tables -t nat -D POSTROUTING -o eth0 -j MASQUERADE [Peer] PublicKey = xxxxxx AllowedIPs = 10.0.0.2/32
I’m just kind of stuck on how to open the Port and not sure where to add it?
I was thinking of using something like the following to then add it to “IPtables”
Would any one be able to help?
Many Thanks :)
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Click below to sign up and get $200 of credit to try our products over 60 days!
Enter your email to get $200 in credit for your first 60 days with DigitalOcean.
You can use the following command in your terminal to open the port:
This will allow traffic to pass through that port via your firewall rules. Keep in mind that you should only open ports that are necessary for your setup and always follow best security practices.
For more information on working with firewalls on DigitalOcean, you can refer to these documentation pages:
UFW: How to Set Up a Firewall with UFW on Ubuntu 22.04
DigitalOcean Cloud Firewall: DigitalOcean Firewalls Remember to check your software’s documentation for any specific configuration changes needed for your use case.
Hope that this helps!