Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > it.comp.os.linux.debian > #10620 > unrolled thread

[X-post] Debian Bookworm: Errore nelle righe di nftables

Started by^Bart <gabriele1NOSPAM@hotmail.com>
First post2023-07-19 16:08 +0200
Last post2023-07-22 15:15 +0000
Articles 4 — 3 participants

Back to article view | Back to it.comp.os.linux.debian


Contents

  [X-post] Debian Bookworm: Errore nelle righe di nftables ^Bart <gabriele1NOSPAM@hotmail.com> - 2023-07-19 16:08 +0200
    Re: [X-post] Debian Bookworm: Errore nelle righe di nftables evanmac <evanmac69@gmail.com> - 2023-07-21 15:19 +0000
      Re: [X-post] Debian Bookworm: Errore nelle righe di nftables ^Bart <gabriele1NOSPAM@hotmail.com> - 2023-07-23 23:18 +0200
    Re: [X-post] Debian Bookworm: Errore nelle righe di nftables Giuseppe Della Bianca <giusdbgNO@gmailNO.comNO> - 2023-07-22 15:15 +0000

#10620 — [X-post] Debian Bookworm: Errore nelle righe di nftables

From^Bart <gabriele1NOSPAM@hotmail.com>
Date2023-07-19 16:08 +0200
Subject[X-post] Debian Bookworm: Errore nelle righe di nftables
Message-ID<u98qp9$263ru$1@dont-email.me>
Salve,

sto cercando di passare da iptables ad nftables quindi ho provato a 
leggermi della documentazione di quest'ultimo ed a scrivere qualcosa ma 
ho degli errori di sintassi, di seguito il contenuto del mio file:

#!/bin/bash
#Router script, forward wi-fi to eth for firewall update

#set static ip on eth0
ip a add XXX.XX.XXX.XXX/255.255.255.248 dev enp3s0

#set ipv4 forward
echo 1 > /proc/sys/net/ipv4/ip_forward

#set ip rules by iptables
#iptables -I FORWARD -i enp3s0 -o wlp2s0 -j ACCEPT
#iptables -t nat -I POSTROUTING -o wlp2s0 -j MASQUERADE

#load modules
modprobe nft_nat
modprobe nft_masq

#set ip rules with nftables version 1
nft add table inet gw
#nft flush table inet gw
nft add chain inet gw gw_chain '{ type filter hook input priority 0; }'
#nft flush chain inet gw gw_chain
nft add rule inet gw gw_chain ip filter FORWARD iifname "enp3s0" oifname 
"wlp2s0" accept
nft add rule inet gw gw_chain ip nat postrouting oifname "wlp2s0" masquerade

#set ip rules with nftables version 2
#nft add table inet gw
#nft flush table inet gw
#nft add chain inet gw gw_chain '{type filter hook input priority 0; }'
#nft flush chain inet gw gw_chain
#nft insert rule inet gw gw_chain ip filter FORWARD iifname "enp0s25" 
oifname "wlp2s0" counter accept
#nft insert rule inet gw gw_chain ip nat POSTROUTING oifname "wlp2s0" 
counter masquerade

Come già accennato essendo "nuovo" di nftables di sicuro avrò fatto un 
errore concettuale ma ora devo capire quale... :\

Saluti.
^Bart

[toc] | [next] | [standalone]


#10621

Fromevanmac <evanmac69@gmail.com>
Date2023-07-21 15:19 +0000
Message-ID<khvm0jFq5i2U1@mid.individual.net>
In reply to#10620
il giorno 19 Jul 2023 alle 15:08:42 GMT+1, "^Bart"
<gabriele1NOSPAM@hotmail.com> scrisse:

> ho degli errori di sintassi

riportare esattamente gli errori che ti saltano fuori aiuterebbe il debug...

-- 
this is a random signature

[toc] | [prev] | [next] | [standalone]


#10623

From^Bart <gabriele1NOSPAM@hotmail.com>
Date2023-07-23 23:18 +0200
Message-ID<u9k5ee$bme6$1@dont-email.me>
In reply to#10621
> riportare esattamente gli errori che ti saltano fuori aiuterebbe il debug...

Ci ho lavorato un po' con calma ed ho risolto nel seguente modo:

lush ruleset

table inet filter {
   chain input {
     type filter hook input priority 0; policy accept;
   }
   chain forward {
     type filter hook forward priority 0; policy accept;
     iifname "wlan0" oifname "eth0" accept
   }
   chain output {
     type filter hook output priority 0; policy accept;
   }
}

table nat {
   chain prerouting {
     type nat hook prerouting priority 0; policy accept;
   }
   chain postrouting {
     type nat hook postrouting priority 100;
     oifname "wlan0" masquerade
   }
}

Saluti.
^Bart

[toc] | [prev] | [next] | [standalone]


#10622

FromGiuseppe Della Bianca <giusdbgNO@gmailNO.comNO>
Date2023-07-22 15:15 +0000
Message-ID<u9grrb$3rtek$1@dont-email.me>
In reply to#10620
https://wiki.nftables.org/wiki-nftables/index.php/
Moving_from_iptables_to_nftables

Il Wed, 19 Jul 2023 16:08:42 +0200, ^Bart ha scritto:

> Salve,
> 
> sto cercando di passare da iptables ad nftables quindi ho provato a
> leggermi della documentazione di quest'ultimo ed a scrivere qualcosa ma
> ho degli errori di sintassi, di seguito il contenuto del mio file:
]zac[

[toc] | [prev] | [standalone]


Back to top | Article view | it.comp.os.linux.debian


csiph-web