firewall/nat.nft

38 lines
1.1 KiB
Plaintext
Raw Normal View History

2019-01-07 22:48:42 +00:00
#! /sbin/nft -f
2019-02-09 09:23:05 +00:00
table ip nat {
2019-04-29 22:12:26 +00:00
set radius_federez {
type ipv4_addr
2019-11-13 20:37:34 +00:00
elements = { 195.154.165.76, 185.230.78.47 }
2019-04-29 22:12:26 +00:00
}
2019-01-07 22:48:42 +00:00
chain prerouting {
type nat hook prerouting priority 0;
2019-04-29 22:12:26 +00:00
ip saddr $range_prerezotage ip daddr != { $intranet, $comnpay, $website } tcp dport {http,https} dnat $bounce_server;
ip saddr @radius_federez ip daddr $ip_self_public tcp dport { 636, 389 } dnat $ip_radius;
2019-05-20 08:56:31 +00:00
ip saddr @radius_federez ip daddr $ip_self_public udp dport { 636, 1812 } dnat $ip_radius;
2019-01-07 22:48:42 +00:00
}
chain postrouting {
type nat hook postrouting priority 100
2019-02-09 09:23:05 +00:00
meta oifname != $if_supelec return
2019-03-26 21:02:43 +00:00
2019-05-20 08:56:31 +00:00
ip saddr $ip_radius ip daddr @radius_federez tcp dport { 636, 389} snat to $ip_self_public
ip saddr $ip_radius ip daddr @radius_federez udp dport { 636, 1812 } snat to $ip_self_public
2019-04-29 22:12:26 +00:00
ip daddr != {10.0.0.0/8, $range_public} ip saddr vmap {
$range_adherent : goto adherent_nat,
$range_admin : goto admin_nat,
$range_federez : goto federez_nat,
$range_aloes : goto aloes_nat,
$range_prerezotage : goto prerezotage_nat
2019-03-26 21:02:43 +00:00
}
2019-04-29 22:12:26 +00:00
ip daddr != {10.0.0.0/8, $range_public} ip saddr != $range_public snat to $ip_self_public
2019-01-07 22:48:42 +00:00
}
}