Guía de administración del sistema: servicios IP

ProcedureCómo evitar la falsificación de la IP

Para evitar que el sistema reenvíe paquetes a otra interfaz sin intentar descifrarlos, el sistema debe comprobar que no haya falsificación de IP. Un método de prevención es definir el parámetro de inicio múltiple de destino estricto de IP mediante el uso del comando ndd. Cuando este parámetro se define en un manifiesto SMF, el parámetro se establece cuando el sistema se reinicia.


Nota –

Lleve a cabo los pasos de este procedimiento en ambos sistemas.


  1. En la consola del sistema, asuma el rol de administrador principal o conviértase en superusuario.

    La función de administrador principal incluye el perfil de administrador principal. Para crear el rol y asignarlo a un usuario, consulte el Capítulo 2, Working With the Solaris Management Console (Tasks) de System Administration Guide: Basic Administration.

  2. Cree el manifiesto SMF específico para el sitio con el fin de comprobar que no haya falsificación de IP.

    Use el siguiente ejemplo de secuencia de comandos, /var/svc/manifest/site/spoof_check.xml .

    <?xml version="1.0"?>
    <!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
    
    <service_bundle type='manifest' name='Custom:ip_spoof_checking'>
    
    <!--    This is a custom smf(5) manifest for this system. Place this
            file in /var/svc/manifest/site, the directory for local
            system customizations. The exec method uses an unstable
            interface to provide a degree of protection against IP
            spoofing attacks when this system is acting as a router.
    
            IP spoof protection can also be achieved by using ipfilter(5).
            If ipfilter is configured, this service can be disabled.
    
            Note: Unstable interfaces might be removed in later
            releases.  See attributes(5).
    -->
    
    <service
            name='site/ip_spoofcheck'
            type='service'
            version='1'>
    
            <create_default_instance enabled='false' />
            <single_instance />
    
            <!--    Don't enable spoof protection until the
                    network is up.
            -->
            <dependency
                    name='basic_network'
                    grouping='require_all'
                    restart_on='none'
                    type='service'>
            <service_fmri value='svc:/milestone/network' />
            </dependency>
    
            <exec_method
                    type='method'
                    name='start'
                    exec='/usr/sbin/ndd -set /dev/ip ip_strict_dst_multihoming 1'
    <!--    
         For an IPv6 network, use the IPv6 version of this command, as in:
                    exec='/usr/sbin/ndd -set /dev/ip ip6_strict_dst_multihoming 1
    -->
                    timeout_seconds='60'
            />
    
            <exec_method
                    type='method'
                    name='stop'
                    exec=':true'
                    timeout_seconds='3'
            />
    
            <property_group name='startd' type='framework'>
                    <propval
                            name='duration'
                            type='astring'
                            value='transient'
                    />
            </property_group>
    
            <stability value='Unstable' />
    
    </service>
    </service_bundle>
  3. Importe este manifiesto al depósito SMF.


    # svccfg import /var/svc/manifest/site/spoof_check.xml
    
  4. Habilite el servicio ip_spoofcheck.

    Utilice el nombre que se ha definido en el manifiesto, /site/ip_spoofcheck.


    # svcadm enable /site/ip_spoofcheck
    
  5. Compruebe que el servicio ip_spoofcheck esté en línea.


    # svcs /site/ip_spoofcheck