Host A Game Server When Your ISP Doesn't Want You To - NGROK

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
so you've set up a game server like a minecraft server maybe from watching my minecraft server video and it works on your local network but when you've tried to set up port forwarding so that you can play with friends on the internet you ran into some issues maybe your isp uses cgnat and you aren't able to get a public ip address or they block or restrict port forwarding on your router or maybe you just don't want to open up your firewall to expose a server to the public well today we're going to solve all of these issues using a service called ingrock and the best news we're going to do it completely for free stick around to see how [Music] ingrock is a secure tunneling service which basically means there's a secure connection or tunnel between your computer and ingrock servers and then when someone makes a request on a specific url and port to ngrok's servers that gets tunneled back to your computer but essentially it lets you run a public server on your home network without having to open any ports on your firewall if you're curious to know more about how this works you can always visit the ngrok website ingrock has a free plan that we'll be using today but this unfortunately has one really big pitfall every time we restart the ngrok service our url for our server will change to a new random url meaning none of your friends will know how to connect to your minecraft server in this video though i'm going to show you how you can use a linux server like the one i used in my minecraft server video to run ngrok automatically whenever the system boots up and also post a message to a discord channel if your server url changes to get started you'll need a working minecraft server or other game server that only uses a single port and then a pc running some form of debian linux with docker installed and running this can be the same machine that's running the game server or a separate pc on your local network if you're confused about the whole linux and docker part don't worry just check out my minecraft server tutorial that should be linked in the description in that video i show you how you can install ubuntu server and docker onto an old pc and that's the exact same system i'll be using in this video if you want to use something other than ubuntu server that should be totally fine as long as you can get docker installed i even ran this same exact setup on a raspberry pi zero just to test it out but know that there might be a few commands in this video that work differently if you use a different linux distro if you're unable to use linux and instead have to do this on windows that's not a problem and i'll still be able to show you how you can run ingrock to get to your server over the internet but i won't be able to show you how to have it run automatically or update discord if the url changes at least not in this video let's go ahead and get started okay so right now i am ssh into the minecraft server we did in my previous minecraft server video so if i type in docker ps and you watch that video you should see these same two containers we set up one for our minecraft paper server and the other for dug dns but for this we're not going to be using this duck dns because we're going to be using ngrok or ng ng rock in grok not entirely sure how to pronounce it i think it's ingrock though but i'm going to call it ngrok for now but yeah we're going to be using ngrok to expose our minecraft server and if you didn't follow my tutorial that's not a problem basically you just need to have a minecraft server running on your local network that you can access but anyway if i actually open up minecraft right now and i go to multiplayer here i have this minecraft server local and if i go to edit you'll see that i just have my local ip address which is 192.168 and this server works if i log into this we can see that our server is running i'm up on top of this tree it is night time and yeah our server works but it's only accessible from our local network which is not super fun so we're going to use a cool thing called ngrok so if i open up a web browser here and i just google search in grok or ngrok i keep saying it different ways sorry but if we just search ngrok we can go to the website and we're going to say get started for free and here you can go ahead and sign up i'm going to do that off screen i'm pretty sure you can figure out how to create an account so go ahead and create an account and i'll meet you here in just a second okay great so at this point you should be at this screen here or we'll see a few things including how to where we can download ingrock as well as set it up if you're doing this on windows i can actually go ahead and show you we can click download for windows and if we open up our downloads here we'll see this zip file and we can just extract that here in this folder if we just run this ingrock.exe hey this is futurecolton here i actually forgot a step so i'm just going to mention it now before you run the command that i'm about to run head back over to the ingrock website and find step two of the setup which should include an ngrok auth token command you can copy that entire command including your auth token that i have blurred out and then right click to paste it into the terminal and hit enter and that will set up your auth token that you need to have before you can run this next command all right back to the video we should land in this terminal here and i can actually just type in ingrock tcp 192.168 which is my minecraft server local ip and then colon 25565 we hit run we should get this cool little interface here and if i highlight this right here and i right click it to copy it and i go back to minecraft and i hit add server i'm going to call this windows and grok and i'm just going to paste what we just copied there i'm going to cut out all that tccp uh this sorry oh my gosh i'm going to cut out all the tcp colon slash and just starting at that first digit and i hit done and right now i can actually access my minecraft server over the internet i am not accessing this on the local network this is being tunneled through ingrock which is pretty cool the problem though is if i go back here and i hit control c to quit you see i immediately get booted from this but that makes sense okay we we stopped the tunnel let's just do it again we type the same command and if i go here and try to access my server again well it's not going to work because if i go back to edit and i look at this server address and compare it to what we have right here it's different this server address has changed and it will change every time this service this ingrock application gets restarted meaning if our computer restarts or we just close this window that's not fun but there's a way to fix that but unfortunately i'm not going to be doing that in windows i'm going to be doing that in linux so hopefully you can follow along with some sort of linux machine i'm going to be using ubuntu server if you want to watch my minecraft video i did before you can do that and follow along if you have an extra pc lying around or something like that but for now i'm gonna quit this i'm gonna hit cancel i'm just gonna delete uh we'll keep it there for now it just won't work okay back to the good stuff so back here in linux we could do the exact same thing we could do something like snap install in g-rock ingrock whatever oop sudo okay so that's installed so technically we could do in-grok tcp and we don't actually have to do the ip address because the ip address this is the machine that the minecraft server is running on so we can just do 25565 hit enter and then same thing we could copy this now let's just do it let's right click to copy go in here we'll do add server we'll call this one ubuntu paste gotta get rid of this slash hit done and it's working once again as we expected it to that's not a surprise but this still doesn't solve our problem we still have the issue of this is going to every time we just hit ctrl c to get back to our terminal this is going to break and no longer work anymore which is not fun that's not good so we're going to do something a little bit different first of all i'm going to do snap remove ingrock sudo that way we have a nice clean slate to work with i'll go ahead and hit clear what we're going to do instead is we're going to set this up to run as a service so that it will run 24 7. um even if we restart our machine it'll automatically restart in g-rock and then i'm going to do something kind of cool so that anytime this ip address does change which it will there's not really a way to fix that unless you want to pay quite a bit per month every time this ip address changes or this url changes we're going to have something that will automatically post to discord so we'll get to that later but first we want to set this up as a service and a really easy way to do that if we go down here to google chrome put up a new tab and we're just going to google ingrock systemd and the first thing that should come up here and i'll have this link in the description by vincent su i believe is how it's pronounced we have this really cool thing that we can run that will automatically install ingrock and set it up as a linux service just to make this process really really easy but to copy this we're going to need a few applications we're gonna need some some packages installed on our linux server so we're gonna go back here we're gonna run sudo apt update and we can actually just go to ampersands and then sudo apt up grey let's see if this works my linux skills are not the best and then we'll do dash y i think this should work this should update and upgrade all of our apt packages should update our repositories and then upgrade all of our packages i'm getting better at linux guys slowly but surely okay and this might have taken a few minutes but now that it's done i'm actually going to hit clear or type clear and explain what i just did because i realized i didn't do a very good job of it so sudo is super user do and then apt update like i said is going to update all of our app repositories the two ampersands are just going to do that command first and then follow that command with our second command which was sudo apt upgrade which is actually going to install all the updates to all of our packages and the dash y is just going to automatically hit yes for any of the prompts so i just wanted to explain any commands i do just to kind of help so now we're actually going to use apt and these new repositories we have to install some stuff we need so we need to do sudo apt install get and you can type a space zip space jq and i think that's it so you can just type those three in hit enter i should already have get installed we can hit y so you may already have some of these installed but we just want to make sure all three of these are installed cool now that we're done we can go back to google chrome to this git repository and where it says code under https we can hit copy and then back in here we can type git uh we'll make sure we're in our home directory first so i'm going to do cd or change directory and we can just put the little tilde or we can type slash home slash your username which for me is haven we could also do like i said cd little tilda and then we should be in our home directory so here i can type get clone so we're going to clone this repository we can right click hit enter and then now if we type ls or list i i think that's what it stands for we should see we have this directory here system md md-ngrok so if we go into that so cd or change directory system md or sorry system d slash ingrock ng rock i keep saying that differently i apologize but if we cd into that and then type ls again we should see all of this cool fancy stuff so here we're going to edit one thing and that's this ingrock.yaml and before we do that i actually think it's safe to make a backup of this default file here this is our configuration for ngrok so if we type nano which is just a text editor and then we do ingrock.yaml this is the how it's configured already and so under here auth token this is part of this script this is a kind of a variable here so our auth token is going to get dropped in place here but the rest of this we can come back and edit and we will but before we do that i'm going to hit control x to exit i'm going to type cp and then ingrock.aml and then ingrock dot bckp or backup dot really doesn't matter what you call this but basically we're going to copy that file into a different file called ingrock.backup.yaml so now if we type ls we should see that we have this backup here and so that's if we mess up anything in this yaml we do have a backup we can default to not that big of a deal but you know sometimes it's safe with configuration files i like to do that now that we can go nano and grock.aml again and we're going to change some things we're going to keep this auth token exactly as it is under region we can change this for me i'm going to change it to us we're going to make a new line here and we're going to type in web underscore addr or web address and then a colon and then here you need to type in your ip address your local ip address for your server so 192.168.1.138 for me and then a colon and 4040. so what this is is when we run ingrock there's actually a web server that it runs that you can access on that machine to see information about all of the tunnels that ngrok is running and this is how we're going to be able to automatically update discord so we need to make sure that this web address is not the default which is just localhost because that's going to make it to where we can't really access this from a different machine or a different container or from our docker container don't worry about it just go ahead and type in your local ip address and then colon 4040 or port 4040. under that i'm actually going to type in log colon and then home or slash home slash your username and then i'm going to type in ingrock.log and so this is going to create a log file in our home haven directory that will log information in case there's anything weird going on with ingrock so we can see that that's completely optional by the way you don't have to do that but yeah i'm going to do that now down here under the tunnel section i'm going to delete all of this we still need to keep this tunnels here but we're going to make two spaces underneath that and then type in mc and this is just the name of our tunnel so we're going to call it minecraft i guess and then now four spaces on the next line we're going to type in addr or address and two five five six five which is the port that minecraft uses and then another four space is underneath that and we'll type in proto or protocol and this uses the tcp protocol for minecraft uses the tcp protocol so we should be set at this point so we can hit control x it's going to prompt us to save we can type y and then we can hit enter again to save the file and if we were to type in cat or c-a-t i don't know the actual pronunciation of that but c-a-t and then ingrock dot yaml this will just print out our file and we should see that it's all updated now so now we can type in sudo dot so that way we're in our current directory slash and then install.sh and this is going to run this script um be a little bit careful running scripts that you download off the internet i actually went through and looked through the the entire script everything that was in this to make sure nothing was sketchy but if you're not entirely sure be cautious running scripts but if you trust me and you trust this person hit enter ah i made a crucial mistake here we need our auth token here this command this script here takes an argument which is our auth token so i'm going to go back over to our ingrock website here and you can either copy it down here i'm going to have it blurred out or you can go up here to auth token and then hit copy got a lot of blurring to do here and so we're going to type in our same commands of sudo dot slash install.sh a space and then you can right click to paste and then now we hit enter and it should run this script for us which is going to install ngrok as well as set it up as a service and so now we can actually type in system ctl or control or cuddle is like to say status in g-rock and we should see this nice active running goodness here and that is what we want that is exactly what we want if you don't see this if you see some errors go back to your ingrock.yaml and make sure that that is all correct and there's not any weird punctuation errors or spacing errors and then after that you can go so if we go back to our folder here we have this install.sh script we also have this uninstall.sh so what we could do is type in sudo dot slash uninstall.sh run that we could go in and make any changes to if there was an error for some reason in our ingrock.yaml we could type in nano and grock.yaml we could go and fix this hit control x and then you'd have to hit y again and then enter to save and then now you can go back you can hit the up arrow by the way to go look at previous commands you typed in so you could go up to sudo dot install this whole command you ran with your auth token hit enter and then hopefully if we go back to system control or system cuddle status ingrock we should see this active running so we're going to hit clear here okay so with our system running we can actually check that it's working because you notice now we don't have that window that pops up showing us our public url that ingrock provides because it's running in the background as a service so one thing we can do is we can type in curl and then our ip address colon 4040 that web address i was talking about earlier and then we're going to type in slash api slash tunnels and if i were to hit enter here we'd kind of get a whole lot of nonsense and that's not very helpful so i'm going to type the exact same command again i'm going to hit space and i'm going to type in this little bar i don't even know what this is called that's embarrassing i don't know what this this this thing is called so i apologize let me know in the comments what that's called i should know and then we're going to type in jq which is that program we installed earlier the package we installed earlier trying to get better at linux here sorry and then we're going to type in dot tunnels and then we're going to do brackets 0 and so what this is doing is this is making a json query so we're getting jason back from this request we make to our web server so this curl command is it's going to make a request to the web server we're going to get jason back which if you're not sure that is just ignore this next part it doesn't matter but if you do we're making we're going to parse the json that's coming back so we're looking at tunnels and then we're taking the first item in that list that array trying to make sure i have my json right we're taking that first item and so if we hit enter we should see this nice pretty stuff here where we can see this public url which is what we're used to seeing we can right click that to copy it go back to minecraft and we're going to edit our server here and at this point we really shouldn't be surprised when this works look at that so this is pretty cool and just to prove that this works we're going to disconnect we're going to go back to our server and i'm going to type in sudo reboot and that is going to restart our server and once it comes back online we should see that ingrock is going to start automatically okay so we're back in our minecraft linux server here if i type in system ctl or system cuddle or system control whatever you want to call it status ingrock we should once again get this nice active running but if i go back and run our curl command we'll see that once again this has still changed there's no way of really getting around this unless you want to pay quite a bit of money to fix it so if i go back in here like we could do this again just keep this running that's kind of what we have to do um so right now it's working oh yep it's working i kind of got nervous for a second there um so this is as long as the server keeps running 24 7 it doesn't crash or anything this shouldn't change but in the event that it does change it would be really cool to have a a good way for you and your friends to know that it changed and that you need to update that url so we're going to do something kind of cool here discord if i open up discord here i have this minecraft url text channel and if i write or if i just left click here where it says edit channel if you go to integrations and here where it says web hooks you can hit create web hook and we're going to call this just mc server um yeah and we're going to save changes and copy this webhook url that's really important and we're actually going to just open up notepad really quick and i'm going to just paste this url here into our notepad great now though we're going to run a cool little docker container that i actually made we can google it maybe we'll see what happens if we google it should be public i just made it so maybe we have to go to whatever all these descriptions all this stuff will be in here all right yeah so if we go to docker hub and we just search ingrock to discord you can see hardware haven just made this two hours ago has this cool docker container here that you can run and so there's some some stuff here we're actually going to copy this cli but basically this is going to just run 24 7 and any time our public url changes from ingrock it'll send a use webhooks to post an update and discord so we're going to open up our notepad here we're going to go down a few spaces we're going to hit we're going to paste this in here so we can keep this name so this is docker runs this is going to run our docker container d means detached so it's going to run in the background this is just the name where it says api url here this is where we need to put in our 192.168.1.138 or whatever your api or sorry whatever the ip address is for your local machine that you're running this minecraft server on where it says web hook url this is what we're going to delete this and we're going to copy this thing up here and put it where it says web hook url now here it says update user this is optional um you could change this to so that it could display whenever this gets posted in discord this would just change the the user so i'm actually going to call just for funsies we'll call this hardware haven i can't spell hardware haven and then update message you can do a custom message like the server changed i don't know you could do whatever you want there's a default for both of these you can just leave it blank where it says loop interval we can update this to make it like 10 seconds 30 seconds is probably fine i wouldn't really go that much faster because it's going to be doing a little bit of extra processing for no reason and then log level um we'll keep this at info for now you can change this to error or warning if you want to be able to see the logs but only see the important stuff and then we'll make sure this restart unless stopped is on that way this will if for some reason this crashes it'll just restart and keep going and then this is the name of that image the hardware haven slash ingrocked to ingrock to discord so we can copy this entire command here and we should be able to go back into our server because we have docker setup right click hit enter and man we're just going to hop with the best here [Music] okay i'm kind of silly i'm not sure exactly which one caused it but it's smart to go in here and put all of these strings of text and double quotes at least the ones that have all these weird characters because it's possible that those can throw some weird things at docker i think it probably was something in here or these exclamation points i'm not entirely sure that if we put quotations or double quotes around these strings and you know we can put it here to be safe as well and even up here why not just make sure you have double quotes around all of your environment variables here so we'll select all this copy go up here right click to paste hit enter and now we're really going to hope for the best okay this looks good okay so now if we type in docker ps we should see our minecraft server our dns we're not using anymore as well as this hardware haven and grok to discord and so if we type in docker logs ingrock to discord we should see that it's starting and because our ngrok is running we have this new public url found and it posted a discord and if we go to discord we should see haha yeah i don't know what happened here you know what you know where there's bug fixes about there's there's plenty of bugs to be fixed here we're going to go in we're going to get rid of these two arguments just yeah we'll just cut those out and we'll select all this we'll copy we're going to go back up here we're going to run docker stop and grock to discord we'll do that we'll stop it once it's stopped we can go back and run docker remove and graph the discord and we're going to post this command in without those extra arguments because it kind of it kind of broke it so just don't do that just keep it simple keep it simple stupid right so now if we go docker ps we should see we have these running and if we go back to discord we can see we have a new server url and yeah look at that so just to test it we can go back here we can say system ctl control cuddle whatever stop and grock [Music] type my password and then now if we were to go system cuddle status ingrock we could see that it's stopped it's not running so we can go system cuddle start ingrock type in my password status we see it's running and we see we just got a new post here on our discord server showing our new ip address and if we copy the we want to get rid of that tcp colon slash we can copy this go to minecraft we'll update our server here because if we refresh we'll see that it's not working because our ip address changed or our url changed we can go in here and we're going to change this address to our new one hit refresh and look at that now all of our discord buddies know what our new minecraft server address is isn't that cool [Music] i truly hope this video was helpful and has made using the free version of ngrok less of a headache if this all seems like too much you can pay 10 a month for the pro version which lets you reserve a tcp address that won't ever change so by all means feel free to do that if you have any issues you can leave a comment here but google can also be your friend especially if you run into an error in linux you can also head over to the hardware haven discord and ask a question on the tech support channel this is youtube so as always make sure to hit the like button leave a comment and consider subscribing to the channel if you haven't already but that's about all i have for this one so as always thanks for watching stay curious and i'll see you in the next one [Music] [Music] you
Info
Channel: Hardware Haven
Views: 78,159
Rating: undefined out of 5
Keywords: bypass cgnat, cant port forward, cant port forward minecraft server, cgnat port forwarding, how to bypass cgnat, how to make a minecraft server, how to make a minecraft server for free, how to port forward minecraft server, minecraft server, minecraft server with ngrok, ngrok, ngrok cgnat, ngrok keep alive, ngrok minecraft server, ngrok minecraft server 1.18, ngrok tutorial, port forward minecraft server not working, port forward terraria server
Id: SZmc5uoNCko
Channel Id: undefined
Length: 30min 49sec (1849 seconds)
Published: Sun Apr 10 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.