/openvpn/scripts/macOS/openvpn-osx-tuntap.sh |
@@ -6,12 +6,24 @@ |
########################################################################### |
# openvpn-osx-tuntap.sh # |
# Up / Down script for OpenVPN running on OSX as a client. # |
# # |
# The OpenVPN server is expected to serve clients with IP addresses via # |
# a previously configured DHCP server. # |
# # |
# Note that this script does not replace the default route but instead # |
# uses the Mac OS capability of using scoped DNS servers to make the # |
# remote network available whilst preserving the default route. # |
# uses the Mac OS capability of using scoped DNS resolution in order to # |
# make the remote network available whilst preserving the default route. # |
# # |
# To use this script on an OS X OpenVPN client, the following changes to # |
# your OpenVPN configuration are required: # |
# # |
# up-restart # |
# up openvpn-osx-tuntap.sh # |
# down openvpn-osx-tuntap.sh # |
# ipchange openvpn-osx-tuntap.sh # |
# # |
# where openvpn-osx-tuntap.sh is the filesystem path to this script. # |
# # |
# Based on: # |
# - 2006-09-21, Ben Low - original version # |
# - Nick Williams - for TunnelBrick # |
@@ -357,10 +369,20 @@ |
|
# OpenVPN passes $script_type set to the script method. |
case "$script_type" in |
ipchange) |
# Set the MAC address for the tuntap device for static DHCP bindings |
/sbin/ifconfig "$dev" ether $STATIC_TUNTAP_MAC_ADDRESS |
# Set the interface to NONE |
/usr/sbin/ipconfig set "$dev" NONE |
# Set the interface to DHCP |
/usr/sbin/ipconfig set "$dev" DHCP |
;; |
up) |
|
# Set the MAC address for the tuntap device for static DHCP bindings |
/sbin/ifconfig "$dev" ether $STATIC_TUNTAP_MAC_ADDRESS |
# Set the interface to NONE |
/usr/sbin/ipconfig set "$dev" NONE |
# Set the interface to DHCP |
/usr/sbin/ipconfig set "$dev" DHCP |
|