{"id":26044,"date":"2025-05-14T10:00:00","date_gmt":"2025-05-14T08:00:00","guid":{"rendered":"https:\/\/monraspberry.com\/?p=26044"},"modified":"2025-05-13T15:43:22","modified_gmt":"2025-05-13T13:43:22","slug":"transformer-un-raspberry-pi-en-routeur","status":"publish","type":"post","link":"https:\/\/monraspberry.com\/en\/transformer-un-raspberry-pi-en-routeur\/","title":{"rendered":"Turning a Raspberry Pi into a router"},"content":{"rendered":"<h2 class=\"wp-block-heading\">Introduction<\/h2>\n\n\n\n<p>Dans un monde o\u00f9 le contr\u00f4le et la s\u00e9curit\u00e9 de votre r\u00e9seau domestique sont essentiels, le <strong>Raspberry Pi<\/strong> s\u2019impose comme une solution flexible et abordable pour cr\u00e9er votre propre <strong>routeur<\/strong>. Que vous souhaitiez segmenter votre r\u00e9seau, mettre en place un <strong>VPN<\/strong> ou filtrer les publicit\u00e9s avec <strong>Pi-hole<\/strong>, ce mini-ordinateur peut remplacer un routeur traditionnel. Ce guide ultra complet vous accompagnera de l\u2019installation du syst\u00e8me \u00e0 la configuration avanc\u00e9e, tout en optimisant votre contenu pour un r\u00e9f\u00e9rencement Google maximal.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Pourquoi choisir un Raspberry Pi comme routeur ?<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Co\u00fbt ma\u00eetris\u00e9<\/strong> : un Raspberry Pi 4 co\u00fbte moins cher qu\u2019un routeur haut de gamme.<\/li>\n\n\n\n<li><strong>Flexibilit\u00e9 logicielle<\/strong> : Libre choix entre <strong>OpenWRT<\/strong>, <strong>Raspbian<\/strong>, <strong>Pi-hole<\/strong>, <strong>WireGuard<\/strong>, etc.<\/li>\n\n\n\n<li><strong>Personnalisation avanc\u00e9e<\/strong> : QoS (Quality of Service), VLAN, VPN.<\/li>\n\n\n\n<li><strong>\u00c9co-responsable<\/strong> : faible consommation \u00e9lectrique (&lt; 5 W).<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">Pr\u00e9requis mat\u00e9riels et logiciels<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Mat\u00e9riel<\/strong> :\n<ul class=\"wp-block-list\">\n<li>Un Raspberry Pi 4 (minimum 2 Go de RAM)<\/li>\n\n\n\n<li>1 carte microSD (16 Go conseill\u00e9s, classe 10)<\/li>\n\n\n\n<li>Un bo\u00eetier ventil\u00e9 (optionnel mais recommand\u00e9)<\/li>\n\n\n\n<li>2 adaptateurs Ethernet USB (si pas de port RJ45 suppl\u00e9mentaire)<\/li>\n\n\n\n<li>Alimentation 5 V\/3 A<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Logiciels<\/strong> :\n<ul class=\"wp-block-list\">\n<li><strong>Raspberry Pi OS Lite<\/strong> or <strong>OpenWRT<\/strong> for Raspberry Pi<\/li>\n\n\n\n<li><strong>Etcher<\/strong> (flashage de la microSD)<\/li>\n\n\n\n<li><strong>SSH<\/strong> (client PuTTY ou terminal macOS\/Linux)<\/li>\n\n\n\n<li><strong>Paquets<\/strong> : dnsmasq, hostapd, iptables, openvpn ou wireguard<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">\u00c9tape 1 : Installation du syst\u00e8me d\u2019exploitation<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li>T\u00e9l\u00e9chargez l\u2019image de <strong>Raspberry Pi OS Lite<\/strong> (ou <strong>OpenWRT<\/strong>) depuis le site officiel.<\/li>\n\n\n\n<li>Flashez la carte microSD avec <strong>Etcher<\/strong>.<\/li>\n\n\n\n<li>Activez SSH en cr\u00e9ant un fichier vide nomm\u00e9 <code>ssh<\/code> \u00e0 la racine de la partition <code>boot<\/code>.<\/li>\n\n\n\n<li>Ins\u00e9rez la carte, branchez l\u2019alimentation et connectez-vous en SSH :<\/li>\n<\/ol>\n\n\n<div class=\"wp-block-syntaxhighlighter-code\"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nssh pi@192.168.1.100  # mot de passe par d\u00e9faut : raspberry\n<\/pre><\/div>\n\n\n<h2 class=\"wp-block-heading\">\u00c9tape 2 : Configuration r\u00e9seau de base<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Attribuer des IP statiques<\/strong> dans <code>\/etc\/dhcpcd.conf<\/code> :<\/li>\n<\/ul>\n\n\n<div class=\"wp-block-syntaxhighlighter-code\"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\ninterface eth0\nstatic ip_address=192.168.0.1\/24\nnohook wpa_supplicant\n<\/pre><\/div>\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Installer et configurer dnsmasq<\/strong> (serveur DHCP &amp; DNS) dans <code>\/etc\/dnsmasq.conf<\/code> :<\/li>\n<\/ul>\n\n\n<div class=\"wp-block-syntaxhighlighter-code\"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\ninterface=eth0\ndhcp-range=192.168.0.50,192.168.0.150,12h\n<\/pre><\/div>\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Activer le forwarding IP<\/strong> :<\/li>\n<\/ul>\n\n\n<div class=\"wp-block-syntaxhighlighter-code\"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nsudo sed -i &#039;s\/#net.ipv4.ip_forward=1\/net.ipv4.ip_forward=1\/&#039; \/etc\/sysctl.conf\nsudo sysctl -p\n<\/pre><\/div>\n\n\n<h2 class=\"wp-block-heading\">\u00c9tape 3 : Mise en place du Wi-Fi (optionnel)<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Installez <strong>hostapd<\/strong> : <code>sudo apt install hostapd<\/code>.<\/li>\n\n\n\n<li>Configurez <code>\/etc\/hostapd\/hostapd.conf<\/code> :<\/li>\n<\/ul>\n\n\n<div class=\"wp-block-syntaxhighlighter-code\"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\ninterface=wlan0\nssid=Mon_Routeur_Pi\nhw_mode=g\nchannel=6\nwpa=2\nwpa_passphrase=MotDePasseUltraSecurise\n<\/pre><\/div>\n\n\n<ul class=\"wp-block-list\">\n<li>Pointez le daemon vers ce fichier dans <code>\/etc\/default\/hostapd<\/code> :<\/li>\n<\/ul>\n\n\n<div class=\"wp-block-syntaxhighlighter-code\"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nDAEMON_CONF=&quot;\/etc\/hostapd\/hostapd.conf&quot;\n<\/pre><\/div>\n\n\n<ul class=\"wp-block-list\">\n<li>Red\u00e9marrez les services :<\/li>\n<\/ul>\n\n\n<div class=\"wp-block-syntaxhighlighter-code\"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nsudo systemctl enable hostapd dnsmasq\nsudo systemctl restart hostapd dnsmasq\n<\/pre><\/div>\n\n\n<h2 class=\"wp-block-heading\">\u00c9tape 4 : S\u00e9curisation et optimisation<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Pare-feu iptables<\/strong> :<\/li>\n<\/ul>\n\n\n<div class=\"wp-block-syntaxhighlighter-code\"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nsudo iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE\nsudo iptables-save | sudo tee \/etc\/iptables.ipv4.nat\n<\/pre><\/div>\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Configuration Pi-hole<\/strong> (filtrage publicitaire) :\n<ul class=\"wp-block-list\">\n<li>Installez avec :<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n<div class=\"wp-block-syntaxhighlighter-code\"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\ncurl -sSL https:\/\/install.pi-hole.net | bash\n<\/pre><\/div>\n\n\n<p>D\u00e9sactivitez dnsmasq interne et conservez le v\u00f4tre.<\/p>\n\n\n\n<p><strong>VPN WireGuard<\/strong> pour un acc\u00e8s distant s\u00e9curis\u00e9 :<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><code>sudo apt install wireguard<\/code><\/li>\n\n\n\n<li>G\u00e9n\u00e9rez cl\u00e9s publiques\/priv\u00e9es, configurez <code>\/etc\/wireguard\/wg0.conf<\/code>.<\/li>\n\n\n\n<li>Activez et d\u00e9marrez le service :<\/li>\n<\/ol>\n\n\n<div class=\"wp-block-syntaxhighlighter-code\"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nsudo systemctl enable wg-quick@wg0\nsudo systemctl start wg-quick@wg0\n<\/pre><\/div>\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p>Transformer votre Raspberry Pi en routeur est \u00e0 la fois abordable et p\u00e9dagogique. Vous gagnez en contr\u00f4le, en s\u00e9curit\u00e9 et en personnalisation pour votre r\u00e9seau domestique. N\u2019h\u00e9sitez pas \u00e0 adapter chaque \u00e9tape \u00e0 vos besoins sp\u00e9cifiques (VPN, VLAN, filtrage). Pour des articles compl\u00e9mentaires, d\u00e9couvrez :<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/monraspberry.com\/en\/acceder-a-son-raspberry-pi-de-nimporte-ou-grace-a-tailscale\/\">Installer un VPN sur Raspberry Pi<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/monraspberry.com\/en\/pi-hole-sur-raspberry-pi-une-solution-de-blocage-publicitaire\/\">Guide Pi-hole avanc\u00e9<\/a><\/li>\n<\/ul>","protected":false},"excerpt":{"rendered":"<p>Introduction Dans un monde o\u00f9 le contr\u00f4le et la s\u00e9curit\u00e9 de votre r\u00e9seau domestique sont essentiels, le Raspberry Pi s\u2019impose comme une solution flexible et abordable pour cr\u00e9er votre propre routeur. Que vous souhaitiez segmenter votre r\u00e9seau, mettre en place un VPN ou filtrer les publicit\u00e9s avec Pi-hole, ce mini-ordinateur peut remplacer un routeur traditionnel. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":26045,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[293],"tags":[],"class_list":["post-26044","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-guide"],"featured_image_src":{"landsacpe":["https:\/\/monraspberry.com\/wp-content\/uploads\/2025\/05\/Transformer-un-Raspberry-Pi-en-routeur.png",791,445,false],"list":["https:\/\/monraspberry.com\/wp-content\/uploads\/2025\/05\/Transformer-un-Raspberry-Pi-en-routeur.png",463,260,false],"medium":["https:\/\/monraspberry.com\/wp-content\/uploads\/2025\/05\/Transformer-un-Raspberry-Pi-en-routeur-300x169.png",300,169,true],"full":["https:\/\/monraspberry.com\/wp-content\/uploads\/2025\/05\/Transformer-un-Raspberry-Pi-en-routeur.png",1920,1080,false]},"jetpack_featured_media_url":"https:\/\/monraspberry.com\/wp-content\/uploads\/2025\/05\/Transformer-un-Raspberry-Pi-en-routeur.png","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/monraspberry.com\/en\/wp-json\/wp\/v2\/posts\/26044","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/monraspberry.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/monraspberry.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/monraspberry.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/monraspberry.com\/en\/wp-json\/wp\/v2\/comments?post=26044"}],"version-history":[{"count":0,"href":"https:\/\/monraspberry.com\/en\/wp-json\/wp\/v2\/posts\/26044\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/monraspberry.com\/en\/wp-json\/wp\/v2\/media\/26045"}],"wp:attachment":[{"href":"https:\/\/monraspberry.com\/en\/wp-json\/wp\/v2\/media?parent=26044"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/monraspberry.com\/en\/wp-json\/wp\/v2\/categories?post=26044"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/monraspberry.com\/en\/wp-json\/wp\/v2\/tags?post=26044"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}