Activar el sistema de IP Forwarding en un Mac

dnetwork_icon_mac.jpgSi utilizas tu Mac como máquinas intermediaria para proveer de acceso a internet o de otros servicio de red, podrías necesitar activar el sistema de IP Forwarding.

Esta opción permite la retransmisión de los paquetes que se reciben por una interfaz física y de retransmitirlos por otra interfaz hacia otro nodo. A diferencia del NAT que solo traduce las direcciones IP privadas en direcciones IP públicas, IP Forwarding hace el reenvío de paquetes IP de una red a otra.

Para activar esta opción en Mac OS X no hay una preferencia específica en las Preferencias del Sistema que permita hacerlo, así que hay que recurrir al Terminal y/o usar este AppleScript que permite realizar la activación / desactivación con un simple click de botón.

(*

(c) Copyright 2010 Joris Berthelot httpt://www.eexit.net

*)

display dialog "Estado actual de IP Forwarding:" & return & return & (do shell script "sysctl net.inet.ip.forwarding") & return & (do shell script "sysctl net.inet.ip.fastforwarding") with title "IP Forward — eexit.net" with icon note buttons {"Enable", "Disable", "Quit"} cancel button 3 default button 1

set choice to button returned of result

try

if choice contains "Enable" then

display dialog (do shell script "sysctl -w net.inet.ip.forwarding=1 net.inet.ip.fastforwarding=1" with administrator privileges) with title "IP Forward activado" with icon note buttons {"Done"} default button 1 giving up after 10

end if

if choice contains "Disable" then

display dialog (do shell script "sysctl -w net.inet.ip.forwarding=0 net.inet.ip.fastforwarding=0" with administrator privileges) with title "IP Forward desactivado" with icon note buttons {"Done"} default button 1 giving up after 10

end if

on error the error_message number the error_number

beep

display dialog "Error: " & the error_number & return & the error_message with title "IP Forward — eexit.net" with icon stop buttons {"Quit"} default button 1

end try

Copia y pega este script de Joris Berthelot en el Editor de Scripts, guárdalo como una aplicación y ejecútalo cuando necesites activar o desactivar esta opción. Este script ha sido probado solo bajo Mac OS X 10.5.8 pero debería de funcionar en otras versiones de Mac OS X, aunque debe usarse con precaución.

Deja una respuesta