Spoof Domains
step by step..
(apply brakes here)
I was about to create a new spoof virtual domain for my LAN, and it occurred to me.. "I should write down the steps I take, save someone else doing it, save time".So, here goes..
1: Create the fake host..
Every machine you wish to fool, needs to have host entry for your spoofy domain. Let's call this spoof domain "arc". The host file entry would simply be..192.168.1.100 arc
See here for details of how to add hosts to your particular machine.
I have one central hosts file that I import into all the different machines. I find this easier to maintain. A local DNS server is another option (or, as suggested by Druid; add the entry to your local nameserver's hosts file, if you have one).
Typing arc into any local browser will now point the it to the Apache server, which will completely ignore the request, until we..
2: Create a virtual host in apache config..
I keep mine in a vhosts.conf file, right next to the httpd.conf (I use an include statement to pull the directives in). The "arc" entry goes something like this..<VirtualHost *> ServerName arc ServerAlias arc.com arc.org ServerAdmin corz@corzoogle.com DocumentRoot "W:/tech/dev" DirectoryIndex index.html index.php ServerSignature Email </VirtualHost>Note the aliases, (handy for testing rewrite rules and such). You can add as many aliases as you like, so long as you also create corresponding host entries for each (step 1). Also note, this entry is for a Windows® Apache server; I figured it was about time to do a Windows-orientated article. Really, only the DocumentRoot directive is different.
3: Restart apache..
Sadly I don't have the "corzweescriptpack" for windows, although I do have a righteous /unix subtree on my windows box! Aye, I mean emacs, tcsh, ls, tar, the works! That's right! I do ls to get directory listings on my peecee! Oh Joy of UNIX!However, Apache for windows comes with a whole host of useful shortcuts, so restarting's a breeze; apache also installs as a system service, handy. On UNIX/Linux, your usual apachectl command will be fine. On Mac OS X, use corzweescriptpack! .. ra
We're done!
This is what we get typing arc into a web browser now..
En-joy!
;o)
(or














Use pre tags for code.
I'm hanging in #corz on blitzed.org IRC (as usual), and I'll be up for a while yet if you want to dive in. There's also a site chat here at corz.org (if you can find the well-hidden link in the toolbar) but it's usually a bit Spanish in there, and really is just for emergencies. It is cool, though, the result of a mad saturday morning coding session. (but anyways, I'm notlogged in there!)
;o)
(or
your tags don't balance!
Is what I'm getting
so put it inside pre tags!!!
you can use any formatting inside pre tags. try it!
;o)
(or
I did try it... still got the same error... and I'm at work now and I saved what i wanted to type at home lol...
Ah well, it must not have been to very important, but when I get home I'll skim through what I tried to post and try to fix it.
Alright, it works
Thanks alot, might I ask how you figured all this out?
w00h00! yeah, it's easy when you know how.
And how did I figure all this out? well, it was the next logical step from this and this. What's good for the Goose..
I'm glad it all worked out,
you won't be able to go back to raw IP's now!
;o)
(or
If you own the server that connects the lan to the internet then probably you also host a nameserver that forward queries to the internet... so you could just add the hosts in /etc/hosts on the server and it would work automagically, without changing anything on workstations... if they have your server as the nameserver of course :)
I followed the instructions explicitly, even creating a seperate vhosts.conf file and still had no success. Running a WinXP SP2 700 with the easyPHP Apache install, the system refuses to find anything but my primary dyndns host. I do recall having had at one time three (yes three!) dyndns domains running out of apache but can't recall how I did it or what version of Apache it was, and I did not make a back up of it. :(
As for AmpSig, it rocks! It has a new place of honor on my site and I will be promoting it on my YahooGroups as well!!!
Joe
hey! I'm glad you like it Joe, feel free to promote it wherever you like, a task I'll need to get stuck into myself sometime soon!
As for the virtual hosts, there are many things that can interfere. Before you consider your dyndns, get this working 100% locally. If you hack the addresses into your local hosts file (or local DNS server's hosts file, yup, good call, druid) you can test test test to your heart's content before "going live". At least you'll get a better feel for exactly where the trouble lies.
If apache is serving up the hosts locally (spoofed to 127.0.0.1, or wherever the server is) then the trouble is upstream. Often folks go messing around with their apache setup when the trouble is elsewhere, and after that it's really screwed!
Backup everything! Always! Make a script! There's nothing worse than having to start from scratch, especially stuff you've already done. Even ancient apache configs can be invaluable setting up a new server. And a zip of a million httpd.conf files would probably fit on a floppy, whatever they are.
Your first virtual host is your catch-all, for a home server, this is probably best left as a dummy, my own virtual hosts file starts something like this..my "real" hosts come later on. Accessing my web server via the raw URL gets you straight into 403 City (you can actually use /dev/null on a nix system!).
I like to drop this tip in wherever possible because so many avid torrenteers, p2p'ers and what-not go mindlessly about setting up web servers and not considering these things and others. But it's a probably a good tip for anyone setting up a home server, regardless of their other online activities.
If you check out the voyager 205 pages here onsite (google or corzoogle for voyager 205) there's some excellent information on troubleshooting webserver problems, might be of use, and isn't directly accessible from this part of the site, in fact, any part of the site, though somehow the comments file for its main page definitley would not fit on a floppy!
I'm rambling, being in the mood for writing. Anyways, take a methodical approach and you'll crack it. Feel free to get back here with with fun, info, whatever, even mail me your httpd.conf file, I always enjoy those in my inbox, especially when they contain obvious gotchas and bloopers, which they usually don't.
for now..
;o)
(or
I just had a thought. (no comments from the peanut gallery please!) When I ran this previously, I didn't install PHP as part of the package. I ran it seperate from Apache. I can back up my site, uninstall the EasyPHP and reinstall plain old vanilla Apache no frills no bells no whistles. If it works then I know it's the installation and maybe I can grab the http.conf from it and reinstall
One more plug for anyone running their own server
http://dslwebserver.com and cablewebserver.com
Everything Cor ever warned you about on running a site
yup, these days I can't be bothered with these "easy" methods, they usually end up more difficult in the long run. Vanilla php and apache aren't so vanilla any more, come with a host of useful things, as well as decent installers.
Of course, you end up learning more about how things actually work, too. Have fun!
;o)
(or
Arrgh! No luck that way either. Any ideas from the files I sent in email?
I got it rofl I knew there was a way to do it. I printed it out this time so I will have it next time but I'm not sure why it didn't work when I tried it earlier.
I did it using only the vhosts.conf since I'm not comfortable editing the lmhosts file. My vhosts.conf is listed below:
NameVirtualHost myvirtualhost.org
<VirtualHost 12.345.67.8901>
ServerAdmin johndoe@myvirtualhost.org
DocumentRoot w:/www/
DirectoryIndex index.html index.shtml index.php
ServerName myvirtualhost.dyndns.org
ErrorLog logs/virtual-error_log
CustomLog logs/virtual-access_log common
</VirtualHost>
Obviously the sections are edited but you get the idea. Thanks for all the help Cor, and if you need a beta tester for the new Corzblog, let me know. I'll be happy to beat it through its paces.
Joe
email?
Hey! well, it's working, that's the main thing. I must have missed your last comment in the crazy comment thing upgrade last week ("that comment thing" being the thing that provides comments at the foot of the pages - and "crazy" being me running all those recursive awk programs on the live comment files themselves! hahah) I haven't rummaged through my spam folder in weeks, I do put it off some, but I would have had rummaged if I'd spotted this comment, cuz I like emails with attachments!
Thanks for the offer, corzblog III isn't quite ready for the big-time yet, but at least it is now 100% xhtml compliant and produces quite nice code, too (and check out my new 100% css roll-over archives menu! *ahem*). cbparser, the bbcode parser, is about to get a beta release any day, after I let the commenteers play with it for a bit. (my unwitting beta-testers!)
I invariably use a wildcard for the NameVirtualHost directive, because there's usually umpteen hosts coming off the one box, but whatever works for you, sounds great.
;o)
(or
ps.. I keep all my spoofy domain information in a separate file called simply "myhosts" (which is shared with other boxes). In your network properties you can import a hosts file, and Windows® will run checks on it before adding the individual hosts. This is a safe approach until you feel comfortable editing the file directly.
Hi there
most impressed with your work on hacking the voyager 205. My issue is i want to view web space in my wwwroot folder (iis) from the Internet (through router) other than just being able to view this on an intranet basis (192.168.1.3/"foldername"/index.htm).
I have tried to follow your examples many times to no avail and feel I am getting confused to all the settings needed.
I am also aware you may recieve many requests on the things already covered in your tutorials but I can only ask. please help
Deikliw
Deikliw, it really depends what type of access you require. I know enough about IIs to avoid it, but I'll assume you mean regular filesystem access, these principles apply to any web server setup..
FTP. Why not setup an ftp server, put your www root folder into one of the accounts and login with a regular FTP client. Simple, robust, and if you use SFTP or similar, highly secure, too.
WebDAV. I'm fairly sure IIs can do webdav, Apache certainly can. WebDAV gives you a sort of filesystem access via the web server itself. Enabling webdav in your root has potential security issues, but I'll leave these for you to explore. All network access has potential security issues, of course.
Some other server. There are literally hundreds of different servers that will give you access to a filesystem over the internet. They don't have to be in any way connected to the webserver which just happens to also use the folder you want to access. Why not setup an SSH server?
Food for thought.
Whichever server you decide upon, it will probably need a port-forwarding rule setup on your router (though not WebDAV). If you have trouble with that, post a comment on the voyager page (after checking out the recipes, of course!)
;o)
(or
plz send the all step of the DNS that how do create Domaim and etc.
Isn't that THIS page?
;o)
(or
ok pop quiz hot shot
do u know how to do wild-cards in the hosts file (linux) for catching all sub-domains? so far I have had no luck finding the solution...
e.g. my host file is growing out of control:
127.0.0.1 sub1.domain.com sub2.domain.com sub3.domain.com (continued for a long time)
what i want to do is this:
127.0.0.1 *.domain.com
thing is - it don't work :(
now, yes - "why dont u just use one domain and folders within?" - well i need this for testing purposes. I have built a web app which gives users a subdomain when they sign-up... everytime i wanna test if the new sub domain works - yup, i have to edit my host file - which is a royal pain in the bottom
so - i could build a script to update it automagically - but surely there is a better way?
u have a really good informative site here so i hope u can shed some light - perhaps there is a nifty nix app which solves my problem?
may the force b with u - and keep up the good work
p.s. forgive me if u already have the solution on your site... if so, i suck lol
I'm always up for a pop quiz, bungle, let's do it..
do u know how to do wild-cards in the hosts file…?
No. Syat.
there is a better way?
Yes..
127.0.0.1 sub1.domain.com
127.0.0.1 sub2.domain.com
127.0.0.1 sub3.domain.com
etc.
At least now you can see what's going on. Much easier to run regex over it, too; make global changes, and so on.
As for manipulating this list in meaningful ways; on Linux, sed is your friend.
;o)
(or
ps. you might also want to consider running BIND.
nice one mate - one per line is better, i'll scope out BIND too - thanks for the quick response