2018-10-14 16:49:38 +00:00
|
|
|
#! /sbin/nft -f
|
|
|
|
|
|
|
|
table inet firewall {
|
|
|
|
|
|
|
|
chain to_aloes {
|
2019-02-09 09:23:05 +00:00
|
|
|
accept
|
2018-10-14 16:49:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
chain from_aloes {
|
|
|
|
# On passe d'abord par le checkmac pour éviter le spoof d'ip:
|
2019-02-09 09:23:05 +00:00
|
|
|
#ip saddr . ether saddr != @ip_mac drop;
|
2018-10-14 16:49:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2019-01-08 23:21:24 +00:00
|
|
|
|
|
|
|
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.
|
2019-02-09 09:23:05 +00:00
|
|
|
# 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}
|
2019-01-08 23:21:24 +00:00
|
|
|
map aloes_nat_address {
|
|
|
|
type ipv4_addr: ipv4_addr
|
|
|
|
flags interval
|
|
|
|
}
|
2019-02-09 09:23:05 +00:00
|
|
|
# exemple: 10.66.0.1 : 11135-12834
|
|
|
|
# On peut aussi ajouter dynamiquement des éléments :
|
|
|
|
# nft add element nat federez_nat_port {10.66.0.1 : 11135-12834}
|
2019-01-08 23:21:24 +00:00
|
|
|
map aloes_nat_port {
|
|
|
|
type ipv4_addr: inet_service
|
|
|
|
flags interval
|
2019-02-09 09:23:05 +00:00
|
|
|
}
|
|
|
|
chain aloes_nat {
|
|
|
|
ip protocol tcp snat ip saddr map @aloes_nat_address : ip saddr map @aloes_nat_port
|
|
|
|
ip protocol udp snat ip saddr map @aloes_nat_address : ip saddr map @aloes_nat_port
|
2019-01-08 23:21:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|