{"id":3574,"date":"2016-03-17T22:40:10","date_gmt":"2016-03-17T21:40:10","guid":{"rendered":"http:\/\/michlstechblog.info\/blog\/?p=3574"},"modified":"2016-04-01T10:22:22","modified_gmt":"2016-04-01T08:22:22","slug":"systemd-setup-a-static-ip-address","status":"publish","type":"post","link":"https:\/\/michlstechblog.info\/blog\/systemd-setup-a-static-ip-address\/","title":{"rendered":"Systemd: Setup a static IP Address"},"content":{"rendered":"<div class=\"twoclick_social_bookmarks_post_3574 social_share_privacy clearfix 1.6.4 locale-en_US sprite-en_US\"><\/div><div class=\"twoclick-js\"><script type=\"text\/javascript\">\/* <![CDATA[ *\/\njQuery(document).ready(function($){if($('.twoclick_social_bookmarks_post_3574')){$('.twoclick_social_bookmarks_post_3574').socialSharePrivacy({\"services\":{\"flattr\":{\"uid\":\"Michl\",\"status\":\"on\",\"the_title\":\"Systemd%3A%20Setup%20a%20static%20IP%20Address\",\"the_excerpt\":\"Hi%2C%0D%0A%0D%0Aan%20very%20often%20requested%20issue.%20I%20will%20show%20this%20on%20Debian%20Jessie%0D%0A%0D%0AWe%20assume%20we%20want%20to%20set%20a%20static%20IP%20Address%20for%20eth0%0D%0A%20%28more%26hellip%3B%29\",\"txt_info\":\"2 clicks for more data protection:\\r\\n\\r\\nOnly when you click here, the button will be come active and you can send your recommendation to Flattr. When activating, data are transmitted to third parties. \",\"perma_option\":\"off\"}},\"txt_help\":\"When you activate these fields by clicking, information to Flattr may be transferred abroad, and probably may also stored there.\",\"settings_perma\":\"Enable permanently and accept data transmission. \",\"info_link\":\"http:\\\/\\\/www.heise.de\\\/ct\\\/artikel\\\/2-Klicks-fuer-mehr-Datenschutz-1333879.html\",\"uri\":\"https:\\\/\\\/michlstechblog.info\\\/blog\\\/systemd-setup-a-static-ip-address\\\/\",\"post_id\":3574,\"post_title_referrer_track\":\"Systemd%3A+Setup+a+static+IP+Address\",\"display_infobox\":\"on\"});}});\n\/* ]]> *\/<\/script><\/div><p>Hi,<\/p>\n<p>an very often requested issue. I will show this on Debian Jessie<\/p>\n<p>We assume we want to set a static IP Address for eth0<br \/>\n<!--more--><br \/>\nCreate new file <strong>\/etc\/systemd\/network\/eth0.network<\/strong>. Name is not importend, just the prefix network.<br \/>\n<code><br \/>\n[Match]<br \/>\n# You can also use wildcards. Maybe you want enable dhcp<br \/>\n# an all eth* NICs<br \/>\nName=eth0<br \/>\n[Network]<br \/>\n#DHCP=v4<br \/>\n# static IP<br \/>\n# 192.168.100.2 netmask 255.255.255.0<br \/>\nAddress=192.168.100.2\/24<br \/>\nGateway=192.168.100.1<br \/>\nDNS=192.168.100.1<br \/>\n<\/code><br \/>\nMove your previously used \/etc\/network\/interfaces to \/etc\/network\/interfaces.save. The file is no longer needed (for eth0). If some other NICs defined there leave it and just remove all entries regarding to eth0.<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nroot@debdeb:~# mv \/etc\/network\/interfaces \/etc\/network\/interfaces.save\r\n<\/pre>\n<p>and enable systemd-networkd unit<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nroot@debdeb:~# systemctl enable systemd-networkd.service\r\n<\/pre>\n<p>Define <a href=\"http:\/\/www.freedesktop.org\/software\/systemd\/man\/systemd-resolved.service.html\" title=\"Systemd systemd-resolved.service\" target=\"_blank\">DNS<\/a> Server. You can add the DNS Server either in the Network section of the NIC adapter config (see above) or in <strong>\/etc\/systemd\/resolved.conf<\/strong><br \/>\nCreate a symlink <\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nroot@debdeb:~# mv \/etc\/resolv.conf \/etc\/resolv.conf.save\r\nroot@debdeb:~# ln -sf \/run\/systemd\/resolve\/resolv.conf \/etc\/resolv.conf\r\n<\/pre>\n<p>and enable systemd resolver<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nroot@debdeb:~# systemctl enable systemd-resolved.service\r\n<\/pre>\n<p>Michael<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hi, an very often requested issue. I will show this on Debian Jessie We assume we want to set a static IP Address for eth0<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[224,821,402,818],"class_list":["post-3574","post","type-post","status-publish","format-standard","hentry","category-linux","tag-linux-2","tag-resolve-conf","tag-static-ip-address","tag-systemd"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/posts\/3574","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/comments?post=3574"}],"version-history":[{"count":9,"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/posts\/3574\/revisions"}],"predecessor-version":[{"id":3632,"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/posts\/3574\/revisions\/3632"}],"wp:attachment":[{"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/media?parent=3574"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/categories?post=3574"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/tags?post=3574"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}