Announcement

Collapse
No announcement yet.

Setting static IP address

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    [SOLVED] Setting static IP address

    Before I make the proclamation I'm chomping at the bit to make, I have to ask: has the method for setting static IP addresses changed? Like from 19.10 to 20.04?

    To be clear, the method I've used is editing a connection's IPv4 tab, setting its 'method' to 'manual,' adding "4.2.2.1,4.2.2.2" to its 'other DNS servers' field, and 'add'ing a new row containing the IP address I want (192.168.1.111), netmask "255.255.255.0" and gateway "192.168.1.1"

    Is this no longer the correct way to do it?
    Xenix/UNIX user since 1985 | Linux user since 1991 | Was registered Linux user #163544


    #2
    No, nothing has changed on this front, going back to the KDE 3 days, maybe.
    i just set a static IP on Friday, on my PC, and this worked as expected.
    Once I had remembered that my new router uses a different address from the old one, that is

    Comment


      #3
      Originally posted by DoYouKubuntu View Post
      ... adding "4.2.2.1,4.2.2.2" to its 'other DNS servers' field...
      You might want to consider revising those; cloudflare have changed the landscape in this area.

      But if I recall correctly, you're in CA and if I ping 4.2.2.1 from a server in CA it's 1.8 ms, compared with 1.2 ms for 1.1.1.1. I get at least 4 ms from my router wired across a couple of rooms, so quibbling about an extra 0.6 ms seems pointless. And ping times are only part of the story. I started this post because I get 120 ms to 4.2.2.1 thinking "that's lousy" but then I thought, maybe my location is influencing things.
      Regards, John Little

      Comment


        #4
        Okay, guys, here goes: I FOUND THE SOURCE OF MY PROBLEM!! (Yes, I know I'm shouting. I'm happy!)

        The whole 'name resolution failure' intermittent Internet connectivity thing that's driven me CRAZY for weeks is now solved. There's a long, boring story on how I figured it out, which I'll skip, but it comes down to changing my IPv4 info. That. Was. It!

        But based on your responses, it shouldn't be it.

        I need to give this laptop its own unique IP address, so I must figure out what to tweak in its IPv4 settings, but for right now just know that it was, unequivocally, the source of the problem. Since figuring it out last night, I've left it on 'automatic' and with no custom input, and the problem is GONE.

        Change it back to manual, etc., and it comes BACK. Just like that.

        ======================================

        ETA: I'm pointing other threads here for the solution, so I figured it would be good to actually spell out what the problem was and how it was fixed!

        In a seemingly random manner my new laptop, running 20.04, was losing its Internet connectivity. It would say it was connected, but nothing would actually load. I was receiving this error message ("Temporary failure in name resolution") when I tried to ping any site:

        Code:
        ping: google.com: Temporary failure in name resolution
        This occurred on both wireless AND hardwired connections.

        It turned out that the problem had to do with my IPv4 settings--which were the same as I had used for eons; I had modified them in order to assign a static IP address to the new laptop. Thanks to @jlittle, I changed one of its settings and, voila!, no more connectivity problems! None.

        If you're having the same problem, or if you'd like to learn how to set static IP addresses, try the following in your IPv4 settings; go to System Settings | Network | Connections and choose its IPv4 tab:

        - change its 'method' from 'automatic' to 'manual'
        - put 1.1.1.1,1.1.1.2 in its 'DNS servers' field
        - add a new row containing the desired IP address, e.g., 192.168.1.115, 'netmask' of 255.255.255.0 and gateway 192.168.1.1
        - save your changes
        - you're done! (At least it worked for me. )

        Here's a screenshot of my settings in case the instructions aren't clear:

        Click image for larger version

Name:	static_IP_address_settings_Kubuntu_20.04LTS_112220_cropped.png
Views:	1
Size:	46.9 KB
ID:	644953
        Last edited by DoYouKubuntu; Nov 25, 2020, 01:58 PM.
        Xenix/UNIX user since 1985 | Linux user since 1991 | Was registered Linux user #163544

        Comment


          #5
          The thing that has changed is the switch to "Netplan" to manually configure the network instead of the old "interfaces" file. This doesn't matter if you're using Network Manager successfully as it will handle it all. I prefer to let networkd and not NM on my desktops and server because it boots faster IME. I let NM alone on my laptop.

          Anyway, the point being if you're going to fully manually configure, you might need to look into the syntax of the netplan config files.

          my netplan config for static IP on my server:

          Code:
          [FONT=monospace][COLOR=#54FF54][B]smith@server[/B][/COLOR][COLOR=#000000]:[/COLOR][COLOR=#5454FF][B]~[/B][/COLOR][COLOR=#000000]$ cat /etc/netplan/01-netcfg.yaml  [/COLOR]
          # This file describes the network interfaces available on your system
          # For more information, see netplan(5).
          network:
            version: 2
            renderer: networkd
            ethernets:
              eno1:
                dhcp4: no
                dhcp6: no
                addresses: [192.168.1.250/23]
                gateway4: 192.168.1.1
                nameservers:
                  addresses: [8.8.8.8,8.8.4.4]
          [/FONT][FONT=monospace][COLOR=#000000]#    enp2s0:[/COLOR]
          #      dhcp4: yes
          
          [/FONT]
          Last edited by oshunluvr; Nov 23, 2020, 12:47 PM.

          Please Read Me

          Comment


            #6
            Thanks, @oshunluvr. I was actually just reading up on ip and netplan--neither of which I was familiar with; I also just found out that ifconfig is going away. (I had wondered why I had to install it myself on the new laptop. I didn't remember doing that before.)

            I'm kind of skittish right now about tweaking anything, even though I know I can always change it back. But after weeks of and I'm not too keen on mucking things up!
            Xenix/UNIX user since 1985 | Linux user since 1991 | Was registered Linux user #163544

            Comment


              #7
              I have a Buffalo WZR-600HPD wifi router. It has, as many routers do, the ability to assign an IP address to a MAC value. I have the DHCP set to begin dispensing IP addresses at 192.168.11.100 for a maximum of 12. My MAC address is bound to 192.168.11.100 so it is reserved for my laptop regardless of when or if I log on.

              When I had my laser printer set as a wireless printer so that other laptops and devices on my LAN could send documents to it I used it's MAC to set its IP address to 192.168.11.99, one below the beginning range of the DHCP setting. That way, no one's device stole the IP address of the printer, regardless of whether they logged on before the printer logged on, or afterward.
              "A nation that is afraid to let its people judge the truth and falsehood in an open market is a nation that is afraid of its people.”
              – John F. Kennedy, February 26, 1962.

              Comment


                #8
                Okay, I did it. I modified my IPv4 settings as in my OP, but using "1.1.1.1,1.1.1.2" instead of "4.2.2.1,4.2.2.2"--and so far, so good!

                If that stupid problem returns, at least now I know how to immediately fix it.
                Xenix/UNIX user since 1985 | Linux user since 1991 | Was registered Linux user #163544

                Comment


                  #9
                  My first reply : )

                  Just want to help other newbees like me who ran into this problem. I am on WMware Kubuntu 20.04 Desktop on win 10
                  The problem was that after changing to manual, entering DNS server which was same as router, adding ip, subnet and gateway - pressing apply, closing terminal and reopen it, my ip address had not changed!

                  The solution was: Under General configuration setting Connect automatically with priority and raising this to 1 (from 0) did the trick!

                  Comment

                  Working...
                  X