View Full Version : Adding More IPs
cancer10
08-02-2009, 08:51 AM
Hi
We all know that our localhost can be accessed at 127.0.0.1 or your the IP assigned by your NIC which starts from 192.168.1.2 (or 192.168.0.2 in some cases depending on the router you use).
My question is that, how do I map the other IPs 192.168.1.3, 192.168.1.4, 192.168.1.5 etc. etc. and have them point to my localhost?
Please help
Thanks
primefalcon
08-02-2009, 01:04 PM
Hi
We all know that our localhost can be accessed at 127.0.0.1 or your the IP assigned by your NIC which starts from 192.168.1.2 (or 192.168.0.2 in some cases depending on the router you use).
My question is that, how do I map the other IPs 192.168.1.3, 192.168.1.4, 192.168.1.5 etc. etc. and have them point to my localhost?
Please help
Thanks
Why? and do you have multi machine network that you need to do this with or only the 1 computer?
overall you can handle domains and ips through a dns server or on a more simple level using a hosts file, also a lot of standard routers allow you to assign an ip based on a physical address
cancer10
08-02-2009, 01:47 PM
I want to do it on 1 computer.
When I add the IP 192.168.1.5 in my drivers/host/etc file it still does not work.
oracleguy
08-02-2009, 05:37 PM
Any 127.x.x.x address will point to localhost.
cancer10
08-02-2009, 05:46 PM
Any 127.x.x.x address will point to localhost.
No they dont unless you make special changes.
Also, that wasnt the answer to my quest.
Thanks anyway
oracleguy
08-02-2009, 05:53 PM
No they dont unless you make special changes.
Also, that wasnt the answer to my quest.
Thanks anyway
It should work without any special changes, I tested it before I posted it. (On XP Pro and in Linux) You said you wanted more IPs that point your localhost. Or do you specifically want them to be on the same subnet as your NIC's IP? (e.g. 192.168.1.x)
If so, you could multihome your network card so it would have multiple IPs.
cancer10
08-02-2009, 05:58 PM
It should work without any special changes, I tested it before I posted it. (On XP Pro and in Linux)
127.0.0.6 - does not open my local site where as 127.0.0.1 does :)
Or do you specifically want them to be on the same subnet as your NIC's IP? (e.g. 192.168.1.x)
If so, you could multihome your network card so it would have multiple IPs.
Yes that is what I want.
What is multihome?
primefalcon
08-02-2009, 06:42 PM
what operating system are you using
with winXP
c:\windows\system32\drivers\etc\hosts
just add in the lines address
127.0.0.1 127.0.0.2 127.0.0.3 127.0.0.4
basically the first address is the address and the rest are the aliases that should point at the first address, remember this must be all on a single line, still though to be honest I would advise against it, as it's quite frankly pointless, with *nix it's located at /etc/hosts on most dists
I'm not sure if you have to reboot with windows, you don't with *nix
cancer10
08-02-2009, 06:45 PM
I m on WinXP pro.
See, basically I want an IP say 192.168.1.6 to point to a different directory then the default directory.
My default directory is D:\www\, so when I type 127.0.0.1, it open that path, now I want another IP 192.168.1.6 to point to D:\website\
Is this possible?
I am using apache 2.2.4
oracleguy
08-02-2009, 06:52 PM
Oh yes, that is definitely do-able. In apache it is called name based virtual hosts. Basically it will use the name in the URL to figure out which website to load.
cancer10
08-02-2009, 06:53 PM
So what do i need to do to make this happen
Can ya help me pls?
primefalcon
08-03-2009, 05:12 AM
So what do i need to do to make this happen
Can ya help me pls?
what your probaly wanting to look at more here is virtual hosts
have a look here
http://apptools.com/phptools/virtualhost.php
cancer10
08-03-2009, 05:18 AM
I have another question, Is there anyway we can add more IPs to a single computer viz. 192.168.1.3, 192.168.1.4, 192.168.1.5 etc. etc.?
oracleguy
08-03-2009, 06:10 AM
I have another question, Is there anyway we can add more IPs to a single computer viz. 192.168.1.3, 192.168.1.4, 192.168.1.5 etc. etc.?
Yes, in Windows it is under the TCP/IP settings for your network card under advanced. There is an IP section that will let you add as many as you'd like. But if I remember correctly, you can't use DHCP when you do that. So you'll have to set your primary IP address manually.
cancer10
08-03-2009, 06:16 AM
Yes, in Windows it is under the TCP/IP settings for your network card under advanced. There is an IP section that will let you add as many as you'd like. But if I remember correctly, you can't use DHCP when you do that. So you'll have to set your primary IP address manually.
What will be the subnetmask for each then?
Also, what is the use of subnetmask?
cancer10
08-03-2009, 05:51 PM
what your probaly wanting to look at more here is virtual hosts
have a look here
http://apptools.com/phptools/virtualhost.php
Yes, i am probably looking for this. but for some reason apache does not redirect the domain site1.local to my desired folder D:\myweb
I am using this in httpd-vhost.conf file
<VirtualHost 127.0.0.1>
DocumentRoot "D:\myweb"
ServerName site1.local
</VirtualHost>
I restarted apache 3-4 times but no dice. It takes me to the default document root.
DocumentRoot "C:\www"
Thanks
primefalcon
08-04-2009, 05:23 AM
Yes, i am probably looking for this. but for some reason apache does not redirect the domain site1.local to my desired folder D:\myweb
I am using this in httpd-vhost.conf file
<VirtualHost 127.0.0.1>
DocumentRoot "D:\myweb"
ServerName site1.local
</VirtualHost>
I restarted apache 3-4 times but no dice. It takes me to the default document root.
DocumentRoot "C:\www"
Thanks
thats because it won't take you outside of the web root for security purposes, places your different sites in c:\www such as c:\www\web1 c:\www\web2 and so on and then create v hosts gor each of those
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.