07-27-2005, 11:59 AM | #1 (permalink) |
Crazy
Location: Salt Lake City
|
Accessing my Server Locally
This seems like it would pop up a lot, but my Google searches have been in vain so I'm hoping you folks can help out.
I've set up a web/email server over my DSL connection at home, since my ISP doesn't have a problem with it I figured I'd save some money by cancelling my hosting account and going at it myself (very low-traffic site). I've got it all set up, pretty standard, FreeBSD 5.4 with Postfix, Courier, Apache, etc. Forwarded the necessary ports through my router. It's all working correctly. My question is, though, how do I use my laptop to access the server to check email / view web pages when I'm on the local subnet (on the same router)? Obviously, when I try to access, say, mail.pocketmartiansoftware.com it doesn't work correctly because the IP is of the router I'm behind. I don't want to just set it in /etc/hosts, because I also take my laptop to school and use it there, where I'm not on the same subnet. Is there some more elegant solution? I've looked over all the settings in the router and nothing looks like it'll help. It's an Actiontec DSL/wireless router, if it makes a difference. Thanks a ton, I just know I'm missing something obvious here.
__________________
---<>---^^---<>---^^---<>--- ---^^---<>---^^---<>---^^--- ---<>---^^---<>---^^---><--- |
07-27-2005, 12:23 PM | #2 (permalink) |
Professional Loafer
Location: texas
|
just put in the hostname.
if it's hostname is mail.whatever.com, put in mail. You can give the server a different hostname, even a different IP address if you want it to be privvy only to the inside. Set it up in the DNS area of your router or FreeBSD.
__________________
"You hear the one about the fella who died, went to the pearly gates? St. Peter let him in. Sees a guy in a suit making a closing argument. Says, "Who's that?" St. Peter says, "Oh, that's God. Thinks he's Denny Crane." |
07-27-2005, 02:04 PM | #3 (permalink) |
Junkie
|
How is DNS assigned to your laptop on your internal network?
You need an internal DNS server with local IP addresses for your server(s). You need to assign this DNS server as the primary DNS server on your laptop. Last edited by vanblah; 07-27-2005 at 02:10 PM.. |
07-27-2005, 04:08 PM | #4 (permalink) |
Crazy
Location: Salt Lake City
|
vanblah --
I think I see what you mean. I'm using DHCP for the laptop, and my DNS is just dynamic through my DSL ISP. So what you're saying is I need to set up DNS internally on my subnet somewhere, and then use that as primary DNS? I'll look around the net, see how it's done. Thanks.
__________________
---<>---^^---<>---^^---<>--- ---^^---<>---^^---<>---^^--- ---<>---^^---<>---^^---><--- |
07-30-2005, 03:09 PM | #5 (permalink) |
Insane
Location: Austin, TX
|
Yeah I think vanblah is on the right track. Set up named on your BSD server and have it resolve your domain's addresses to the local address. The DNS provided externally won't be affected, because your domain's SOA isn't your BSD box. When you're inside the network, you'll be polling your BSD box for the address of "mail.pocketmartiansoftware.com", which you can have configured to return "192.168.0.4" or whatever it is. When you're outside the network, whatever DNS server you're using will locate the "normal" IP address, which should be the same as the external IP of your router, and thus working seamlessly from both locations.
In my case (I've got the same type of setup at my place), I just set up /etc/hosts on all my systems, since my server's IP and name won't be changing for a long time, and I'm too lazy to set up named to do anything beyond a caching nameserver. |
07-30-2005, 08:05 PM | #6 (permalink) |
Crazy
Location: Salt Lake City
|
Yup, thanks for the tips. I got it working. For posterity, here's how I solved it:
- Installed dnscache and tinydns from ports (great article on setting them up here) - Used svc to run them as daemons - set them up to redirect calls to the sites I'm hosting to the local IP when I'm using it's nameserver (see the link) - Told my router to use my server's nameserver instead of my ISP's so DHCP clients use it automatically (the server is a static IP outside of the DHCP range, everything else is DHCP) - Told my server's nameserver to use my ISP's nameserver for names it doesn't know. - Beauty. I can now check my email and such without changing any settings, whether my laptop's on the local subnet or anywhere else.
__________________
---<>---^^---<>---^^---<>--- ---^^---<>---^^---<>---^^--- ---<>---^^---<>---^^---><--- |
Tags |
accessing, locally, server |
|
|