give local node server a name rather then ip address - node.js

This might be a stupid question, but i run a business in a strip mall and internet is included (because of this I have no access to the router). the router assigns dynamic ip address and when I set a static ip I lose connection.
is there a way to change the address to my node app from "http:/ /[my-server-ip]:3000" to something like "http:/ /[business-name]:3000". (/ / should be // but stack wont let me post with dead links)
the main reason for this is I have multiple tablets and devices that use this system however recently after they made some changes to the routers setting my computer will be assigned two or three ip addresses a day (I notified the landlord he says its normal). and everytime my ip address changes I lose connection to my app.
is there a possible fix that doesnt require me to host on a web server or enable port forwarding?
perhaps I should reword the question. How do I go about setting up local dns zones from mac? (I know this can be achieved with most linux distros)

No you can't.
Your server IP will always change as the router gives you a new IP address, so change the hosts will not work unless every time the ip on the server changes, you change your ip as well on the devices.
You may try to create an account on dns sites like http://www.noip.com/. They will give you an "external" internet address like mybusiness.noip.com and then you will point your programs on tablets and cell phones to this address.
You will then install a program on your server that will tell noip what the new address is maintaining the same mybusiness.noip.com on them.

Related

Is there a way to "give a url" to a website runned in a WLAN?

I've developed a small application to manage grocery using Node.js and Express, and I run it locally on my pc. There are other three computers in my home: all four computers are connected to my wi-fi and need to access to my grocery application.
In this scenario, my computer acts as a "server": the other three connect to mine using my IP and the port I've set in Node.js (eg: to access in my application I type in my browser "http://localhost:3000/", while from the other three computers it's something like "http://192.168.x.x:3000/").
My problem is the following: since I'm connected to wifi, I found that my IP address often changes, so everytime this happens I have to look for my address (using ipconfig) and manually update the bookmarks saved in the other computers. I was wondering if there is a program / method / script / something that I could do to give my computer some sort of "local url" or something similar to a "local DNS", a name that can be used to find my pc in the WLAN. I've already tried to set my wi-fi router in order to have static IPs but for some reason that doesn't work well with my internet connection, so I was hoping for a different solution.
Thanks for your help!
While some smart routers have DNS capabilities, my experience is that most home routers do not. This solution can work without built in DNS capabilities for your router, and while it is not exactly 'DNS' it should keep you from having to reset the bookmarks on the other computers. Depending on your router, you should be able to adjust the DHCP range of IP addresses that it can assign to devices. You can set it to a smaller range of addresses, and assign your host computer a static address, so it doesn't change.
For example, lets say your network is using 192.168.0.x/24 addresses. So the router by default will most likely assign IP addresses in a range from 192.168.0.2 (the router is usually 192.168.0.1) to 192.168.0.254. You could adjust the DHCP range in your router settings to assign an IP address range from 192.168.0.1 to 192.168.0.250, and then manually set your host computer's address to 192.168.0.251. On all the other computers, you can now set the bookmarks to 192.168.0.251, and you shouldn't have to change them. You could also edit the hosts file (on Windows machines) so it maps an internal domain name, such as groceries.com, to your host machine, 192.168.0.250. To change the hosts file, go to C:\Windows\System32\drivers\etc, then open the hosts file in notepad, and enter in the desired domain name and IP address. Once the hosts file has been edited on all the client computers, you can just use groceries.com as the url from any browser on the computer
here's a link for manually setting the IP address on a Windows 10 PC
https://support.microsoft.com/en-us/help/15089/windows-change-tcp-ip-settings

How to write a Node.js server if my pc's ip address changes daily

I am owning a Windows PC. I have written a Web application that runs fine. But the problem is my PC's IP changes periodically. I want that application to be accessible in the network (from other pc's) without changing client side code . My client side code is in angular js.
The web server of your web application cannot bind to the correct IP if it doesn't know it in advance.
You can make your IP address static by following these steps:
In Windows, go to the Network and Sharing center
In the left pane, choose "Change adapter settings"
Right click your ethernet or wifi connection (the one connected to your router) and choose Properties
Double click Internet Protocol Version 4 (TCP / IPv4)
As an IP address, choose the one your computer already has (or try another IP address starting with the first same 3 numbers, i.e. xxx.xxx.xxx.yyy)
The default gateway is the IP address of your router
The subnet mask is typically 255.255.255.0
For the DNS server choose Google's 8.8.8.8 and/or your router's IP address
You have several choices depending upon your configuration.
If this is the public dynamic IP you get from your ISP, you can go to your ISP (whoever you get internet service from) and upgrade your service to a static IP address so it won't change.
If this is the public dynamic IP you get from your ISP, you can use a dynamic DNS service to attach a hostname to your IP address and then use that hostname to access the server. The dynamic DDNS app you put on your server will keep the DNS updated whenever your dynamic IP address changes.
If this is just a local IP address on your LAN (a 192.x.x.x or 10.x.x.x address), then you can pick an IP address that your router supports, but is above the range being used for DHCP and set that computer to use that IP address and not DHCP. In Windows, you can go to the networking configuration and choose the IP address instead of using DHCP. Then, the IP address won't ever change. It is important that you pick an address outside the range used for DHCP to avoid any conflicts. On my own LAN where the router is allocating addresses like 192.168.0.x, I manually assign addresses like 192.168.1.250.
This is something that your router handles through a protocol known as DHCP. Basically, the answer is to keep your IP from changing.
Many routers allow you to reserve an IP for certain MAC addresses. I would recommend that you access your router over your local network and work with the GUI it provides to try to configure this... if you're successful, then your IP will no longer change, and problem solved :-) If it's not intuitive, then of course refer to the documentation for your router.

How do I configure DNS to access a home computer via a domain name (both on and off local network)?

I have a PC at my home that I typically access using Remote Desktop. I would like to be able to use a domain name to access this computer, and be able to use the same domain name regardless of if I am at home (on the same network as that PC) or on the road.
I know that I need to use Dynamic DNS in order to keep my IP address up to date. I have that working now.
I also have port forwarding configured on my router to send traffic on the ports I'm using to that PC's local IP address.
I am able to successfully get to my computer from the outside world using mypc.mysite.com (example url).
However, when I am at home, the mypc.mysite.com domain name needs to resolve to the local IP address, and instead it is getting my "outgoing ip".
I know I can get around this my modifying the "host headers" on my PC, but I want it to work on other devices like my tablet. I also don't want to have to switch my host header file every time I boot depending on where I'm at.
Does anyone have a suggestion?

xampp server (How to get up and running)

I've been developing locally on a little ubuntu netbook with xampp for about 7 months. Two weeks ago I got a computer I'd like to use as a server. I've installed the latest Ubuntu distribution and xampp, moved all my files over, and forwarded port 80. I've also got a domain name from dyndns.com which is being updated by a client which runs in my router (a Netgear WGR6154 v8).
Now, when I try to access my server by typing in the address I got from dyndns.com the browser loads until it timesout. I can access everything locally using localhost as the address so I believe xampp is running, just unable to connect with the internet.
In order to be able to view my files over the internet what should I do next?
Thanks to all in advance...
[I'm starting a bounty for the first person to help me get my files successfully online]
You have a combination of issues here, and that is something of a problem. Each issue is complex in an of itself. Here is what I would recommend to get you going for certain.
First verify that you can surf the web from your server. This will confirm that you have a working ethernet interface.
Step 1 make sure that XAMPP, and your files are viewable from your home network. I assume you are using something like 192.168.1.X for your network and perhaps your server is 192.168.1.10
Go to another computer in your house and type http://192.168.1.10/ and see if you can see your files. If you can then you know that the server is properly configured and XAMPP is working.
Then add an entry to your hosts file to resolve yourdnsrecord.com (or whatever your dyndns record is) to your private ip address. Then when you type yourdnsrecord.com into a browser from that computer you should still get your files. This will rule out your server being improperly configured to listen for that domain name.
Next you need to test to see if there is a firewall problem. To simplify this, first remove your home router from the equation. Instead, place your new server directly onto your internet connection. (assuming you can). This way, you do not need to have NAT or firewalls properly configured. Your dyndns name should map to a public IP and your server should then have that IP and be connected directly to the Internet. If you have your server directly connected, and the command ifconfig from the root prompt returns the same public IP address that your dynamic dns record is point to, then it should work.
It will make your life easier if you have an iphone or some other way to test how your network is seen from the Internet.
If your public IP as shown by ifconfig is different than the IP record in your dyndns account, then your dynamic dns update script is broken. manually set the IP, and see if things work.
It is very possible that this will not work. Some ISPs firewall port 80 preventing their subscribers from hosting servers. Once you have your server directly connected to the internet you can test this (even if your dns is not working) by using the public IP address. As root, type ifconfig from the command prompt to get your public ip address. Then type the command tcpdump -i eth? port 80 from the root prompt. eth? needs to be the same interface that you saw had a public IP address from the ifconfig command. usually this is eth0 but it might be wire0 or something like that.
This command will show you all traffic coming on port 80 to your server.
From an iphone (or whatever second Internet connection you have) browse to the IP address that you got from your ifconfig command. If you see something on your server (and it is directly connected to your ISP) then your ISP is not firewalling you.
If you can get to your server, when it is directly connected to the Internet, either by IP address or by DynDNS address, then your ISP is OK and it is time to debug your firewall.
Two things need to work for your firewall to be configured NAT, where the public address that your router gets from your ISP is converted into your private network and a firewall rule which permits that traffic. If you get this far, then you know your firewall is the problem and then it is just a matter of getting its configuration correct. There are far to many home routers to document here, but you usually can find how-to instructions for your router for this task from the manufacturers website (usually it is part of the manual)
If you follow these instructions exactly you will get your system working. Make comments on the process and I will be happy to modify this to make it clearer.
HTH,
-FT
You should make sure your xampp is not listening to only the localhost.
to do so edit your apache configuration file and check and search for Listen directive
you should be able to know also by analysing the output of netstat -a.
After that make sure your router is forwarding properly, using tcpdump would help.
drop me a comment if you need more help.
Cheers

website/webserver outbound ip address

I am hoping there is a simple answer to this! My webserver has a number of IP addresses. one particular website has one of these IP addresses mapped to it. On said website, I have a java applet which is making outbound http requests.
Now, I am wondering what is the IP address that people will see for my server? Will they see the machine's default IP address or the IP address mapped in IIS for this website?
Java applet? So it's client side? It feels like a red herring.
The IP people will "see" (if they go looking) is whatever you set in the DNS, surely...
Perhaps you should specify which "people" you expect to see seeing your IP. If you mean the people owning the server you are making HTTPS requests to, and this is client side, they will see the IP of the website user. They won't see any of your IPs.
If this is server-side logic (ie something like a Java servlet), they will see whichever IP is the default outbound IP on that server. In some situations on some servers, the server will use the mapped IP, but as soon as you layer things out through connectors, it's anybody's guess which network adapter/IP actually gets used.
The java applet will be run by your visitors. So the IP address to be seen will be the visitor one and not one that your server owns.

Resources