> I have a laptop that connects to my office e-mail server as an IMAP
> client. Sometimes I am outside the firewall, and in this case, I can
> connect to the server using the server's fqdn.  When I am inside the
> firewall, I can connect to the server by making an entry in my /etc/hosts
> file for it that aliases it's private ip to it's netbios name (it is an
> Exchange 5.5 server).  In order to connect, I simply change the servername
> in kmail depending on where I am.
>
> So now my question, is there any way to set up my hosts/resolv.conf/tmdns
> to look for the server in the local network first and if it cannot find
> it to look it up in the DNS so that I don't have to constantly change the
> setup in kmail?
>
> Since the local addressing scheme in place at my company is quite unique
> I would even be open to doing something like having a script called in
> rc.local check to see what the network ip block of the local network is
> and writing out a hosts file that would have an entry for the server if I
> am on the right network, although I have no idea how to actually implement
> that.


There are a couple ways to do this. IMHO, there's an easy way and a
correct way and it's not clear which is which :)

The quick way would be to write a script based on the IP address that you
receive. You could either parse ifconfig or do something when your dhcp
client returns. You could also put in a specific configuration for your
MAC address inside the DHCP server itself. However, these all have
inherent disadvantages.

The way I'd do it is to set up a DNS view for the internal and external
networks. Machines on the inside would receive the private non-routable
address when querying the nameserver for mail.domainname.com. External
machines would receive the public IP address.

For example in the named.conf:

view "internal" {
               // This should match our internal networks.
      match-clients { localnets; };
      recursion yes;
      zone "domainname.com" {
            type master;
            file "pz/db.internal";
        };
}

view "external" {
      match-clients { any; };
      recursion no;
      zone "domainname.com" {
              type master;
              file "pz/db.domainname.com";
      };
}


-- 
The Digital Hermit      Unix and Linux Solutions
http://www.digitalhermit.com
[EMAIL PROTECTED]

Want to buy your Pack or Services from MandrakeSoft? 
Go to http://www.mandrakestore.com

Reply via email to