ACCESS YOUR UBUNTU MACHINE FROM ANYWHERE IN THE WORLD
ACCESS YOUR UBUNTU MACHINE FROM ANYWHERE IN THE WORLD
HI, friends this is Akshit and you are at TechSyapa . So guys today in this blog i will discuss how you can access your ubuntu machine from anywhere in the world .
So friends let us assume that you are far from your home and want to access your ubuntu machine which is at home so what will you do ? here comes the solution . The solution is our favorite SSH but as we Know that the internet is very vast , it is very difficult to provide each device a unique public ip address so what happens let us understand by a example suppose you have a airtel wifi at home the airtel wifi router will be a assigned a public ip address dynamically i.e it will vary . Now each device connected to the wifi will be assigned a dynamic local ip address so we can say that in the public world all the devices connected to my airtel wifi router have same public address but locally they all have there unique ip address so what will be the issue when you will SSH your device from another network , you will use the public ip address to SSH your host but as we discussed above all the devices of my network have same public ip so how the router will know that for which device this is SSH request is for ?
So here comes the solution to resolve this issue follow the following steps :-
1) Go to the login page of your router ,usually the ip address for all the routers is 192.168.1.1 open your browser and type 192.168.1.1 and following window will be displayed
usually the default username is admin and password is password .But if it does not work for you then look at the back of your router or call the customer care
of your isp.
2) Now we will use the port forwarding technique to forward the request from router to the machine to which i want to connect remotely
3) Uptil step 2 the procedure is same for all routers but further steps can vary from router to router the router on which i am working is beetel 777vr1 .
We will find the NAT option in the page (NAT is process by which firewall assign public address to the computer) and then we will go for virtual server option .
Advanced>>NAT>>Virtual Server
in usual service name select ssh and set wan interface to any and in LAN ip address add the local ip address of the device to which you want to forward the request or you want to connect remotely from anywhere.
3) if you are using a firewall on ubuntu then allow the port forwarding in it by using following command
$sudo ufw allow proto tcp from 192.168.1.1 to any port 22
After performing all the three steps you can access your machine from any network by using following command ssh usernmae@public_ip_address
here username is the username of your machine you want to connect remotely and public ip address can be found by simple google search what is my ip ? or by the command
$curl https://ipecho.net/plain ; echo
so this is it guys by following these 3 simple steps you can access your ubuntu machine from anywhere but there are two main problems the public ip address is not static it vary again and so if you want to connect remotely each time you have to see the public address of your host . To resolve this issue you can buy a static ip.
second problem is that the local ip address of your host can also vary so each time you have to update in your router settings but this problem can be easily resolved by allocating a static local ip to your host by going to LAN settings of your router there is a option of DHCP static there you can provide your host a static private ip address
Thank You guys that's it for today . For any queries or suggestions comment below .
Comments
Post a Comment