Created
March 7, 2023 17:22
-
-
Save LuisPalacios/c218c0a3ac0fdc791f9576475620789a to your computer and use it in GitHub Desktop.
Sur: Script parte del firewall, que se ejecuta después de tener la red activa
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
## | |
## /root/firewall/sur_firewall_2_post_network.sh | |
## | |
## Script que configura iptables en un servidor Raspbian OS | |
## | |
## Este fichero está relacionado con este apunte: | |
## https://www.luispa.com/linux/2014/10/19/bridge-ethernet.html | |
## | |
## | |
# Script para activar reglas de iptables después de activar la red. | |
# | |
# Averiguo nombres de las interfaces y rangos de mi red | |
# | |
. /root/firewall/sur_firewall_inames.sh | |
# Me super aseguro que tengo Routing de IPv4 activo | |
echo 1 > /proc/sys/net/ipv4/ip_forward | |
# 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/${ifWan}/rp_filter ] | |
then | |
echo 1 > /proc/sys/net/ipv4/conf/${ifWan}/rp_filter | |
fi | |
if [ -f /proc/sys/net/ipv4/conf/${ifLanInternetViaNorte}/rp_filter ] | |
then | |
echo 1 > /proc/sys/net/ipv4/conf/${ifLanInternetViaNorte}/rp_filter | |
fi | |
if [ -f /proc/sys/net/ipv4/conf/${ifLanInternetViaSur}/rp_filter ] | |
then | |
echo 1 > /proc/sys/net/ipv4/conf/${ifLanInternetViaSur}/rp_filter | |
fi | |
# Virtuales | |
if [ -f /proc/sys/net/ipv4/conf/${ifTunelNorte}/rp_filter ] | |
then | |
echo 1 > /proc/sys/net/ipv4/conf/${ifTunelNorte}/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