Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

In Linux, is there a way to automatically mount different network filers depending on depending on the network profile?

I have a laptop that moves from place to place and would like to mount or not mount different drives depending on where I am. Each location has a different network profile. If I'm at home DHCP would hand me an IP that's in my home range either on WiFi or ethernet. If I'm at work, DHCP would give me a another range. Depending on the network's profile, I want to mount different filers.

Is there something that already exists that accomplishes this?

share|improve this question
    
I essentially want Marco Polo apple.com/downloads/macosx/networking_security/marcopolo.html for Linux and am too lazy to write it myself. –  user11427 Sep 17 '09 at 7:53

2 Answers 2

As far as I see the only solution is to make your own start-up script which will mount whatever you need depending on your network settings.

share|improve this answer
    
It's not even a long script - maybe a half dozen lines in bash? –  warren Sep 18 '09 at 10:10

This one-liner gives you a list of IP addresses currently in use on your machine; use that in a script to determine your location and run mounts as needed:

$ ifconfig | grep inet | awk '{print $2}' | sed s/addr://
192.168.0.2
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.