0

I'm setting up a couple of Windows laptops to mount home directories from our file server. The file server uses NFS for Linux clients and I've set up Samba for these Windows clients. At startup, I'd like them to mount using Samba when on the LAN and a secure FTP connection otherwise. I'm confident the rest can be scripted or otherwise (I have some C# experience, so if batch files are insufficient, I can write a more complex C# program), I just don't know how to approach determining whether or not the computer is on the LAN.

4
  • Well, how do you define "on the LAN"? ipconfig shows same subnet as your office LAN? Active Directory/kerberos authentication successful?
    – gravyface
    Jan 18, 2011 at 17:51
  • For laptops, I would probably define it as having an IP address issued by my DHCP server. Wasn't aware there was much debate on the topic.
    – Alex S
    Jan 18, 2011 at 18:06
  • 1
    Since the point of your script is to mount something from a file server, why not just attempt to ping the fileserver, or attempt to connect. If it fails, the network wasn't up.
    – Zoredache
    Jan 18, 2011 at 18:11
  • what happens if they're on the same subnet as your office? I like Zoredache's suggestion actually: because if for some other reason they can't connect (i.e. on the same subnet as your office), they can always connect through the Internet and SFTP.
    – gravyface
    Jan 18, 2011 at 18:47

1 Answer 1

1

How about running an IPCONFIG /ALL and seeing if the DHCP server listed is one of your expected 'on LAN' servers?

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .