set browser to open local address instead of internet address - windows

I use 2 NICs card on my windows, one of the local and another one is connected to the internet, now my question is how can I set the specific browser to open just the Local website instead of the internet? I set the route command to route the IP address that I want to open locally but when I check the logs I find the IP open with internet NIC instead of Local NIC

There two methods of getting this done as per your request the first method would work for you:-
The first method:-
we can use static route route but we have to obtain the IDs for our NICs by running the command below:-
netsh interface ipv4 show interfaces
The above command will get you the NIC ID
Add a persistent route by using the command below in CMD this will lock the specified traffic from a specific network to the specified network interface using the NIC IDx see syntax command below via CMD.
route -p add local_subnet mask local_subnet_mask 172.132.45.201 IF
interface_ID
For example command below, please change the values as per your environment or network:-
route -p add 192.168.0.6 mask 255.255.255.255 172.132.45.201 IF 13
The Second Method:
You will need to edit your hosts file that will enable you to override the DNS for a domain on a specific machine.
Modifying your hosts file causes your machine to look directly at the IP address that you specify
Modifying the hosts file involves adding entries to it to the file . Each entry contains the IP address to which you want the site to resolve.
192.168.190.4 www.local_domain.com
192.168.190.4 local_domain.com
13.14.15.16 www.external_domain.com
13.14.15.16 external_domain.com
Below are the steps to edit the hosts file in Windows 10/11 and Windows Server 2012 and newer versions (you didn't specify which version of Windows).
Press the Windows key.
Type Notepad in the search field.
In the search results, right-click Notepad and select Run as administrator.
From Notepad, open the following file: c:\Windows\System32\Drivers\etc\hosts
Make the necessary changes to the file.
Select File > Save to save your changes.
For Windows, you may have to reboot your computer and this will work independently of the NIC setup.

Related

Configure IIS hostname when using DNS

I need to use a host name for my internal tools so I made a request the DNS guy to add the "oneplan.dev.ad.trw.com" in the DNS server configuration.
After received that he did this:
But when I access the "oneplan.dev.ad.trw.com" I get the IIS welcome page:
And if I specify the port: oneplan.dev.ad.trw.com:6202. The page is displayed correctly.
What I need to to in order to make it work without the port in the URL? I can't use the default port 80 because I have multiple application on the same server.
You have two options:
Option 1 - Explicit Host Names
Make sure none of the sites have a wildcard binding on port 80 - ensure they all have a unique Host Name specified. If they look like the following, you must added configure an explicit Host Name (e.g. dev.ad.trw.com or *.dev.ad.trw.com) under bindings:
Once this has been completed, you should be able to change the port of your new site from 6262 to 80 and IIS will route port 80 traffic to the appropriate site based upon Host Name.
Option 2 - Add IP Address to Network Card
In order to host 2 sites on port 80 on the same machine without explicit Host Names as suggested in Option 1, you need a new IP address added to the network interface. I'm not sure what version of windows you're running and whether your server has the windows GUI installed. If it does, just go into the network settings for the card and follow the instructions below. It's a fairly straight forward.
First open the properties for the network connection, highlight the IPv4 option and click properties:
On the properties page write down the IP Address and the Subnet Mask and then click the Advanced button on the bottom right (got cutoff in the screenshot:
On the advanced properties page popup, click Add in the IP address section and enter a new IP address with the same 3 octets, and any number between 20 and 255 for the final octet (eg. 10.27.233.121 based on your screenshot above). For the subnet mask copy the subnet form the other IP address(es) configured on the machine (e.g. 255.255.255.0) and click ok to save the settings...and continue clicking OK until all of the properties dialogs are closed.
Next go into IIS Manager, click on each of the sites on the server and select Bindings from the Actions panel on the right side. Make sure all sites are bound the original 10.27.233.21 IP address like the site in your screenshot. If you see any sites with a wildcard "*" for the IP Address, modify them to the 10.27.233.21 as well. Once that's done, open the site bindings settings for you site (same as your first screenshot) and configure its bindings the new IP address 10.27.233.121 and change port 6202 to port 80.
To test that the configuration is working do the following (do this on the server): (1) launch Notepad with administrate privileges, (2) click open, (3) paste the following path into the "File Name:" textbox C:\Windows\System32\drivers\etc\host, (4) click ok to open the file, (5) hit enter at the bottom of the text file and paste the following - [IP Address][Tab][DNS Name], and (6) save the file:
10.27.233.121 oneplan.dev.ad.trw.com
If the site loads, you're all set. Delete the line we added to the Host file in the last step, and tell you server guy to modify the DNS record for oneplan.dev.ad.trw.com to point to 10.27.233.121.
open c:\windows\system32\drivers\etc\hosts in notepad as administrator, make an entry:
10.27.233.121 oneplan.dev.ad.trw.com
go into a command window (windowskey+R to open run box and enter cmd) and type ipconfig /flushdns
Congrats, you've just overridden the DNS for that domain address and your computer specifically will always point to the new IP that you defined in the hosts file. Remember to clear it out once your domain is done propagating (your dns guy should have put an A record in the DNS handling the server)

API equivalent to etc/hosts?

Is there a Windows (or Windows Device Driver) API that's equivalent to editing the etc/hosts file, i.e. to override or change the hostname-to-IPaddress mapping?
I'd want for a scenario where DNS might not exist on a LAN, or where the hosts in question aren't known to DNS, but where I know the host name and the IP addresses.
If not, then I take it that editing etc/hosts programmatically is the only way to do this?
How often or how soon does an edit to etc/hosts take effect -- i.e. if I edit it then will my next network connection request to a given host name use the new IP address, or is a stale value cached somewhere?
Windows has the file %WINDIR%\System32\drivers\etc\hosts which is exactly equivalent to the *nix /etc/hosts file.

How to access a device connected in local network with hostname?

I tried accessing a webpage in a server within the local network with the host name of the device followed by its folder path and the name of the file(it is a basic php file) in first system.It worked as expected.
But when i tried the same in second system connected in the same local network ,i couldn't access it with the host name but i could access the page with the IP address of the server.
And ofcourse the second system's DNS was configured as the router which is the DNS for my local network.
Is there any additional configurations that i need to do for accessing the server with host name?
If you are using windows edit the file :\windows\system32\drivers\etc\hosts
If you are using linux the file is /etc/hosts
and add a line using the sintax already on the file
IPadress hostname
for example
192.168.10.100 www.mywebserver.com
save and done.

How can I access a website on a Local Network in an OSX environment

So I have a website that I created locally but I would like to have other team members access it. I would also like to test my site using my iPhone for testing purposes. Th thing is when I check the Xip.io (LAN only) option (shown in the image below) a URL is displayed in the empty box below it. The problem is that when I use that URL the Xip.io URL in the browser of my iPhone. Nothing displays. Is there an easier way to make my website accessible from other machines locally? Is there a file that I need to edit or are my changes correct?
Thanks
Update
I'm using my internal IP. I can access my site with my laptop but other computers connected to my network cannot access my website. I figure that maybe I need to make a change to my httpd.conf file?
Found a solution! Since I'm working in OSX
Here are my steps:
Go to System preferences Selected Network
Select Wifi (since I'm connected via Wi-fi)
Clicked on the Advanced button
Click on the TCP/IP Tab
Copy or write down the IPv4 Address:
Then
Go to to PHPAdmin
Select the database tab
Select your database
clicked on the options table
under option_name Change both values (siteurl and home ) in column option_value to the IPv4 Address you copied from System preferences
Opened MAMP Pro
entered the same IPv4 Address in the Host IP Address Field
Restart server
Helped me
I'm not sure if I understood correctly, but you can use the app Fing - network tools on your phone to scan the network and get all IP addresses on it, your computer should be one of them (on regular protection networks).
What I think what happened is that that URL is not resolved correctly on other devices, you are probably giving them your external ip, try to use the app I mentioned, find your computer and attempt to connect to the IP address you find in that app. That IP will be your internal ip address, which is what you need.

How to access vhosts via IPad?

I'm using XAMPP, on Mavericks, to simulate a localhost. I set jobeet.local, for example, as my vhosts. I tried to access it on my computer, it worked as well.
Now, I want to test my website on an IPad. So, I did the following steps:
Run XAMPP server on port 80, as usual
Connect the IPad to my wifi network.
Setup Http Proxy on Ipad, as picture showed below but change the port to 80
Now, I tested to access 127.0.0.1 via IPad. It worked! However, jobeet.local doesn't work.
I have searched and tried many ways to achieve this issue but they don't work.
Could you help me figure it out?
Thanks in advance.
You might have to update the hosts file.
The hosts file is a text file that maps hostnames to IP addresses.
Upon typing a url address on the browser, the system is checking if there is a relevant entry on the hosts file and gets the corresponding IP address, else it resolves the IP via the active connection’s DNS servers.
The hosts file can be edited to block certain hostnames (like ad-serving/malicious hosts), or used for web development purposes, i.e. to redirect domains to local addresses.
Editing the hosts file
Editing the hosts file in Mac OS X – Leopard, is a pretty easy task, especially if you are familiar with the terminal.
Step 1 – Open the Terminal.app
Either by start typing Terminal on the Spotlight, or by going into Applications -> Utilities -> Terminal.
Step 2 – Open the hosts file
Open the hosts by typing on the Terminal that you have just opened:
$ sudo nano /private/etc/hosts
Type your user password when prompted.
Step 3 – Edit the hosts file
The hosts file contains some comments (lines starting with the # symbol), as well as some default hostname mappings (e.g. 127.0.0.1 – localhost).
Simply append your new mappings underneath the default ones. Or edit one of the default values if you know what you are doing!
You can navigate the file using the arrow keys.
Step 4 – Save the hosts file
When done editing the hosts file, press control-o to save the file.
Press enter on the filename prompt, and control-x to exit the editor.
Step 5 – Flush the DNS cache
On Leopard you can issue a simple Terminal command to flush the DNS cache, and have your host file changes to take immediate effect:
$ dscacheutil -flushcache
You can now test your new mapping on the browser!
Hope this works for you!
I had to reinstall my setup today and made a step by step at that occasion:
I use a combination of Squidman and Mamp Pro (I assume it's similar to XAMPP)—hope this help anyone in their quest; happy to read feedback or get advice to make this better...
Squidman http://squidman.net/squidman/index.html
Mamp Pro http://www.mamp.info/en/mamp-pro/
on Squidman
- Preferences > General > Http port:
something different from the one MAMP is using (if map uses 80, then put 8080)
Preferences > Clients > Provide proxy service for:
insert the IP address or the subnet we will be catering for
Start Squidman
on MAMP:
setup the hostname, as well as the the website attached
insert the (local) IP address of the local machine
insert the port of Apache on the local machine
start Mamp; check that website is running correctly on local machine
on iPad/iPhone/mobile device
select the same wireless network as the laptop
in Wifi network > Preferences/Information: set a Manual HTTP Proxy
server IP is the (local) IP address of the Apache server, also running Squidman; port is the port used for Squidman
(Extra)
stuff to test: move dev server onto virtual machine (VirtualBox), to use with Node, custom PHP build, etc.
automate the setting: write pref for Squidman, Mamp/hostname, restart the Apache server, send configuration of proxy to mobile via iMessage or email.
I recommend using http://xip.io/. For example (taken from the website):
10.0.0.1.xip.io resolves to 10.0.0.1
www.10.0.0.1.xip.io resolves to 10.0.0.1
mysite.10.0.0.1.xip.io resolves to 10.0.0.1
foo.bar.10.0.0.1.xip.io resolves to 10.0.0.1
It does the job and you don't have to set anything up. I'm only pushing it because I am overly excited that I have wasted time trying over-engineered solutions.
On a mac you can use Squid on Windows that's Fiddler, however I'm having troubles with Fiddler and iPhone at the moment...

Resources