{"id":162,"date":"2015-08-28T11:15:31","date_gmt":"2015-08-28T10:15:31","guid":{"rendered":"http:\/\/sizious.com\/fr\/?p=162"},"modified":"2015-08-28T11:15:31","modified_gmt":"2015-08-28T10:15:31","slug":"configurer-une-ip-fixe-sur-le-raspberry-pi-avec-raspbian-20150505","status":"publish","type":"post","link":"https:\/\/sizious.com\/fr\/2015\/08\/28\/configurer-une-ip-fixe-sur-le-raspberry-pi-avec-raspbian-20150505\/","title":{"rendered":"Configurer une IP fixe sur le Raspberry Pi avec Raspbian 20150505"},"content":{"rendered":"<p>Pour configurer une adresse IP fixe sur un\u00a0<strong>Raspberry Pi <\/strong>tournant sur le <a href=\"https:\/\/www.raspberrypi.org\/downloads\/noobs\/\" target=\"_blank\">dernier Rapsbian disponible<\/a> \u00e0 ce jour (<strong>20150505<\/strong> via <strong>NOOBS v1.4.1<\/strong>), l&rsquo;ancienne m\u00e9thode consistant \u00e0 modifier le fichier <span class=\"lang:default decode:true crayon-inline \">\/etc\/network\/interfaces<\/span>\u00a0ne fonctionne plus aussi bien qu&rsquo;avant. En effet, si vous modifiez ce fichier (notamment en changeant l&rsquo;interface <span class=\"lang:default decode:true crayon-inline \">eth0<\/span>\u00a0de <span class=\"lang:default decode:true crayon-inline \">static<\/span>\u00a0vers <span class=\"lang:default decode:true crayon-inline\">manual<\/span>), votre <strong>Raspberry Pi<\/strong> va r\u00e9cup\u00e9rer 2 adresses IP pour la m\u00eame interface <span class=\"lang:default decode:true crayon-inline\">eth0<\/span>, ce qui \u00ab\u00a0craint\u00a0\u00bb pour ma part.<\/p>\n<p>Le \u00ab\u00a0fautif\u00a0\u00bb est le service (daemon) <span class=\"lang:default decode:true crayon-inline\">dhcpcd<\/span>, qui est le client DHCP. Celui-ci semble se lancer avant l&rsquo;analyse du fichier <span class=\"lang:default decode:true crayon-inline \">\/etc\/network\/interfaces<\/span>\u00a0par le syst\u00e8me.<\/p>\n<p>Vous avez 3 options :<\/p>\n<ol>\n<li>Configurer comme avant dans le fichier <span class=\"lang:default decode:true crayon-inline \">\/etc\/network\/interfaces<\/span>\u00a0puis d\u00e9sactiver le daemon <span class=\"lang:default decode:true crayon-inline \">dhcpcd<\/span>\u00a0avec la commande <span class=\"lang:default decode:true crayon-inline\">sudo update-rc.d -f dhcpcd remove<\/span> (vous pouvez revenir en arri\u00e8re avec <span class=\"lang:default decode:true  crayon-inline\">sudo update-rc.d dhcpcd defaults<\/span>). <strong>Mais vraiment, ne faites pas \u00e7a<\/strong>;<\/li>\n<li>Configurer un bail DHCP statique dans la configuration de votre routeur (votre Livebox, Freebox, ou autre);<\/li>\n<li>Ou bien forcer le daemon <span class=\"lang:default decode:true  crayon-inline \">dhcpcd<\/span>\u00a0\u00e0 r\u00e9cup\u00e9rer l&rsquo;adresse IP qui vous pla\u00eet. <strong>C&rsquo;est vraiment la meilleure solution pour moi.<\/strong><\/li>\n<\/ol>\n<p>Pour mettre en place la derni\u00e8re solution, juste entrez\u00a0<span class=\"lang:default decode:true  crayon-inline \">sudo nano \/etc\/dhcpcd.conf<\/span>\u00a0puis \u00e0 la fin du fichier, ajouter ce qui suit :<\/p>\n<pre class=\"lang:default decode:true \" title=\"\/etc\/dhcpcd.conf\"># Custom static IP address for eth0.\r\ninterface eth0\r\nstatic ip_address=192.168.0.200\/24\r\nstatic routers=192.168.0.1\r\nstatic domain_name_servers=192.168.0.1<\/pre>\n<p>Bien s\u00fbr, ajustez en fonction de vos besoins. L&rsquo;adresse IP\u00a0<span class=\"lang:default decode:true  crayon-inline \">192.168.0.1<\/span>\u00a0fait r\u00e9f\u00e9rence au routeur de mon fournisseur d&rsquo;acc\u00e8s. Attention, sur la Livebox, c&rsquo;est\u00a0<span class=\"lang:default decode:true  crayon-inline \">192.168.1.1<\/span>\u00a0par d\u00e9faut, et sur la Freebox, c&rsquo;est\u00a0<span class=\"lang:default decode:true  crayon-inline \">192.168.0.254<\/span>\u00a0!<\/p>\n<p>Apr\u00e8s cette modification, red\u00e9marrez l&rsquo;interface r\u00e9seau ou bien faites simplement un red\u00e9marrage (reboot). Maintenant, votre <strong>Raspberry Pi<\/strong> obtiendra bien une seule adresse IP fixe !<\/p>\n<p><strong>Note :<\/strong> Pour ceux qui pr\u00e9f\u00e8re ne pas mettre d&rsquo;adresse IP en dur dans le <strong>Raspberry Pi<\/strong>, la deuxi\u00e8me solution est bien s\u00fbr la meilleure.<\/p>\n<p>Sources :<\/p>\n<ul>\n<li><a href=\"https:\/\/www.raspberrypi.org\/forums\/viewtopic.php?f=63&amp;t=110606\" target=\"_blank\">\/etc\/network\/interfaces has changed<\/a><\/li>\n<li><a href=\"https:\/\/www.raspberrypi.org\/forums\/viewtopic.php?f=28&amp;t=117350&amp;p=804580\" target=\"_blank\">Single static IP address for eth0<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Pour configurer une adresse IP fixe sur un\u00a0Raspberry Pi tournant sur le dernier Rapsbian disponible \u00e0 ce jour (20150505 via NOOBS v1.4.1), l&rsquo;ancienne m\u00e9thode consistant \u00e0 modifier le fichier \/etc\/network\/interfaces\u00a0ne fonctionne plus aussi bien qu&rsquo;avant. En effet, si vous modifiez ce fichier (notamment en changeant l&rsquo;interface eth0\u00a0de static\u00a0vers manual), votre Raspberry Pi va r\u00e9cup\u00e9rer 2\u2026 <span class=\"read-more\"><a href=\"https:\/\/sizious.com\/fr\/2015\/08\/28\/configurer-une-ip-fixe-sur-le-raspberry-pi-avec-raspbian-20150505\/\">Lire la suite &raquo;<\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[6],"tags":[],"class_list":["post-162","post","type-post","status-publish","format-standard","hentry","category-raspberry-pi"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/sizious.com\/fr\/wp-json\/wp\/v2\/posts\/162","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sizious.com\/fr\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sizious.com\/fr\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sizious.com\/fr\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sizious.com\/fr\/wp-json\/wp\/v2\/comments?post=162"}],"version-history":[{"count":1,"href":"https:\/\/sizious.com\/fr\/wp-json\/wp\/v2\/posts\/162\/revisions"}],"predecessor-version":[{"id":163,"href":"https:\/\/sizious.com\/fr\/wp-json\/wp\/v2\/posts\/162\/revisions\/163"}],"wp:attachment":[{"href":"https:\/\/sizious.com\/fr\/wp-json\/wp\/v2\/media?parent=162"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sizious.com\/fr\/wp-json\/wp\/v2\/categories?post=162"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sizious.com\/fr\/wp-json\/wp\/v2\/tags?post=162"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}