Question

Could someone help me open TCP 44158 ? (Wireguard Installed)

Hi,

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 178.128.167.230 --reason
Starting Nmap 7.70 ( https://nmap.org ) at 2022-04-09 12:43 BST
Nmap scan report for 178.128.167.230
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 162.243.188.66
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”

https://www.perturb.org/content/iptables-rules.html

Would any one be able to help?

Many Thanks :)


Submit an answer


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!

Sign In or Sign Up to Answer

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.

alexdo
Site Moderator
Site Moderator badge
May 31, 2023

Heya,

You can use the following command in your terminal to open the port:

  1. sudo ufw allow 44158/tcp

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!

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

card icon
Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Sign up
card icon
Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We’d like to help.

Learn more
card icon
Become a contributor

You get paid; we donate to tech nonprofits.

Learn more
Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow – whether you’re running one virtual machine or ten thousand.

Learn more ->
DigitalOcean Cloud Control Panel
Get started for free

Enter your email to get $200 in credit for your first 60 days with DigitalOcean.

New accounts only. By submitting your email you agree to our Privacy Policy.