Want to pull the Default IP Gateway

I see there is a variable for pulling the "IP Address", but cannot find a way to pull the "Default Gateway". Is there anyway to get this done?

Thanks,

MacBook Pro, Mac OS X (10.5.6)

Posted on Feb 25, 2009 8:53 PM

Reply
3 replies

Feb 25, 2009 9:41 PM in response to dbauman

You can use a Run AppleScript or a Run Shell Script action to extract the result from the netstat command. For an AppleScript action it could be something like:

<pre style="
font-family: Monaco, 'Courier New', Courier, monospace;
font-size: 10px;
margin: 0px;
padding: 5px;
border: 1px solid #000000;
width: 720px;
color: #000000;
background-color: #FFEE80;
overflow: auto;"
title="this text can be pasted into an Automator 'Run AppleScript' action">
on run {input, parameters}

return (do shell script "netstat -nr | grep -w 'default' | awk '{print $2}'")

end run</pre>

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Want to pull the Default IP Gateway

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.