Hi, trying to setup an script/command to turn on and off a DNS server instead of manually entering it each time.
This page talks about it http://tunlr.net/forums/topic/mac-os-x-scripts-for-tunring-tunlr-onoff/#post-1210
NOTE: This works as-is if you use OS X 10.7.x Lion or 10.8.x Mountain Lion using Wi-Fi. If you use Ethernet, just change Wi-Fi to Ethernet. If you use Mac OS X 10.6 or previous versions, change Wi-Fi to AirPort.
for turning on:
sudo networksetup -setdnsservers Wi-Fi 149.154.158.186, 199.167.30.144
Then save this to a command of your preference (Suggested: tunlron.command)
for turning off:
sudo networksetup -setdnsservers Wi-Fi 4.2.2.2, 4.2.2.3
Then save this to a command of your preference (Suggested: tunlroff.command)
After I execute the file by using "chmod +x tunlron.commnad" when I click on it gives this
calvin-macbookpro:~ calvin$ /Volumes/MacBook\ Pro\ HD/Users/calvin/tunlron.command ; exit;
-bash: /Volumes/MacBook Pro HD/Users/calvin/tunlron.command: cannot execute binary file
logout
[Process completed]
Any suggestions?
This page talks about it http://tunlr.net/forums/topic/mac-os-x-scripts-for-tunring-tunlr-onoff/#post-1210
NOTE: This works as-is if you use OS X 10.7.x Lion or 10.8.x Mountain Lion using Wi-Fi. If you use Ethernet, just change Wi-Fi to Ethernet. If you use Mac OS X 10.6 or previous versions, change Wi-Fi to AirPort.
for turning on:
sudo networksetup -setdnsservers Wi-Fi 149.154.158.186, 199.167.30.144
Then save this to a command of your preference (Suggested: tunlron.command)
for turning off:
sudo networksetup -setdnsservers Wi-Fi 4.2.2.2, 4.2.2.3
Then save this to a command of your preference (Suggested: tunlroff.command)
After I execute the file by using "chmod +x tunlron.commnad" when I click on it gives this
calvin-macbookpro:~ calvin$ /Volumes/MacBook\ Pro\ HD/Users/calvin/tunlron.command ; exit;
-bash: /Volumes/MacBook Pro HD/Users/calvin/tunlron.command: cannot execute binary file
logout
[Process completed]
Any suggestions?
Last edited: