What I should I replace local host with to run my web application from elsewhere? - networking

I'm having a static IP address, say:127.254.x.x
Is it possible to access my web application from some other place by just replacing the local host with my IP???
Also, what will I replace the local host with if Ithe server is on a wifi network.? I.e. The router assigns a different ip to my server(because of dhcp) other than my original static ip. In this case should it be
192.x.x.2:8090
Or
127.254.x.x
Any help is appreciated.

I'm having a static IP address, say:127.254.x.x Is it possible to access my web application from some other place by just replacing the local host with my IP???
Yes, provided you configure it correctly.
Normally, you have a broadband modem/router which talks to the outside world, and provides a NAT network range to your devices. So you have an external IP address (the one the modem/router uses to talk to the outside world), and probably several internal IP addresses (for your phone, your laptop, your other laptop, your Kindle, etc.).
So to access a web server on your internal network from the outside world, you have to do two things:
Configure your modem/router to "forward" traffic it receives on the desired port (port 80 for HTTP) to the server on your network. How you do this depends on your modem/router. Look for "port forwarding."
When trying to access the app from the outside world, use your external, not internal, IP address.
So for instance, if your external IP address is 222.111.222.12, and the IP address of the machine you're using as your web server is 127.154.0.23, then you tell your modem/router that whatever traffic it receives on port 80 it should forward to 127.154.0.23 (this configuration may be by IP address, or may be by the MAC address of the network card in your web server machine; it depends on the modem/router). Then to view your app from outside your network, you go to http://222.111.222.12 (or whatever name you assign that IP address to in DNS).

Related

Identifying correct IP address of my machine

Let's say we have a wifi at home. When I google "whatsmyip", it gives me public IP address, which is essentially IP address of my router on the internet.
Now lets say I have two machines (A and B) both hosting a web server. I want to reach to a web-server on my machine 'A' from outside my local network (from some other corner of the world), how I can ping to that specific machine to my network. I understand for outgoing requests from my machine we have NAT, but what about incoming request to a specific machine? How router resolves it?
How I can check that IP(for incoming requests) in my windows/linux machine?
e.g let's say I have a tomcat server running on port 8080 on machine A. Now if I do localhost:8080/home, it displays "Hello World". Now one of my friend in let's say in Europe wants to access "/home" end point. What ip would he use?{IP}:8080/home. Means how he'll identify my machine, as to the internet only router's IP address is visible
To be able to reach your comptuer on the LAN behind your router you will need to do a port forward.
All connections to your public x.x.x.x:p ip/port address are forward to y.y.y.y:p
You can't forward different connections with the same port to a different machine in your lan, you will have to implement a more sophisticated approach to be able to do that, like a load balancer and apply a rule's base on the domain etc.
To be able to ping, you have to forward ICMP request to your lan machine.

How is IP address 127.0.0.1 used in terms of servers?

I'm working on a project which enables a web-based server which is accessible through 127.0.0.1:8081.
But I am not really able to understand the concept of the ip address. Does it mean the address is only available from the device which opens up the server, or across the whole LAN on any computer connected to that same router?
127.0.0.1 is a special IP address that refers to your local machine. Localhost resolves to this address. If you want to make your server accessible from the web or a different machine you will have to use a routable IP address.

cant access iss with external ip in lan

hello I created a website with IIS. I open ports and everything. I can access this website from another network with ip and port
like http://81.215.xx.xx:81 . but with any computer with same network (LAN) I cant access http://81.215.xx.xx:81 like this. I can only access when I write the static ip of that machine. like http://192.168.1.3:81/
I want to access with external ip in lan how can I do that?
Your LAN most likely has another equipment, a router for example which has an interface with the other IP address, http://81.215.xx.xx:81. Your router forwards requests to your server based on its routing table. This routing does not exist when you are in the private network. That is why you can only access the server with its private IP address which is in the same range as your computer when you are in that network.

Access server in local network through domain

i have problem with access to server with domains.
Test url: testpage.example.com.
Server is in local network with port fowarding (80, 443), configured as web server using caddy server as reverse proxy.
Case 1 (using Asus router):
Connected on local network behind router. Server is in the same network as my computer. Everything works like a charm in and out of my network.
Case 2 (using internet provider router):
Connected on local network behind router. Can't access server with domain. Works with direct IP. Outside network, works as in case 1.
I used same server.
Does anyone know why this problem occured? How can i solve it?
Thanks,
David
Two options I can think of:
You could add a record to whatever DNS server you're using in Case 2.
You could write a short script that runs whenever you change network connections to modify your hosts file accordingly.
This happens when the server you are trying to reach "testpage.example.com" resolves to your router's external IP address. Because your public IP address is the same as server's IP address (even though inside your home network you have different private IP addresses) your requests are lost in the ether.
As a workaround you can resolve the testpage.example.com manually on your local machine.
For Windows c:\windows\system32\etc\hosts
For Linux /etc/hosts
testpage.example.com 192.168.1.102 -> private IP of the machine serving the site.

Port forwarding with private IP

I use a static IP connection, Configured to TPLINK router.
I have a local server running which i can access from my network, but i want it to be accessed outside network.
So I did port forwarding. and its Successfully running.
Now the problem is :: The IP address of my WAN is also a private address like 10.10.X.X, so when am entering http://10.10.X.X, i can access my site, but not outside my network. Please guide me how to fix this?
If your WAN address is a private address, your ISP is using CGN. This is becoming more common since the RIRs have, or soon will, run out of public IP addresses to assign to ISPs. It sounds like your ISP has run out of public addresses and needs to use private addresses for its residential customers, reserving its remaining public addresses for its business customers which are willing to pay for public addresses.
Basically, your ISP is using NAT, too. You would need to have the ISP forward your port on its NAT router, but the odds of that are zero since it probably has a policy you agreed to to not host servers on your residential LAN (buried in the fine print of the ISP agreement). This situation will play out more and more over time.
You have to use the "Virtual Server" settings. Port triggering is used for.
Once the modem router is configured, the operation is as follows: 1. A local host makes an outgoing connection to an external host using a destination port number defined in the Trigger Port field. 2. The modem router records this connection, opens the incoming port or ports associated with this entry in the Port Triggering table, and associates them with the local host. 3. When necessary, the external host will be able to connect to the local host using one of the ports defined in the Incoming Ports field.
It is not used for incoming connections which are triggered from outside!
Of course, to have it working you have to have an application listening on that port not only having the firewall on Windows allowing the port.
After you set up the "Virtual Server" a port scanner should show you the port is open (even without having a running application listening) - it will try to port forward it. I use ShieldsUp for testing.

Resources