I have a LAMP server. It works great if I access using the private ip e.g. 192.168... I also did port forwarding to access to it using its public ip and it works great if I'm not in the same LAN as the server, so if I use mobile data, I can access to it, but if I'm with my laptop which is connected to the same router, I can't.
How can I access to a lamp server using the public ip and being in the same LAN? I've read about creating a DNS server but I think that's too complex for this and there must be an easier answer.
Thank you!
What you need is NAT hair-pinning on the router. Presently Cisco routers support it.
You may also create a DNS host-entry on your PC which points the public IP(or DNS name) to local IP.
If two hosts (called X1 and X2) are behind the same NAT and exchanging traffic, the NAT may allocate an address on the outside of the NAT for X2, called X2':x2'. If X1 sends traffic to X2':x2', it goes to the NAT, which must relay the traffic
from X1 to X2. This is referred to as hairpinning. Source
Related
I sorry to botther with this...
I have a public IP 181.188.xxx.yyy and I have a Local IP range which is 192.168.10.0/24 on that range I have a Server which is 192.168.10.3 which runs different services on diffente ports, lets say Expressjs on 3000, Mongogb on 27017.
I have a Nat thar redirects from outside to public IP depending on the required port to the required service.
What I need to do, now is the inverse thing, detect when a local host is tryng to get an IP 181.188.xxx.yyy from internal network Mikrotik should forward to an Internal IP host.
Can Anyone lend me a hand with it please??
That you describe sounds like a hair pin nat because in the network topology a web server behind a router is on private IP address space, and the router performs NAT to forward traffic to its public IP address to the web server behind it.
Please see here for more info.
I am running a ddns client on Ubuntu for Nextcloud server, however my ISP has done something to the router so internet IP showing in the router is different from my public IP which causes an issue when ddclient updates the IP of my domain.
I have tried to contact my ISP but they want me to pay a huge amount for a fixed IP.
Is there any solution for this?
My router model is HG8245Q2.
*PS: The IP shown in the image is just an example.
Note: I tried this on a another router model HG8245Q, and it gives me the same IP on both router and google. so no issue on the old router model.
The IP address you see in your router is just another internal IP address from private range 10.x.x.x
This means your router is not connected directly to the internet but to another subnet of your ISP. And only this subnet is connected to the internet over another router (with NAT) and this router has a public IP address.
This is standard behavior with most of ISP because they have limited count of public IP addresses. If you need public IP, you have to pay for it, change ISP who gives you one for free or try some edge case solution like rent VPS server and make VPN tunnel to your home router (this requires advanced networking skills)
Maybe DDNS comes in handy for you. You can opt for free DDNS services like DynDDNS or NoIP.
Steps [I personally prefer noip.com ]:
Create a Free Account
Choose a hostname(We can say a domain name pointing towards ur system IP)
Download their desktop client(To sync your Dynamic IP with the hostname you selected)
Boom it's done! Use that hostname instead of IP wherever needed, traffic will be redirected to your system. Just take care of port forwarding and firewall settings.
I want to access localhost of a computer but other computers in the same network also has the same public IP. Can we access its localhost host by knowing both(public and private) IP address of that computer. I want to connect to it directly(not through any software like ngrok or VPN).
Thanks in advance.
You can only access localhost on the computer itself. Localhost refers to 'this node' by definition.
When communicating on an internal network you usually use the private IP addresses, not the public one(s). Connecting to a computer with a private IP behind a public IP requires reverse NAT aka destination NAT aka port mapping.
Connecting out from and right back into the same network through NAT may require a special firewall setup aka hairpinning. It's usually easier and faster to use split-brain DNS and resolve the public name to the private IP address of the device.
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.
now i am running a network available bandwidth project.Suppose i am testing the available bandwidth between my machine and planet1.scs.stanford.edu.
Now the problem i am faced with is that my machine is using a private address,say,172.18.186.200,the other end is using a public address,say 171.66.3.181.Once i ran the test,the receiver end(the remote machine assumed) could not receive ACK from the sender end(my local machine).
i know my publicly routed address, i guess it is about the NAT.So how to correctly specify my local address to successfully carry out the testing project ?
Thanks in advance !
The usual form of NAT (masquerading) doesn't allow inbound connections. To allow them, you would need to add another form of NAT, port redirection, which in common ADSL routers tends to be called "Port Forwarding", "Virtual Servers", or something similar. This way, you tell your ADSL routers to forward connections to its port X to some internal IP on port Y.
(Some protocols use several connections, e.g: FTP, H.323, and send the information about secondary connections on the primary connection. These protocols need special support in the NAT device).