{"id":6511,"date":"2019-07-09T23:06:54","date_gmt":"2019-07-09T21:06:54","guid":{"rendered":"https:\/\/michlstechblog.info\/blog\/?p=6511"},"modified":"2019-07-10T09:22:20","modified_gmt":"2019-07-10T07:22:20","slug":"linux-set-a-static-fixed-ip-with-network-manager-cli","status":"publish","type":"post","link":"https:\/\/michlstechblog.info\/blog\/linux-set-a-static-fixed-ip-with-network-manager-cli\/","title":{"rendered":"Linux: Set a static\/fixed IP with Network Manager Cli"},"content":{"rendered":"<div class=\"twoclick_social_bookmarks_post_6511 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_6511')){$('.twoclick_social_bookmarks_post_6511').socialSharePrivacy({\"services\":{\"flattr\":{\"uid\":\"Michl\",\"status\":\"on\",\"the_title\":\"Linux%3A%20Set%20a%20static%2Ffixed%20IP%20with%20Network%20Manager%20Cli\",\"the_excerpt\":\"Hi%2C%0D%0A%0D%0Amost%20of%20the%20Linux%20Distributions%20uses%20the%20NetworkManager%20to%20configure%20network%20connections.%0D%0A%0D%0ASometimes%20it%20is%20necessary%20to%20set%20a%20static%20IP%20address%2C%20i.e.%20if%20no%20DHCP%20Server%20is%20available%20on%20the%20network%20or%20you%20want%20to%20setup%20a%20peer%20to%20peer%20connection%20between%20the%20computers.%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\\\/linux-set-a-static-fixed-ip-with-network-manager-cli\\\/\",\"post_id\":6511,\"post_title_referrer_track\":\"Linux%3A+Set+a+static%2Ffixed+IP+with+Network+Manager+Cli\",\"display_infobox\":\"on\"});}});\n\/* ]]> *\/<\/script><\/div><p>Hi,<\/p>\n<p>most of the Linux Distributions uses the NetworkManager to configure network connections.<\/p>\n<p>Sometimes it is necessary to set a static IP address, i.e. if no DHCP Server is available on the network or you want to setup a peer to peer connection between the computers.<br \/>\n<!--more--><br \/>\nList connections<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nroot@debdev ~ # nmcli con\r\nNAME                UUID                                  TYPE      DEVICE\r\nWired connection 1  fac58792-304a-b3dd-88ad-b689ba1495b2  ethernet  eth0\r\n<\/pre>\n<p>And set IP Address, DNS search domain, DNS server and default gateway<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nroot@debdev ~ # nmcli con mod &quot;Wired connection 1&quot; \\\r\n  ipv4.addresses &quot;10.200.2.200\/24&quot; \\\r\n  ipv4.gateway &quot;10.200.2.1&quot; \\\r\n  ipv4.dns &quot;10.200.2.2,10.200.2.3&quot; \\\r\n  ipv4.dns-search &quot;myDomain.org&quot; \\\r\n  ipv4.method &quot;manual&quot;\r\n<\/pre>\n<p>Its also possible to edit the config file. The connection config are placed in <strong>\/etc\/NetworkManager\/system-connections<\/strong><\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nroot@debdev ~ # cd \/etc\/NetworkManager\/system-connections\r\nroot@debdev ~ # ls -l \r\n-rw------- 1 root root 316 Jun  4 22:56 'Wired connection 1'\r\n<\/pre>\n<p>Edit the IPv4 section. This also describes how to set a static route<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n&#x5B;ipv4]\r\naddress1=10.200.2.200\/24\/24,10.200.2.1\r\ndns=10.200.2.2;10.200.2.3;\r\ndns-search=myDomain.org\r\nmethod=manual\r\nroute1=224.0.23.12\/32\r\n<\/pre>\n<p>Michael<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hi, most of the Linux Distributions uses the NetworkManager to configure network connections. Sometimes it is necessary to set a static IP address, i.e. if no DHCP Server is available on the network or you want to setup a peer to peer connection between the computers.<\/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":[1358,224,1359,1360,181],"class_list":["post-6511","post","type-post","status-publish","format-standard","hentry","category-linux","tag-fixed-ip-address","tag-linux-2","tag-networkmanager","tag-set-static-route","tag-static"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/posts\/6511","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=6511"}],"version-history":[{"count":7,"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/posts\/6511\/revisions"}],"predecessor-version":[{"id":6519,"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/posts\/6511\/revisions\/6519"}],"wp:attachment":[{"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/media?parent=6511"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/categories?post=6511"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/tags?post=6511"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}