From 65449fbf98844a2404f2025692ed2d7da7041111 Mon Sep 17 00:00:00 2001 From: "jeremy.thomas" Date: Wed, 26 Mar 2025 15:34:34 +0100 Subject: [PATCH] =?UTF-8?q?D=C3=A9sactivation=20de=20la=20nat?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sisr1/tp04_scripts_admin/EOF | 0 sisr1/tp05-Installation_d_un_proxy/dnsfwd.service | 13 +++++++++++++ sisr1/tp05-Installation_d_un_proxy/dnsfwd.sh | 11 +++++++++++ 3 files changed, 24 insertions(+) create mode 100644 sisr1/tp04_scripts_admin/EOF create mode 100644 sisr1/tp05-Installation_d_un_proxy/dnsfwd.service create mode 100644 sisr1/tp05-Installation_d_un_proxy/dnsfwd.sh diff --git a/sisr1/tp04_scripts_admin/EOF b/sisr1/tp04_scripts_admin/EOF new file mode 100644 index 0000000..e69de29 diff --git a/sisr1/tp05-Installation_d_un_proxy/dnsfwd.service b/sisr1/tp05-Installation_d_un_proxy/dnsfwd.service new file mode 100644 index 0000000..f81a3d4 --- /dev/null +++ b/sisr1/tp05-Installation_d_un_proxy/dnsfwd.service @@ -0,0 +1,13 @@ +[Unit] + +Description=execute /root/dnsfwd.sh + +After=default.target + +[Service] + +ExecStart=bash /root/dnsfwd.sh + +[Install] + +WantedBy=default.target diff --git a/sisr1/tp05-Installation_d_un_proxy/dnsfwd.sh b/sisr1/tp05-Installation_d_un_proxy/dnsfwd.sh new file mode 100644 index 0000000..b7efcbc --- /dev/null +++ b/sisr1/tp05-Installation_d_un_proxy/dnsfwd.sh @@ -0,0 +1,11 @@ +!/bin/bash +echo "1" > /proc/sys/net/ipv4/ip_forward +nft add table dnsfwd +nft add chain dnsfwd prerouting {type nat hook prerouting priority 0 \; } +nft add chain dnsfwd postrouting {type nat hook postrouting priority 0 \; } +nft add rule dnsfwd postrouting tcp dport 53 masquerade +nft add rule dnsfwd postrouting udp dport 53 masquerade +nft add rule dnsfwd prerouting tcp dport 53 masquerade +nft add rule dnsfwd prerouting udp dport 53 masquerade +nft add rule dnsfwd prerouting ct state established,related accept +nft add rule dnsfwd postrouting ct state established,related accept