Skip to content

Instantly share code, notes, and snippets.

@LuisPalacios
Created March 7, 2023 18:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LuisPalacios/b20f5ea512f1801ca72a13a7c7010f49 to your computer and use it in GitHub Desktop.
Save LuisPalacios/b20f5ea512f1801ca72a13a7c7010f49 to your computer and use it in GitHub Desktop.
Norte: Script parte del firewall, que se ejecuta después de tener la red activa
#!/bin/bash
##
## /root/firewall/sur_firewall_2_post_network.sh
##
## Script que configura iptables en un servidor Raspbian OS
## actuando de "norte" en este apunte:
## https://www.luispa.com/linux/2014/10/19/bridge-ethernet.html
##
##
# Termina de activar reglas de iptables después de activar la red.
#
# Averiguo nombres de las interfaces y rangos de mi red
#
. /root/firewall/norte_firewall_inames.sh
# Me super aseguro que tengo Routing de IPv4 activo
echo 1 > /proc/sys/net/ipv4/ip_forward
# Quito rp_filter
echo 0 > /proc/sys/net/ipv4/conf/all/rp_filter
# Activo RPF selectivamente
echo 0 > /proc/sys/net/ipv4/conf/all/rp_filter
echo 1 > /proc/sys/net/ipv4/conf/default/rp_filter
echo 0 > /proc/sys/net/ipv4/conf/lo/rp_filter
# Físicas
if [ -f /proc/sys/net/ipv4/conf/${ifLanIPTV}/rp_filter ]
then
echo 0 > /proc/sys/net/ipv4/conf/${ifLanIPTV}/rp_filter
fi
if [ -f /proc/sys/net/ipv4/conf/${ifWan}/rp_filter ]
then
echo 1 > /proc/sys/net/ipv4/conf/${ifWan}/rp_filter
fi
# Virtuales
if [ -f /proc/sys/net/ipv4/conf/${ifTunelSur}/rp_filter ]
then
echo 1 > /proc/sys/net/ipv4/conf/${ifTunelSur}/rp_filter
fi
if [ -f /proc/sys/net/ipv4/conf/${ifBridgeIPTV}/rp_filter ]
then
echo 0 > /proc/sys/net/ipv4/conf/${ifBridgeIPTV}/rp_filter
fi
# END
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment