Giter VIP home page Giter VIP logo

Comments (1)

rajannpatel avatar rajannpatel commented on June 12, 2024 1

I think it's better to use a static IP, always. On Google Compute Engine a static IP does not cost you anything, it is part of the Free Tier if you provision one on their Premium Network. That said, not everyone is running this on Google Cloud - so I'm thinking out loud:

If your server is directly being assigned a public IP address, you can fetch the public IP on demand with this command. There is no network traffic associated with running this command:

ip addr show dev $(ip -4 route ls | grep default | grep -Po '(?<=dev )(\S+)' | head -1) scope global | awk '/inet / {split($
2,var,"/"); print var[1]}'

If you are behind a DHCP server, such as a router in your home, or in Google Compute Engine, you will not get your public IP address with the command above. You would instead see the IP address served by your DHCP server. I think the quickest way to get your public IP address is by probing a DNS server:

dig TXT +short o-o.myaddr.l.google.com @ns1.google.com | awk -F'"' '{ print $2}'

You could store the output of the dig command into a text file or environment variable, and compare the subsequent outputs against the contents of the file. When a change is detected, you could trigger your dynamic DNS software to update the DNS record of a domain you own.

Because DNS updates take time to propagate, when you have an opportunity to use a static IP for your VPN server, you should.

from pi-hole-on-google-compute-engine-free-tier-with-full-tunnel-and-split-tunnel-wireguard-vpn-configs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.