# Erreur nftable

**URL:** <https://www.debian-fr.org/t/erreur-nftable/85074>\
**Category:** Support Debian\
**Created:** [Août 7, 2021, 12:49 UTC](https://www.debian-fr.org/t/erreur-nftable/85074 "2021-08-07T00:49:44Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![olivbarb](https://www.debian-fr.org/letter_avatar_proxy/v4/letter/o/db5fbb/32.png) [@olivbarb](https://www.debian-fr.org/u/olivbarb)\
**Post date:** [Août 7, 2021, 12:49 UTC](https://www.debian-fr.org/t/erreur-nftable/85074/1 "2021-08-07T00:49:44Z")

</div>

Bonjour,

J’ai décidé de passer de iptable à nftable mais j’ai un petit soucis avec mon fichier de règles nftable que voici .

```
flush ruleset

table inet filter {
	chain input {
			type filter hook input priority 0;

			iif lo accept

			ct state established, related accept

			tcp dport http accept
			tcp dport https accept

			tcp flag & (fin | syn | rst | psh | ack | urg) > urg counter packets 0 bytes 0
			tcp flag & (fin | syn | rst | psh | ack | urg) < fin counter packets 0 bytes 0

			icmp type echo-reply accept
			icmpv6 type echo-reply accept

			drop
		}

    	chain forward {
            		type filter hook forward priority 0;
            	

			drop
    		}

	chain output {
			type filter hook output priority 0;
			

			iif lo accept

			ct state established, related accept

			tcp dport https accept

			udp dport domain accept

			udp dport ntp accept

			icmp type echo-request accept
			icmpv6 type echo-request accept

			drop
		}
}

```

Or lorsque je fais /usr/sbin/nft -f nftables.txt

Voici toutes les erreurs que j’obtiens  
nftables.rules:1:14-14: Error: syntax error, unexpected junk, expecting end of file or newline or semicolon  
flush ruleset  
^  
nftables.rules:2:1-1: Error: syntax error, unexpected junk

^  
nftables.rules:3:1-1: Error: syntax error, unexpected junk

^  
nftables.rules:4:20-20: Error: syntax error, unexpected junk  
table inet filter {  
^  
nftables.rules:5:16-16: Error: syntax error, unexpected junk  
chain input {

Je suis sous debian 11

Merci de votre aide

---

<div class="post-metadata">

**Author:** ![grandtoubab](https://www.debian-fr.org/user_avatar/www.debian-fr.org/grandtoubab/32/4505_2.png) [@grandtoubab](https://www.debian-fr.org/u/grandtoubab)\
**Post date:** [Août 7, 2021, 9:44 UTC](https://www.debian-fr.org/t/erreur-nftable/85074/2 "2021-08-07T09:44:52Z")

</div>

j’utilise nftables comme ça

> **[Pare-feu: nftables](https://bidouilledebian.wordpress.com/2019/02/19/pare-feu-nftables/)**
>
> Comme nftables va devenir le pare-feu par défaut dans Debian, j’ai activé l’outil.

---

<div class="post-metadata">

**Author:** ![DarkGagan](https://www.debian-fr.org/user_avatar/www.debian-fr.org/darkgagan/32/4093_2.png) [@DarkGagan](https://www.debian-fr.org/u/DarkGagan)\
**Post date:** [Août 7, 2021, 9:48 UTC](https://www.debian-fr.org/t/erreur-nftable/85074/3 "2021-08-07T09:48:56Z")

</div>

Hello, je ne connais pas trop nftables mais tes lignes doivent peut-être se terminer par un caractère?

Genre comme un «&nbsp;;&nbsp;» en css

---

<div class="post-metadata">

**Author:** ![Zargos](https://www.debian-fr.org/user_avatar/www.debian-fr.org/zargos/32/10889_2.png) [@Zargos](https://www.debian-fr.org/u/Zargos)\
**Post date:** [Août 7, 2021, 10:52 UTC](https://www.debian-fr.org/t/erreur-nftable/85074/4 "2021-08-07T10:52:58Z")

</div>

Certaines lignes oui (comme la déclaration type) les autres non, une règle une ligne.

---

<div class="post-metadata">

**Author:** ![PascalHambourg](https://www.debian-fr.org/user_avatar/www.debian-fr.org/pascalhambourg/32/5837_2.png) [@PascalHambourg](https://www.debian-fr.org/u/PascalHambourg)\
**Post date:** [Août 7, 2021, 11:50 UTC](https://www.debian-fr.org/t/erreur-nftable/85074/5 "2021-08-07T11:50:50Z")

</div>

Comment as-tu créé/édité/transféré ce fichier ?  
Il a peut-être des fins de ligne au format DOS/Windows (CR+LF) au lieu du format Unix (LF). A vérifier avec

```
hd -n 32 nftables.txt

```

(oui, `file` afficherait le type de fin de ligne plus convivialement, mais l’affichage en hexa permet de voir d’autres anomalies comme des caractères non imprimables)

---

<div class="post-metadata">

**Author:** ![Zargos](https://www.debian-fr.org/user_avatar/www.debian-fr.org/zargos/32/10889_2.png) [@Zargos](https://www.debian-fr.org/u/Zargos)\
**Post date:** [Août 7, 2021, 12:25 UTC](https://www.debian-fr.org/t/erreur-nftable/85074/6 "2021-08-07T12:25:21Z")

</div>

ou meme un cat -A 🙂

---

<div class="post-metadata">

**Author:** ![olivbarb](https://www.debian-fr.org/letter_avatar_proxy/v4/letter/o/db5fbb/32.png) [@olivbarb](https://www.debian-fr.org/u/olivbarb)\
**Post date:** [Août 7, 2021, 1:16 UTC](https://www.debian-fr.org/t/erreur-nftable/85074/7 "2021-08-07T13:16:21Z")

</div>

C’est ça, le fichier a été fait sous windows et pb avec le retour à la ligne, j’ai refais le fichier sous debian et plus de pb. Merci à tous pour vos réponses.

---

<div class="post-metadata">

**Author:** ![Zargos](https://www.debian-fr.org/user_avatar/www.debian-fr.org/zargos/32/10889_2.png) [@Zargos](https://www.debian-fr.org/u/Zargos)\
**Post date:** [Août 7, 2021, 1:21 UTC](https://www.debian-fr.org/t/erreur-nftable/85074/8 "2021-08-07T13:21:36Z")

</div>

**tr -d ‹&nbsp;\r&nbsp;› \< /mon\_fichier\_source \> /mon\_fichier\_destination**
