Ahoj,
Tak už jsem zprovoznil. Je nutné mít dle nftables wiki nastaveno chmod u+x na /etc/nftables.conf
Potom už po rebootu běží.
Nftables vypadají skutečně dobře. Jen se v tom ještě motám

Mohl by mě někdo zkušený poradit zda-li je tento můj přiložený fw správný. Jedná se o konfiguracni skript. Můj cíl je firewall s dvěma LAN. Lan 1 192.168.3.22 je WAN Lan 2 172.16.1.0/24 je interní lan pro PC. Tato síť má mít přístup k internetu. Děkuji za případné rady.
#!/usr/sbin/nft -f
# Nft firewall for 2 nic firewall with internal network for internet acces
flush ruleset
table inet filter {
chain input { # specifakace rozhrani pro rozdeleni
type filter hook input priority 0;
iifname lo accept # vzdy povol loopbcak
iifname enp0s25 jump input_wan # 192.168.3.0/26
iifname enp4s0 jump input_lan # 172.16.1.0/24
reject with icmp type port-unreachable # refuse traffic from all other interfaces
}
chain input_wan { # pravidla pro rozhrani wan
ct state {established,related} accept
ct state invalid drop
#ip saddr {192.168.3.16} ip daddr {172.16.1.0/24} ip protocol icmp icmp type echo-request accept
ip saddr {192.168.3.0/26} tcp dport { 22 } log prefix "Wan SSH pripojeni:" accept
reject with icmp type port-unreachable # all other traffic
}
chain input_lan { # pravidla pro rozhrani lan
ct state {established,related} accept
ct state invalid drop
ip saddr {172.16.1.0/24} tcp dport {22} log prefix "Lan SSH pripojeni:" accept
ip protocol icmp icmp type echo-request log accept
tcp dport {domain} log prefix "DNS input pozadavek:" accept # Povoleni DNS pro interni DHCP LAN
udp dport {domain} accept
tcp dport {bootpc,bootps} log prefix "DHCP input pozadavek:" accept # povoleni DHCP z interni site
udp dport {bootpc,bootps} log prefix "DHCP input pozadavek:" accept # povoleni DHCP z interni site
reject with icmp type port-unreachable
}
# OUTPUT retzec
}
table ip output {
chain output {
type filter hook output priority 0;
ct state {established,related,new} accept
ct state invalid drop
ip protocol icmp icmp type {echo-reply} drop
ip protocol icmp drop
udp dport {domain} accept
tcp dport {domain,ntp} accept
reject
}
# NAT pravidla
}
table ip nat { # Povoleni SNAT pro pristup k internetu pro uzivatele z vnitrni site
chain prerouting {
type nat hook prerouting priority 0; policy accept;
iif "enp0s25" tcp dport {3389} log prefix "RDP login:" dnat 172.16.1.3
#iif "enp0s25" ip protocol icmp icmp type echo-request dnat 172.16.1.3
}
chain postrouting {
type nat hook postrouting priority 100; policy accept;
ip saddr 172.16.1.0/24 oif "enp0s25" snat to 192.168.3.22 # SNAT funguje jako maskarada
#masquerade # Povoleni uzivatelu pro pristup k internetu
}
}