Setting a Static Ip on Ubuntu












3















I'm struggling with setting my static ip, nothing seems to work.



When I enter my interfaces, it says (by default):



# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback


And that's okay, so, now I just want to assign a static ip, and I am using the wlan0 device in order to do so, as eth0 is unavailable. I try to add in below, for example:



auto wlan0
iface wlan0 inet static
address 192.168.0.87/24
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
gateway 192.168.0.1
dns-nameservers 192.168.0.1, 192.168.0.87/24, 8.8.8.8
wpa-ssid 'user'
wpa-psk 'password' # I also tried it with hex value without quotation marks


For sure, I know that my gateway is like that, all of it comes from the interface settings under nmcli dev list iface wlan0, but then it does not work. When I reboot the system, despite my network manager is properly disabled, the connections do not work, it just freezes and times out every time.



What could possibly wrong here?










share|improve this question


















  • 2





    Address needs to be a single address, not a range. Leave out the /24, also applies to dns

    – Jan
    Sep 30 '14 at 11:02






  • 2





    Unless this is server (no GUI) you should consider setting your interface via the network-manager nm-applet GUI instead of modifying the /etc/network/interfaces file.

    – steeldriver
    Sep 30 '14 at 11:16











  • The fault was ultimately the matter or removing quotation marks from the username and putting a value in a hex way. Anyway, I took notes off from your hints and I'll improve my game. Thanks.

    – Maciej Sitko
    Sep 30 '14 at 12:13
















3















I'm struggling with setting my static ip, nothing seems to work.



When I enter my interfaces, it says (by default):



# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback


And that's okay, so, now I just want to assign a static ip, and I am using the wlan0 device in order to do so, as eth0 is unavailable. I try to add in below, for example:



auto wlan0
iface wlan0 inet static
address 192.168.0.87/24
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
gateway 192.168.0.1
dns-nameservers 192.168.0.1, 192.168.0.87/24, 8.8.8.8
wpa-ssid 'user'
wpa-psk 'password' # I also tried it with hex value without quotation marks


For sure, I know that my gateway is like that, all of it comes from the interface settings under nmcli dev list iface wlan0, but then it does not work. When I reboot the system, despite my network manager is properly disabled, the connections do not work, it just freezes and times out every time.



What could possibly wrong here?










share|improve this question


















  • 2





    Address needs to be a single address, not a range. Leave out the /24, also applies to dns

    – Jan
    Sep 30 '14 at 11:02






  • 2





    Unless this is server (no GUI) you should consider setting your interface via the network-manager nm-applet GUI instead of modifying the /etc/network/interfaces file.

    – steeldriver
    Sep 30 '14 at 11:16











  • The fault was ultimately the matter or removing quotation marks from the username and putting a value in a hex way. Anyway, I took notes off from your hints and I'll improve my game. Thanks.

    – Maciej Sitko
    Sep 30 '14 at 12:13














3












3








3


2






I'm struggling with setting my static ip, nothing seems to work.



When I enter my interfaces, it says (by default):



# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback


And that's okay, so, now I just want to assign a static ip, and I am using the wlan0 device in order to do so, as eth0 is unavailable. I try to add in below, for example:



auto wlan0
iface wlan0 inet static
address 192.168.0.87/24
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
gateway 192.168.0.1
dns-nameservers 192.168.0.1, 192.168.0.87/24, 8.8.8.8
wpa-ssid 'user'
wpa-psk 'password' # I also tried it with hex value without quotation marks


For sure, I know that my gateway is like that, all of it comes from the interface settings under nmcli dev list iface wlan0, but then it does not work. When I reboot the system, despite my network manager is properly disabled, the connections do not work, it just freezes and times out every time.



What could possibly wrong here?










share|improve this question














I'm struggling with setting my static ip, nothing seems to work.



When I enter my interfaces, it says (by default):



# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback


And that's okay, so, now I just want to assign a static ip, and I am using the wlan0 device in order to do so, as eth0 is unavailable. I try to add in below, for example:



auto wlan0
iface wlan0 inet static
address 192.168.0.87/24
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
gateway 192.168.0.1
dns-nameservers 192.168.0.1, 192.168.0.87/24, 8.8.8.8
wpa-ssid 'user'
wpa-psk 'password' # I also tried it with hex value without quotation marks


For sure, I know that my gateway is like that, all of it comes from the interface settings under nmcli dev list iface wlan0, but then it does not work. When I reboot the system, despite my network manager is properly disabled, the connections do not work, it just freezes and times out every time.



What could possibly wrong here?







wireless networking server network-manager dns






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Sep 30 '14 at 10:58









Maciej SitkoMaciej Sitko

21112




21112








  • 2





    Address needs to be a single address, not a range. Leave out the /24, also applies to dns

    – Jan
    Sep 30 '14 at 11:02






  • 2





    Unless this is server (no GUI) you should consider setting your interface via the network-manager nm-applet GUI instead of modifying the /etc/network/interfaces file.

    – steeldriver
    Sep 30 '14 at 11:16











  • The fault was ultimately the matter or removing quotation marks from the username and putting a value in a hex way. Anyway, I took notes off from your hints and I'll improve my game. Thanks.

    – Maciej Sitko
    Sep 30 '14 at 12:13














  • 2





    Address needs to be a single address, not a range. Leave out the /24, also applies to dns

    – Jan
    Sep 30 '14 at 11:02






  • 2





    Unless this is server (no GUI) you should consider setting your interface via the network-manager nm-applet GUI instead of modifying the /etc/network/interfaces file.

    – steeldriver
    Sep 30 '14 at 11:16











  • The fault was ultimately the matter or removing quotation marks from the username and putting a value in a hex way. Anyway, I took notes off from your hints and I'll improve my game. Thanks.

    – Maciej Sitko
    Sep 30 '14 at 12:13








2




2





Address needs to be a single address, not a range. Leave out the /24, also applies to dns

– Jan
Sep 30 '14 at 11:02





Address needs to be a single address, not a range. Leave out the /24, also applies to dns

– Jan
Sep 30 '14 at 11:02




2




2





Unless this is server (no GUI) you should consider setting your interface via the network-manager nm-applet GUI instead of modifying the /etc/network/interfaces file.

– steeldriver
Sep 30 '14 at 11:16





Unless this is server (no GUI) you should consider setting your interface via the network-manager nm-applet GUI instead of modifying the /etc/network/interfaces file.

– steeldriver
Sep 30 '14 at 11:16













The fault was ultimately the matter or removing quotation marks from the username and putting a value in a hex way. Anyway, I took notes off from your hints and I'll improve my game. Thanks.

– Maciej Sitko
Sep 30 '14 at 12:13





The fault was ultimately the matter or removing quotation marks from the username and putting a value in a hex way. Anyway, I took notes off from your hints and I'll improve my game. Thanks.

– Maciej Sitko
Sep 30 '14 at 12:13










3 Answers
3






active

oldest

votes


















5














Using the Network Manager GUI did the trick for me on Xubuntu 16.04:



Edit the wifi connection, and on IPv4 tab, enter:




  • Method: Manual

  • Address: xxx.xxx.xxx.xxx (your static address,in this case: 192.168.1.128)

  • Netmask: 24

  • Gateway: xxx.xxx.xxx.xxx (your gateway address,in this case: 192.168.1.1)

  • DNS Server: xxx.xxx.xxx.xxx (your gateway address,in this case: 192.168.1.1)




Here's an example screenshot:



enter image description here






share|improve this answer





















  • 1





    Hello and welcome to Ask Ubuntu! While this is a good first answer, it can still be improved, with, say, a screenshot. If you feel like this is a good idea, please feel free to edit it into your answer. Otherwise, I'd recommend you read our tour and How to Answer page in order to get a better idea of how this site works, and how to better keep providing awesome content!

    – Kaz Wolfe
    Mar 29 '17 at 18:43











  • how do you find your static and gateway address?

    – ben432rew
    Jul 15 '17 at 1:45






  • 1





    @ben432rew gateway is the ip of your router, and static is the address you chose (should be done through router first)

    – smac89
    Sep 10 '18 at 1:45



















4














Test this:



Open a terminal.



Run it:



sudo -i
nano /etc/network/interfaces


Add the following lines for you wifi lan adaptor.



----------------------------------------------
# The wifi network interface
auto wlan0
iface wlan0 inet static
address 192.168.0.87
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
gateway 192.168.0.1
dns-nameservers 192.168.0.1, 8.8.8.8
wpa-ssid <Your wifi network SSID>
wpa-psk <Your hex encoded wifi WPA password>
-----------------------------------------------


Control + O, save file. Control + X, close nano.






share|improve this answer































    1














    To setting up a static IP in Ubuntu the proper way is:



    Disable the graphical management of your network connection in /etc/NetworkManager/NetworkManager.conf
    Gather the information for the static IP (interface, IP to be used, default gateway, subnet, DNS)
    Modify /etc/network/interfaces to include the information above.
    Restart networking and network-manager services.






    share|improve this answer


























    • "These instructions assume you are using a wired ethernet port to set a static IP on..."

      – arsaKasra
      Apr 15 '16 at 12:54











    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "89"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f530522%2fsetting-a-static-ip-on-ubuntu%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    3 Answers
    3






    active

    oldest

    votes








    3 Answers
    3






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    5














    Using the Network Manager GUI did the trick for me on Xubuntu 16.04:



    Edit the wifi connection, and on IPv4 tab, enter:




    • Method: Manual

    • Address: xxx.xxx.xxx.xxx (your static address,in this case: 192.168.1.128)

    • Netmask: 24

    • Gateway: xxx.xxx.xxx.xxx (your gateway address,in this case: 192.168.1.1)

    • DNS Server: xxx.xxx.xxx.xxx (your gateway address,in this case: 192.168.1.1)




    Here's an example screenshot:



    enter image description here






    share|improve this answer





















    • 1





      Hello and welcome to Ask Ubuntu! While this is a good first answer, it can still be improved, with, say, a screenshot. If you feel like this is a good idea, please feel free to edit it into your answer. Otherwise, I'd recommend you read our tour and How to Answer page in order to get a better idea of how this site works, and how to better keep providing awesome content!

      – Kaz Wolfe
      Mar 29 '17 at 18:43











    • how do you find your static and gateway address?

      – ben432rew
      Jul 15 '17 at 1:45






    • 1





      @ben432rew gateway is the ip of your router, and static is the address you chose (should be done through router first)

      – smac89
      Sep 10 '18 at 1:45
















    5














    Using the Network Manager GUI did the trick for me on Xubuntu 16.04:



    Edit the wifi connection, and on IPv4 tab, enter:




    • Method: Manual

    • Address: xxx.xxx.xxx.xxx (your static address,in this case: 192.168.1.128)

    • Netmask: 24

    • Gateway: xxx.xxx.xxx.xxx (your gateway address,in this case: 192.168.1.1)

    • DNS Server: xxx.xxx.xxx.xxx (your gateway address,in this case: 192.168.1.1)




    Here's an example screenshot:



    enter image description here






    share|improve this answer





















    • 1





      Hello and welcome to Ask Ubuntu! While this is a good first answer, it can still be improved, with, say, a screenshot. If you feel like this is a good idea, please feel free to edit it into your answer. Otherwise, I'd recommend you read our tour and How to Answer page in order to get a better idea of how this site works, and how to better keep providing awesome content!

      – Kaz Wolfe
      Mar 29 '17 at 18:43











    • how do you find your static and gateway address?

      – ben432rew
      Jul 15 '17 at 1:45






    • 1





      @ben432rew gateway is the ip of your router, and static is the address you chose (should be done through router first)

      – smac89
      Sep 10 '18 at 1:45














    5












    5








    5







    Using the Network Manager GUI did the trick for me on Xubuntu 16.04:



    Edit the wifi connection, and on IPv4 tab, enter:




    • Method: Manual

    • Address: xxx.xxx.xxx.xxx (your static address,in this case: 192.168.1.128)

    • Netmask: 24

    • Gateway: xxx.xxx.xxx.xxx (your gateway address,in this case: 192.168.1.1)

    • DNS Server: xxx.xxx.xxx.xxx (your gateway address,in this case: 192.168.1.1)




    Here's an example screenshot:



    enter image description here






    share|improve this answer















    Using the Network Manager GUI did the trick for me on Xubuntu 16.04:



    Edit the wifi connection, and on IPv4 tab, enter:




    • Method: Manual

    • Address: xxx.xxx.xxx.xxx (your static address,in this case: 192.168.1.128)

    • Netmask: 24

    • Gateway: xxx.xxx.xxx.xxx (your gateway address,in this case: 192.168.1.1)

    • DNS Server: xxx.xxx.xxx.xxx (your gateway address,in this case: 192.168.1.1)




    Here's an example screenshot:



    enter image description here







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited 13 mins ago









    Kevin Bowen

    14.6k155970




    14.6k155970










    answered Mar 29 '17 at 18:39









    DanielDaniel

    5111




    5111








    • 1





      Hello and welcome to Ask Ubuntu! While this is a good first answer, it can still be improved, with, say, a screenshot. If you feel like this is a good idea, please feel free to edit it into your answer. Otherwise, I'd recommend you read our tour and How to Answer page in order to get a better idea of how this site works, and how to better keep providing awesome content!

      – Kaz Wolfe
      Mar 29 '17 at 18:43











    • how do you find your static and gateway address?

      – ben432rew
      Jul 15 '17 at 1:45






    • 1





      @ben432rew gateway is the ip of your router, and static is the address you chose (should be done through router first)

      – smac89
      Sep 10 '18 at 1:45














    • 1





      Hello and welcome to Ask Ubuntu! While this is a good first answer, it can still be improved, with, say, a screenshot. If you feel like this is a good idea, please feel free to edit it into your answer. Otherwise, I'd recommend you read our tour and How to Answer page in order to get a better idea of how this site works, and how to better keep providing awesome content!

      – Kaz Wolfe
      Mar 29 '17 at 18:43











    • how do you find your static and gateway address?

      – ben432rew
      Jul 15 '17 at 1:45






    • 1





      @ben432rew gateway is the ip of your router, and static is the address you chose (should be done through router first)

      – smac89
      Sep 10 '18 at 1:45








    1




    1





    Hello and welcome to Ask Ubuntu! While this is a good first answer, it can still be improved, with, say, a screenshot. If you feel like this is a good idea, please feel free to edit it into your answer. Otherwise, I'd recommend you read our tour and How to Answer page in order to get a better idea of how this site works, and how to better keep providing awesome content!

    – Kaz Wolfe
    Mar 29 '17 at 18:43





    Hello and welcome to Ask Ubuntu! While this is a good first answer, it can still be improved, with, say, a screenshot. If you feel like this is a good idea, please feel free to edit it into your answer. Otherwise, I'd recommend you read our tour and How to Answer page in order to get a better idea of how this site works, and how to better keep providing awesome content!

    – Kaz Wolfe
    Mar 29 '17 at 18:43













    how do you find your static and gateway address?

    – ben432rew
    Jul 15 '17 at 1:45





    how do you find your static and gateway address?

    – ben432rew
    Jul 15 '17 at 1:45




    1




    1





    @ben432rew gateway is the ip of your router, and static is the address you chose (should be done through router first)

    – smac89
    Sep 10 '18 at 1:45





    @ben432rew gateway is the ip of your router, and static is the address you chose (should be done through router first)

    – smac89
    Sep 10 '18 at 1:45













    4














    Test this:



    Open a terminal.



    Run it:



    sudo -i
    nano /etc/network/interfaces


    Add the following lines for you wifi lan adaptor.



    ----------------------------------------------
    # The wifi network interface
    auto wlan0
    iface wlan0 inet static
    address 192.168.0.87
    netmask 255.255.255.0
    network 192.168.0.0
    broadcast 192.168.0.255
    gateway 192.168.0.1
    dns-nameservers 192.168.0.1, 8.8.8.8
    wpa-ssid <Your wifi network SSID>
    wpa-psk <Your hex encoded wifi WPA password>
    -----------------------------------------------


    Control + O, save file. Control + X, close nano.






    share|improve this answer




























      4














      Test this:



      Open a terminal.



      Run it:



      sudo -i
      nano /etc/network/interfaces


      Add the following lines for you wifi lan adaptor.



      ----------------------------------------------
      # The wifi network interface
      auto wlan0
      iface wlan0 inet static
      address 192.168.0.87
      netmask 255.255.255.0
      network 192.168.0.0
      broadcast 192.168.0.255
      gateway 192.168.0.1
      dns-nameservers 192.168.0.1, 8.8.8.8
      wpa-ssid <Your wifi network SSID>
      wpa-psk <Your hex encoded wifi WPA password>
      -----------------------------------------------


      Control + O, save file. Control + X, close nano.






      share|improve this answer


























        4












        4








        4







        Test this:



        Open a terminal.



        Run it:



        sudo -i
        nano /etc/network/interfaces


        Add the following lines for you wifi lan adaptor.



        ----------------------------------------------
        # The wifi network interface
        auto wlan0
        iface wlan0 inet static
        address 192.168.0.87
        netmask 255.255.255.0
        network 192.168.0.0
        broadcast 192.168.0.255
        gateway 192.168.0.1
        dns-nameservers 192.168.0.1, 8.8.8.8
        wpa-ssid <Your wifi network SSID>
        wpa-psk <Your hex encoded wifi WPA password>
        -----------------------------------------------


        Control + O, save file. Control + X, close nano.






        share|improve this answer













        Test this:



        Open a terminal.



        Run it:



        sudo -i
        nano /etc/network/interfaces


        Add the following lines for you wifi lan adaptor.



        ----------------------------------------------
        # The wifi network interface
        auto wlan0
        iface wlan0 inet static
        address 192.168.0.87
        netmask 255.255.255.0
        network 192.168.0.0
        broadcast 192.168.0.255
        gateway 192.168.0.1
        dns-nameservers 192.168.0.1, 8.8.8.8
        wpa-ssid <Your wifi network SSID>
        wpa-psk <Your hex encoded wifi WPA password>
        -----------------------------------------------


        Control + O, save file. Control + X, close nano.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Sep 30 '14 at 11:41









        kyodakekyodake

        9,80811932




        9,80811932























            1














            To setting up a static IP in Ubuntu the proper way is:



            Disable the graphical management of your network connection in /etc/NetworkManager/NetworkManager.conf
            Gather the information for the static IP (interface, IP to be used, default gateway, subnet, DNS)
            Modify /etc/network/interfaces to include the information above.
            Restart networking and network-manager services.






            share|improve this answer


























            • "These instructions assume you are using a wired ethernet port to set a static IP on..."

              – arsaKasra
              Apr 15 '16 at 12:54
















            1














            To setting up a static IP in Ubuntu the proper way is:



            Disable the graphical management of your network connection in /etc/NetworkManager/NetworkManager.conf
            Gather the information for the static IP (interface, IP to be used, default gateway, subnet, DNS)
            Modify /etc/network/interfaces to include the information above.
            Restart networking and network-manager services.






            share|improve this answer


























            • "These instructions assume you are using a wired ethernet port to set a static IP on..."

              – arsaKasra
              Apr 15 '16 at 12:54














            1












            1








            1







            To setting up a static IP in Ubuntu the proper way is:



            Disable the graphical management of your network connection in /etc/NetworkManager/NetworkManager.conf
            Gather the information for the static IP (interface, IP to be used, default gateway, subnet, DNS)
            Modify /etc/network/interfaces to include the information above.
            Restart networking and network-manager services.






            share|improve this answer















            To setting up a static IP in Ubuntu the proper way is:



            Disable the graphical management of your network connection in /etc/NetworkManager/NetworkManager.conf
            Gather the information for the static IP (interface, IP to be used, default gateway, subnet, DNS)
            Modify /etc/network/interfaces to include the information above.
            Restart networking and network-manager services.







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Aug 17 '16 at 16:49

























            answered Oct 4 '14 at 14:32









            Harshal BenakeHarshal Benake

            204114




            204114













            • "These instructions assume you are using a wired ethernet port to set a static IP on..."

              – arsaKasra
              Apr 15 '16 at 12:54



















            • "These instructions assume you are using a wired ethernet port to set a static IP on..."

              – arsaKasra
              Apr 15 '16 at 12:54

















            "These instructions assume you are using a wired ethernet port to set a static IP on..."

            – arsaKasra
            Apr 15 '16 at 12:54





            "These instructions assume you are using a wired ethernet port to set a static IP on..."

            – arsaKasra
            Apr 15 '16 at 12:54


















            draft saved

            draft discarded




















































            Thanks for contributing an answer to Ask Ubuntu!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f530522%2fsetting-a-static-ip-on-ubuntu%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            GameSpot

            connect to host localhost port 22: Connection refused

            Getting a Wifi WPA2 wifi connection