static public IP address

January 4, 2024, 17:38

k9t33n

I need a static public IP address but have no clue where to begin. I need this for a wireguard vpn, it will be set up on a pi 4 along with wireguard and will be used not only to encrypt my data when I'm not at home but also allow me to access my pi and let my pi hole block ads for me even on the go. any help is appreciated so thank you for even reading this. once I have this set up I feel like life's sorted for me lol 😂

kutuptilkisi

1. Use a tunneling software 2. Buy static IP from your ISP

kutuptilkisi

there is no other way afaik

kutuptilkisi

tbh i would just use cloudflared

kutuptilkisi

tho you need a domain for that

kutuptilkisi

or you can set up a rathole server on a remote dedicated

k9t33n

whats a tunneling software? oh and im also attempting to do this the free way if i can

k9t33n

oh wait it looks like wireguard sets it up for you?? idk ill just test it and report back

k9t33n

should i do this? i dont even think my phone has ipv6 which is what ill use it on

k9t33n

im just gonna press yes

k9t33n

ok i did etherything and it seems promising but when i install the app and add it via the qr code i cant access the internet

kutuptilkisi

ngrok, cloudflared, playit.gg, rathole and such

kutuptilkisi

you open some ports to internet

jannik44

clarify first: do you want a static ip on a device in your network or do you want a public static ip?

k9t33n

I think I solved that. but if you have a solution just to make sure I want a static public IP so when I connect the VPN it doesn't change on me. apparently I need to do that

jannik44

public or private static ip?

k9t33n

or if I don't you tell me, I really have no clue what's happening lol

k9t33n

public

k9t33n

*apparently

k9t33n

do I need that for wireguard? I guess that's the first question to ask

jannik44

rent a 1$ vps and setup rathole

k9t33n

is there any free option? remember I can't work yet so not much option for like a subscription

k9t33n

and I really don't want to link my credit card to anything rn

jannik44

you cant afford 1$?

jannik44

im sorry for you...

k9t33n

I can I thought you meant it's a subscription?

jannik44

1$ a month yea

k9t33n

oh not bad at all

k9t33n

ok how do I get that?

k9t33n

is this like a website?

jannik44

yes, something like this

jannik44

there are a lot of cheap vps offers out there

k9t33n

any specific one? can you recommend some? especially one you have used and know how to use so then it's easier for both of us

jannik44

i have used the 1$ hostvds one, can recommend https://hostvds.com/#cloud

jannik44

other than that i currently also use contabo (not so good, cant recommend)

jannik44

and alexhost (good, can recommend but expensive)

k9t33n

ok so I paid, do I create a new instance now?

jannik44

yes

k9t33n

oki dokie

k9t33n

any preference I should have on the image?

k9t33n

<@661583386992836619> I'm in ssh, I chose cent os because it's lite. what do I do now?

jannik44

not sure about centos

k9t33n

I thought you said you have it on a docker image because it's so lightweight?

jannik44

but first change ssh password to Something secure And block all ports is always the first step

k9t33n

how do I do that?

k9t33n

never mind just saw you said alpine 😭, well that wasn't an option

k9t33n

the video you sent me suggested cent os. idk it was the first one and they're all just Linux right?

k9t33n

I can change it if you want?

jannik44

your choice

k9t33n

these are the options

jannik44

choose whatever you want

k9t33n

I am not informed enough for this

k9t33n

eh I'm gonna go with debian, it's the safe option ig

k9t33n

ok Im in again, how do I do this?

k9t33n

I've already changed the password

jannik44

standard ufw setup

k9t33n

wait I just realized, did you get me to get this so I can run wireguard there?

k9t33n

thanks but that kinda defeats the purpose of why of this. using my pi it will also let me use pi hole anywhere and with the static IP I can ssh from anywhere. so is there any way I can do this on the pi itself?

thunder07337

Yes, with a domain and dyndns.

k9t33n

may you explain a bit more?

thunder07337

You can have the domain providers refer to your public IP so that requests to the domain are automatically sent to your public IP. Because the IP changes and you don't want to manually enter a new one every day, dyndns is used. There are scripts that query your public IP and then communicate this to the provider of your domain. This way, the correct IP is always set automatically.

k9t33n

oh im happy with that, so how do i do it?

k9t33n

<@348421858519154699>, what should i do first?

Pantner

ok, so. going through the process for a hosted VPS is waaay overkill in most cases. The easiest way to get this working with a dynamic public ip address is to use a DynamicDNS provider. There are heaps of them. I've seen a number of modem/routers that have the option built in to them. You just sign up with the free DynDNS service, input your login details in the correct area on your router and it'll handle it for you. Some will have a client you can download and run on a computer that checks the IP every hour or whatever. The PiVPN even has an area talking about them and it looks like basic instructions for a client to use. https://docs.pivpn.io/faq/ Now, the one issue with this is if your internet connection is on CG-NAT. This is very common with 4G/5G connections and on the home plan of Starlink. Do you know what your internet connection is?

oops.se

You have a third option, Dynamic DNS, yes it is not a "static IP" but it will fulfils the goal of having a device that is reachable from public internet.

Pantner

as per the screenshot in general, it is even built into the router

Pantner

but as i mentioned above, if you're on CG-NAT that won't help. Sometimes you can be asked to be removed from it by your provider.

oops.se

Carrier Grade NAT is a PITA. And I don't really know how that could be allowed in IMS! But the telephony world is a beast that I have tried to fight against my hole life.

Pantner

well, apparently we're running out of IPv4 addresses... again?

Pantner

but realistically, for most people it doesn't make a difference. If you all need to do is e-mail, youtube, play games on your phone and watch netflix, who cares?

k9t33n

ok i think ive done it

oops.se

Yes, I agree why would anybody be annoyed by being limited to just email, youtube and gaming. Lets make all to passive consumers as it was in the good old days.

k9t33n

ok i did etherything but its still not working. im gonna take a break from this project and get back t it later

thunder07337

What exactly did you do?

k9t33n

linked it to a domain and reconfigured wireguard to use that domain then port forward it like you said in the imager

thunder07337

So I didn't write anything about wireguard, because I don't know how to set it up. I only said what is needed so that the domain always points to the public IP of the router. Have you set up the dyndns?

Pantner

if you ping the dynamic dns hostname does it resolve to an IP address? and is that your public IP address?

k9t33n

yes

k9t33n

do you mean if i search it up in the browser?

Pantner

i mean ping it, from the terminal/cmd

Pantner

ping my.dyn.hostname.com

k9t33n

ah ok

k9t33n

wait is that the domain or hostname of the pi? sorry ig im realy new to this

Pantner

my.dyn.hostname.com is that not obvious enough?

k9t33n

oh btw the site i set this up from is no-ip

Pantner

the dynamic dns hostname you set up

k9t33n

oh yeah sorry lol

k9t33n

ok it does give a ping back but the ip is not the same as my pis public ip

Pantner

not you pi, your internet connection

Pantner

you pi doens't have a public ip, it has a private ip

Pantner

your internet connection has a public ip that your internet provider allocates you

k9t33n

so do i check my routers?

Pantner

you can do that, or just google "what is my IP" and it should tell you

Pantner

or something like speedtest.net

k9t33n

i checked my public ip with curl -s https://icanhazip.com, google says this is how to check

k9t33n

im on headless. but i do have speedtest-CLI ill test

Pantner

google literally tells you in the search results

Pantner

nothing of this needs to be done on the pi, this is any computer on your home network. Everything has the same public ip because everything is connected to the same internet connection

k9t33n

oh i can do this on any? oh im so dumb

k9t33n

ok it is the same then

k9t33n

thanks for dealing with me btw ik im dumb

k9t33n

what do i do now?

k9t33n

now that i know that works

Pantner

does it?

k9t33n

yes my public ip is the same as the one that comes up when i ping the domain

Pantner

great

Pantner

and you've forwarded the VPN port in your router to your Pi's PI Address?

Pantner

then go back to this part of their website https://docs.pivpn.io/faq/ scroll about halfway down until you see How do I troubleshoot connection issues? And start looking at that. There is a test you can run that does checks for you. You'll likely need to update the config with your new hostname, etc

k9t33n

okay will do

k9t33n

double checking now

k9t33n

ok now im unsure whether ive done that

k9t33n

let me go back to your tutorial to check that

k9t33n

hmm it doesnt really say

Pantner

?

Pantner

i'm not sure what 'it' is or what it 'doesn't say'

k9t33n

about port forwarding

Pantner

that can't tell you how to do the port forwarding, it's in your modem/router that you do it

k9t33n

i found it but what do i put for the external and internal port stuff

Pantner

thats the port that you're using for the VPN

k9t33n

yeah i know everythings different, its stupid

Pantner

in the config file that website shows it has a port number, what is yours set to?

k9t33n

? im setting a port forwading rule. i set it to my pi and just named it so far

Pantner

in the website i've linked to you multiple times already

Pantner

that i just told you to look at

Pantner

it talks about editing a configuration file

Pantner

that contains the port number you need

k9t33n

oh i set it to 22 i think because thats the one i think my pi uses

k9t33n

yeah i know it

k9t33n

i just didnt know thats what your talking about

Pantner

port 22 is reserved for ssh

Pantner

don't use that

k9t33n

oh damn, should i switch it to 80?

Pantner

multiple things can't use the same port

Pantner

no

k9t33n

is there a one thats free?

Pantner

did it offer a default port?

k9t33n

i cant remember

Pantner

use the one that is in the example on the website i linked to

k9t33n

ok i think that was 80

Pantner

no

Pantner

80 is the port used for websites

k9t33n

i rememberd wrong then

Pantner

good thing is you don't need to remember, click the link, scroll down the page and you can see it

k9t33n

yeah im doing that now

k9t33n

> [...] > IPv4dev=eth0 <--- Network interface you have chosen > > IPv4addr=192.168.23.211/24 <--- IP address of the Raspberry Pi at the time of installation > (only consider the 192.168.23.211 part) > > IPv4gw=192.168.23.1 <--- Gateway IP, which you will type into a web browser to open > the management interface > > pivpnPROTO=udp <--- Protocol you need to use in the port forwarding entry > > pivpnPORT=1194 <--- Port you need to forward > > pivpnHOST=192.0.2.48 <--- Public IP or DNS name your clients will use to connect to > the PiVPN > [...] doea that mean the ports 1194?

Pantner

yup

Pantner

well, i'm guessing thats the default port. If you set yours to 22, you'll need to update your config

Pantner

and anything else that isn't correct

Pantner

as i said above, you'll need to put in your dynamic host name to that too

k9t33n

yeah

k9t33n

this is gonna take a while, ill get back to you when somethign happens

k9t33n

not sure if i can tell you this but the default port for me is "51820"

Pantner

how did you determine that?

Pantner

ok, after googling it, seems that is what wireguard uses as it's default

Pantner

so, if that is what your config is set to, then use that as each of the 4x port numbers in the forwarding, and then you'll need to set UDP or TCP, that is also in your config

Pantner

after all that, give it another go

Pantner

but as i said, there is a command that will do a test, use that first and see if it shows any errors

k9t33n

yeah i found that before with pivpn -h it said is solved something for me

k9t33n

is there any preference for these? my router can set both at the same time apparently

Pantner

the setting in your router is just telling it what kind of packets to expect. Set it to both and that'll be fine

k9t33n

okay then

k9t33n

YAASSSS ITS WORKING!

k9t33n

thank you so much, i know i was a pain but you were so helpfull

Pantner

awesome, thats great

k9t33n

just a question before I close this thread. how encrypted is my connection now? like with a normal VPN it encrypts what searches you make so If you use a public WiFi they can't track you at easily right. along with changing your location ofc. does this do the same thing? I just mean does it have basic level encryption?

kutuptilkisi

tbh i would just use cloudflared

kutuptilkisi

it works really good

k9t33n

yeah I'm intrigued by what it offers. I haven't checked the prices yet but the service sounds really good

kutuptilkisi

cloudflared?

kutuptilkisi

it is free

kutuptilkisi

tho you need a domain

k9t33n

I mean I got a domain from no-ip. can I just put that in there and it will give me all those sweet cloudflare features like encryption, ddos attacks (even tho I won't use it) and stuff

kutuptilkisi

if you can set your name servers to cloudflare yes

k9t33n

for free?

kutuptilkisi

yea but as i said, you need to be able to set your ns to cloudflare ns

k9t33n

I'll look into it

Pantner

you don't have a domain from no-ip, you have a hostname that they control

k9t33n

yeah i figured that out and went around searching for cheap domains

k9t33n

https://www.ionos.co.uk/domains/co-uk-domain would you say buying a random one from here is a good choice? 1$ for a year

jannik44

you can also use free domains

jannik44

freenom.com

jannik44

but they are weird

jannik44

be prepared

k9t33n

so i would actually own that domain so i can add it to cloudflare?

k9t33n

also wdym by weird?

kutuptilkisi

<@1071178789939331253> tbh just get yourself a .dev domain

kutuptilkisi

which is cool and usually cheap around 5$ for one year

kutuptilkisi

maybe 10$

kutuptilkisi

tho i pay 2.3~ for a year

k9t33n

im looking around, about to buy one

k9t33n

okay i set that up

k9t33n

last question: is there any way to test the security of this and the encryption? because ig im not so confident in this until ive seen it for myself

k9t33n

also thank you for everyone who helped its been great. ive never seen so many people contribute to a thread here!

k9t33n

ok nvm I did some research and I'm happy with the result

k9t33n

thank you yet again for everyone in this thread. id just like to let you all know that you made my day ig lol