Skip to content

Instantly share code, notes, and snippets.

@LuisPalacios
Last active March 7, 2023 18:15
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/1a38011c97fc33f8c6e8a46497df5ef5 to your computer and use it in GitHub Desktop.
Save LuisPalacios/1a38011c97fc33f8c6e8a46497df5ef5 to your computer and use it in GitHub Desktop.
Norte: Script que define las interfaces para el firewall
#!/bin/bash
##
## /root/firewall/norte_firewall_inames.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
##
##
# Nombres de las interfaces
#
#export ifInternet=`ip route show default | awk 'match($0,/dev [^ ]*/){ print substr($0, RSTART,RLENGTH)}' | awk '{print $2}'`
export ifWan="eth0"
export ifLanIPTV="eth1"
export ifTunelSur="tun1"
export ifBridgeIPTV="br206"
# Mi propia IP en las diferentes interfaces
export ipWan=`ip addr show dev ${ifWan} | egrep -o 'inet [0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | cut -d' ' -f2`
export ipLanIPTV=`ip addr show dev ${ifLanIPTV} | egrep -o 'inet [0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | cut -d' ' -f2`
export ipBridgeIPTV=`ip addr show dev ${ifBridgeIPTV} | egrep -o 'inet [0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | cut -d' ' -f2`
## REDES PRIVADAS desde las que acepto tráfico
# Prefijos separados por espacios
#
export INTRANET="192.168.1.0/24 192.168.206.0/24 192.168.107.0/24 192.168.10.0/24 192.168.224.0/24 192.168.222.0/24"
export PREFIJOS_MOVISTAR_IPTV="172.23/16 172.26/16 239.0.0.0/16"
echo "WAN Interfaz Internet ifWan : ${ifWan} - ${ipWan}"
echo "LAN IPTV ifLanIPTV : ${ifLanIPTV} - ${ipLanIPTV}"
echo "Tunel Sur ifTunelSur : ${ifTunelSur}"
echo "Bridge IPTV ifBridgeIPTV : ${ifBridgeIPTV} - ${ipBridgeIPTV}"
echo "INTRANET : ${INTRANET}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment