Cannot connect to internet after setting static ip address opensuse leap

[LEFT]I had to set static address on wlan0 so I can do port forwarding on my ZTE ZXHN H298N Hyperoptic router. Found IPv4 Address and Subnet using :~> ifconfig - inet addr = Mask = In /etc/sysconfig/network/ifcfg-wlan0changed (i)BOOTPROTO = ‘static’ (ii)‘IPADDR’ = 192.168…1.104 ← read from ifconfig (iii)‘NETMASK’= ← subnet read from ifconfig (iv)BROADCAST = ← read from ifconfigRestarted network for changes to take effect: :~> sudo systemctl restart network


**[LEFT][FONT=Arial][FONT=courier new]Now I cannot connect to internet, and so unable to do online port checking. When I open web browser I see message “can’t establish connection to server”. There were no problems connecting to internet prior to setting static ip address. Any thoughts? All suggestions will be greatly welcome.[/FONT][/FONT][/LEFT]


The ifconfig command is deprecated, use ip addr instead… anyway Use YaST Network Settings to set you static ip address, netmask, DNS severs (on the Hostname/DNS) tab and then also your default gateway address on the Routing tab. Just setting the ip address isn’t enough :wink:

Instead of editing “/etc/sysconfig/network/ifcfg-wlan0”, you would do better to use:
Yast → System → Network Settings

Select your device, and select “Edit” to set static ip.

While still in Yast Network Settings, click on the “Routing” tab and set a default route. And then click on the “Hostname/DNS” tab and set a DNS server.

Normally, you get the default route and DNS via DHCP. But since you are using a static address instead of DHCP, you will need to set those yourself.

I am using wicked. Will static addressing speed up configuration at boot time? Current configuration uses DHCP and is slow:

Apr 04 13:53:00 ... systemd[1]: Starting wicked managed network interfaces...
Apr 04 13:53:16 ... wicked[1155]: lo              up
Apr 04 13:53:16 ...  wicked[1155]: enp0s25         enslaved
Apr 04 13:53:16 ... wicked[1155]: br0             up
Apr 04 13:53:16  systemd[1]: Started wicked managed network interfaces.

Normally the choice for using DHCP or not is made on other grounds then initialisation speed.

I do not think that doing the DHCP broadcast and getting the answers on a LAN will take a lot of time. Or is the DHCP server a bit busy?

BTW, I am not sure I can read from what you post that using DHCP is “slow”. Maybe I do not understand what I see there without further explanation.

Somebody gave me the hint, but I also don’t think he is right. From last boot:

erlangen:~ # systemd-analyze
Startup finished in 1.874s (kernel) + 840ms (initrd) + 18.165s (userspace) = 20.880s reached after 18.161s in userspace
erlangen:~ # systemd-analyze critical-chain |grep +
The time the unit takes to start is printed after the "+" character.
└─display-manager.service @16.638s +1.522s
  └─apache2.service @16.514s +114ms
      └─ntpd.service @16.465s +43ms
          └─wicked.service @1.140s +**15.320s**
            └─wickedd-nanny.service @1.131s +8ms
              └─wickedd.service @1.122s +7ms
                └─wickedd-auto4.service @1.091s +29ms
                            └─systemd-update-utmp.service @1.021s +3ms
                              └─auditd.service @1.004s +16ms
                                └─systemd-tmpfiles-setup.service @983ms +19ms
                                    └─home\x2dHDD.mount @742ms +237ms
                                        └─lvm2-monitor.service @176ms +561ms
erlangen:~ # 

I am no expert in analyzing this. but 15 secs for starting the network seems indeed a bit much.
Bit is it DHCP?

BTW, why didn’t you start a new thread with a new title that tells about your problem instead of hanging this at the end of an old thread about a different subject (connecting to the Internet)?

I came here by incident. I do not think this is the best way to advertise your problem.

The amount of speed up is probably too small to notice.

From the original post,
A static address is configured.
Yes, it’s advisable to use YaST but not critical.

To the @OP,
If your router can provide DHCP to your LAN, then you have an easy alternative to setting up your openSUSE with a static address…

Most DHCP servers have a feature supporting “Reserved Leases.”
What this means is that if you configure your openSUSE as a DHCP client,
When your openSUSE boots up, it will query any available DHCP server for an IP address (and will provide a MAC address for identification).
Your DHCP Server will receive the query, look up your machine’s MAC address in its table of Reserved Leases, find a match and respond with the fixed, assigned address for your machine.
If you didn’t set up a Reserved Lease on your DHCP server, then the response would assign any available IP address.

Try the above,
If you can set that up, then you’ll have the fixed address like static addressing while also the ease of a DHCP client setup.


Regarding speed…
Unless your network has some kind of problem, speed should not typically be an issue.
You might consider you could have an IP address conflict… If multiple machines have the same address, or if you configured your static IP address the same as an active DHCP lease.

In other words, if you configure a static address, it should be configured <outside> the DHCP scope (range of IP addresses).
Personally, when I break this rule I configure my static addresses at the highest end of the range to avoid conflicts since DHCP normally assigns IP addresses in the lowest available address first.

You should also know that DHCP leases have a TTL (Time to live) or lifetime which is variable and be configured.
And, at the half-life of the lease, then the DHCP server will issue a lease renewal of the client connects.
If the client doesn’t renew during the second half of the life of the lease, then the IP address is returned to the available pool for re-issuing.

Bottom line is that if you can configure Reserved Leases as I described in my previous post instead of Static addresses, you’ll likely not create any IP address conflicts that would slow your DHCP.