{"id":2905,"date":"2020-03-20T09:31:04","date_gmt":"2020-03-20T04:01:04","guid":{"rendered":"https:\/\/www.24x7serversupport.com\/blog\/?p=2905"},"modified":"2021-05-17T19:30:58","modified_gmt":"2021-05-17T14:00:58","slug":"configuring-a-static-ip-address-in-the-kali-linux-command-line","status":"publish","type":"post","link":"https:\/\/www.24x7serversupport.com\/blog\/configuring-a-static-ip-address-in-the-kali-linux-command-line\/","title":{"rendered":"Configuring a Static IP Address in the Kali Linux Command Line"},"content":{"rendered":"\n<p>\n\tIf for some reason you do not use Network Manager (for example, if you \nuse Linux without a desktop graphical environment), you can configure a \nstatic IP address on the command line.\n<\/p>\n\n\n\n<p>\n\tTo do this, open the <strong>\/etc\/network\/interfaces<\/strong> file with any text editor:\n<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><\/td><td><code>sudo<\/code> <code>vim <\/code><code>\/etc\/network\/interfaces<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>\n\tOnly four lines should be added to this file. Example strings:\n<ins><\/ins><\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><\/td><td><code>auto eth0<\/code><code>iface eth0 inet static<\/code><code>address 192.168.0.100\/24<\/code><code>gateway 192.168.0.1<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>\n\tLet us examine them in more detail. <strong>eth0 <\/strong>is the name \nof the network interface. If there is only one network card, then in \nDebian (i.e., in Kali Linux too), this interface is called eth0. The \nsecond network interface is named eth1, etc.\n<\/p>\n\n\n\n<p>\n\tIf you are not sure, you can find the name of the wired network interface with the command:\n<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><\/td><td><code>ip a<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>\n\tIn the second line, you need to use the same interface name (<strong>eth0<\/strong>).\n<\/p>\n\n\n\n<p>\n\tFurther in the third line, <strong>192.168.0.100<\/strong> is the IP that we want our system to always have. And <strong>\/24<\/strong> is an alternative way to set netmask. These characters correspond to 255.255.255.0.\n<\/p>\n\n\n\n<p>\n\tAs you might guess, in the last, fourth line, <strong>192.168.0.1<\/strong> means a gateway.\n<\/p>\n\n\n\n<p>\n\tAll these data need to be changed to fit your needs.\n<\/p>\n\n\n\n<p>\n\tFor the changes to take effect, issue the command:\n<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><\/td><td><code>sudo<\/code> <code>systemctl restart networking.service<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>\n\tLet&#8217;s check:\n<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><\/td><td><code>ip a<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>\n\tAs you can see, the interface is really assigned the required IP and now it will be saved after each reboot.\n<\/p>\n\n\n\n<p>\n\tHowever, there is currently no Internet connection, because we have not configured DNS. These settings are made in the <strong>\/etc\/resolv.conf<\/strong> file. If you already have Network Manager installed, then instead of <strong>\/etc\/resolv.conf<\/strong> there is a link to <strong>\/run\/NetworkManager\/resolv.conf<\/strong>\n<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><\/td><td><code>sudo<\/code> <code>rm<\/code> <code>\/etc\/resolv<\/code><code>.conf<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>\n\tOpen <strong>\/etc\/resolv.conf <\/strong>with any text editor:\n<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><\/td><td><code>sudo<\/code> <code>vim <\/code><code>\/etc\/resolv<\/code><code>.conf<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>\n\tand add the line:\n<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><\/td><td><code>nameserver 8.8.8.8<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>\n\tFinally, now you can check:\n<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><\/td><td><code>ping<\/code> <code>google.com<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>\n\tOn Kali Linux, the made changes do not disappear after the download. If\n they disappear, the file \/etc\/resolv.conf can be protected from \nwriting:\n<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><\/td><td><code>sudo<\/code> <code>chattr +i <\/code><code>\/etc\/resolv<\/code><code>.conf<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><ins><\/ins><\/p>\n","protected":false},"excerpt":{"rendered":"<p>If for some reason you do not use Network Manager (for example, if you use Linux without a desktop graphical environment), you can configure a static IP address on the command line. To do this, open the \/etc\/network\/interfaces file with any text editor: sudo vim \/etc\/network\/interfaces Only four lines should be added to this file. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":2902,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false}}},"categories":[243],"tags":[247,246,112,248],"class_list":["post-2905","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-kali-linux","tag-kali","tag-kali-linux","tag-linux","tag-os"],"jetpack_publicize_connections":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v22.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Configuring a Static IP Address in the Kali Linux Command Line | 24x7serversupport Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.24x7serversupport.com\/blog\/configuring-a-static-ip-address-in-the-kali-linux-command-line\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Configuring a Static IP Address in the Kali Linux Command Line | 24x7serversupport Blog\" \/>\n<meta property=\"og:description\" content=\"If for some reason you do not use Network Manager (for example, if you use Linux without a desktop graphical environment), you can configure a static IP address on the command line. To do this, open the \/etc\/network\/interfaces file with any text editor: sudo vim \/etc\/network\/interfaces Only four lines should be added to this file. [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.24x7serversupport.com\/blog\/configuring-a-static-ip-address-in-the-kali-linux-command-line\/\" \/>\n<meta property=\"og:site_name\" content=\"24x7serversupport Blog\" \/>\n<meta property=\"article:published_time\" content=\"2020-03-20T04:01:04+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-05-17T14:00:58+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/i0.wp.com\/www.24x7serversupport.com\/blog\/wp-content\/uploads\/2020\/03\/kali-linux.jpg?fit=804%2C336&ssl=1\" \/>\n\t<meta property=\"og:image:width\" content=\"804\" \/>\n\t<meta property=\"og:image:height\" content=\"336\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"24x7support\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@24x7serversuppo\" \/>\n<meta name=\"twitter:site\" content=\"@24x7serversuppo\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"24x7support\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.24x7serversupport.com\/blog\/configuring-a-static-ip-address-in-the-kali-linux-command-line\/\",\"url\":\"https:\/\/www.24x7serversupport.com\/blog\/configuring-a-static-ip-address-in-the-kali-linux-command-line\/\",\"name\":\"Configuring a Static IP Address in the Kali Linux Command Line | 24x7serversupport Blog\",\"isPartOf\":{\"@id\":\"https:\/\/www.24x7serversupport.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.24x7serversupport.com\/blog\/configuring-a-static-ip-address-in-the-kali-linux-command-line\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.24x7serversupport.com\/blog\/configuring-a-static-ip-address-in-the-kali-linux-command-line\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/i0.wp.com\/www.24x7serversupport.com\/blog\/wp-content\/uploads\/2020\/03\/kali-linux.jpg?fit=804%2C336&ssl=1\",\"datePublished\":\"2020-03-20T04:01:04+00:00\",\"dateModified\":\"2021-05-17T14:00:58+00:00\",\"author\":{\"@id\":\"https:\/\/www.24x7serversupport.com\/blog\/#\/schema\/person\/decfb5fad6bde6ac6822d4e965c6d401\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.24x7serversupport.com\/blog\/configuring-a-static-ip-address-in-the-kali-linux-command-line\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.24x7serversupport.com\/blog\/configuring-a-static-ip-address-in-the-kali-linux-command-line\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.24x7serversupport.com\/blog\/configuring-a-static-ip-address-in-the-kali-linux-command-line\/#primaryimage\",\"url\":\"https:\/\/i0.wp.com\/www.24x7serversupport.com\/blog\/wp-content\/uploads\/2020\/03\/kali-linux.jpg?fit=804%2C336&ssl=1\",\"contentUrl\":\"https:\/\/i0.wp.com\/www.24x7serversupport.com\/blog\/wp-content\/uploads\/2020\/03\/kali-linux.jpg?fit=804%2C336&ssl=1\",\"width\":804,\"height\":336,\"caption\":\"kali-linux\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.24x7serversupport.com\/blog\/configuring-a-static-ip-address-in-the-kali-linux-command-line\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.24x7serversupport.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Configuring a Static IP Address in the Kali Linux Command Line\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.24x7serversupport.com\/blog\/#website\",\"url\":\"https:\/\/www.24x7serversupport.com\/blog\/\",\"name\":\"24x7serversupport Blog\",\"description\":\"Linux | CPanel | WHM | webhosting| Plesk | DirectAdmin | CentOs | Debian | Ubuntu Blog\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.24x7serversupport.com\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.24x7serversupport.com\/blog\/#\/schema\/person\/decfb5fad6bde6ac6822d4e965c6d401\",\"name\":\"24x7support\",\"url\":\"https:\/\/www.24x7serversupport.com\/blog\/author\/24x7support\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Configuring a Static IP Address in the Kali Linux Command Line | 24x7serversupport Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.24x7serversupport.com\/blog\/configuring-a-static-ip-address-in-the-kali-linux-command-line\/","og_locale":"en_US","og_type":"article","og_title":"Configuring a Static IP Address in the Kali Linux Command Line | 24x7serversupport Blog","og_description":"If for some reason you do not use Network Manager (for example, if you use Linux without a desktop graphical environment), you can configure a static IP address on the command line. To do this, open the \/etc\/network\/interfaces file with any text editor: sudo vim \/etc\/network\/interfaces Only four lines should be added to this file. [&hellip;]","og_url":"https:\/\/www.24x7serversupport.com\/blog\/configuring-a-static-ip-address-in-the-kali-linux-command-line\/","og_site_name":"24x7serversupport Blog","article_published_time":"2020-03-20T04:01:04+00:00","article_modified_time":"2021-05-17T14:00:58+00:00","og_image":[{"width":804,"height":336,"url":"https:\/\/i0.wp.com\/www.24x7serversupport.com\/blog\/wp-content\/uploads\/2020\/03\/kali-linux.jpg?fit=804%2C336&ssl=1","type":"image\/jpeg"}],"author":"24x7support","twitter_card":"summary_large_image","twitter_creator":"@24x7serversuppo","twitter_site":"@24x7serversuppo","twitter_misc":{"Written by":"24x7support","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.24x7serversupport.com\/blog\/configuring-a-static-ip-address-in-the-kali-linux-command-line\/","url":"https:\/\/www.24x7serversupport.com\/blog\/configuring-a-static-ip-address-in-the-kali-linux-command-line\/","name":"Configuring a Static IP Address in the Kali Linux Command Line | 24x7serversupport Blog","isPartOf":{"@id":"https:\/\/www.24x7serversupport.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.24x7serversupport.com\/blog\/configuring-a-static-ip-address-in-the-kali-linux-command-line\/#primaryimage"},"image":{"@id":"https:\/\/www.24x7serversupport.com\/blog\/configuring-a-static-ip-address-in-the-kali-linux-command-line\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/www.24x7serversupport.com\/blog\/wp-content\/uploads\/2020\/03\/kali-linux.jpg?fit=804%2C336&ssl=1","datePublished":"2020-03-20T04:01:04+00:00","dateModified":"2021-05-17T14:00:58+00:00","author":{"@id":"https:\/\/www.24x7serversupport.com\/blog\/#\/schema\/person\/decfb5fad6bde6ac6822d4e965c6d401"},"breadcrumb":{"@id":"https:\/\/www.24x7serversupport.com\/blog\/configuring-a-static-ip-address-in-the-kali-linux-command-line\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.24x7serversupport.com\/blog\/configuring-a-static-ip-address-in-the-kali-linux-command-line\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.24x7serversupport.com\/blog\/configuring-a-static-ip-address-in-the-kali-linux-command-line\/#primaryimage","url":"https:\/\/i0.wp.com\/www.24x7serversupport.com\/blog\/wp-content\/uploads\/2020\/03\/kali-linux.jpg?fit=804%2C336&ssl=1","contentUrl":"https:\/\/i0.wp.com\/www.24x7serversupport.com\/blog\/wp-content\/uploads\/2020\/03\/kali-linux.jpg?fit=804%2C336&ssl=1","width":804,"height":336,"caption":"kali-linux"},{"@type":"BreadcrumbList","@id":"https:\/\/www.24x7serversupport.com\/blog\/configuring-a-static-ip-address-in-the-kali-linux-command-line\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.24x7serversupport.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Configuring a Static IP Address in the Kali Linux Command Line"}]},{"@type":"WebSite","@id":"https:\/\/www.24x7serversupport.com\/blog\/#website","url":"https:\/\/www.24x7serversupport.com\/blog\/","name":"24x7serversupport Blog","description":"Linux | CPanel | WHM | webhosting| Plesk | DirectAdmin | CentOs | Debian | Ubuntu Blog","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.24x7serversupport.com\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.24x7serversupport.com\/blog\/#\/schema\/person\/decfb5fad6bde6ac6822d4e965c6d401","name":"24x7support","url":"https:\/\/www.24x7serversupport.com\/blog\/author\/24x7support\/"}]}},"jetpack_featured_media_url":"https:\/\/i0.wp.com\/www.24x7serversupport.com\/blog\/wp-content\/uploads\/2020\/03\/kali-linux.jpg?fit=804%2C336&ssl=1","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/www.24x7serversupport.com\/blog\/wp-json\/wp\/v2\/posts\/2905","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.24x7serversupport.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.24x7serversupport.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.24x7serversupport.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.24x7serversupport.com\/blog\/wp-json\/wp\/v2\/comments?post=2905"}],"version-history":[{"count":3,"href":"https:\/\/www.24x7serversupport.com\/blog\/wp-json\/wp\/v2\/posts\/2905\/revisions"}],"predecessor-version":[{"id":3350,"href":"https:\/\/www.24x7serversupport.com\/blog\/wp-json\/wp\/v2\/posts\/2905\/revisions\/3350"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.24x7serversupport.com\/blog\/wp-json\/wp\/v2\/media\/2902"}],"wp:attachment":[{"href":"https:\/\/www.24x7serversupport.com\/blog\/wp-json\/wp\/v2\/media?parent=2905"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.24x7serversupport.com\/blog\/wp-json\/wp\/v2\/categories?post=2905"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.24x7serversupport.com\/blog\/wp-json\/wp\/v2\/tags?post=2905"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}