#! /sbin/nft -f # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # Copyright © 2018-2019 Hugo Levy-Falk table inet firewall { chain to_aloes { accept } chain from_aloes { # On passe d'abord par le checkmac pour éviter le spoof d'ip: #ip saddr . ether saddr != @ip_mac drop; } } table nat { # On nate ALOES derrière l'IP 193.48.225.214 # attribuant les plages de ports 11135-65535 par tranche de 1700 ports. # On a donc 32 Ips de 10.66.0.0/27 derrière l'Ip. # exemple: 10.66.0.1-10.66.0.31 : 193.48.225.214 # On peut aussi ajouter dynamiquement des éléments : # nft add element nat federez_nat_address {10.66.0.1-10.66.0.31 : 193.48.225.214} map aloes_nat_address { type ipv4_addr: ipv4_addr flags interval } chain aloes_nat { } }