
For restarting the phone, hold down the power key and Tap on Restart. To restart your router, use the Routers setting/admin tool and search for an option to restart. You can also try turning the router off and on by using the Power key.
Maybe you changed some setting somewhere within the network options like manual IP config or DNS settings. So, this might cause the issue. If you do not remember changing any specific setting, you can perform a network reset. This option resets all network-related settings like Bluetooth and Wi-Fi.

To perform a network reset navigate to Settings > System > Reset options > Reset Wi-Fi,mobile, Bluetooth. Then tap on Reset settings.
Once the reset is completed, reconnect to the network and see if the issue is solved.
Solution 4: Change IP to Static instead of DHCP
In order to connect to the internet, your device needs the IP address info from the router. For this, the device uses DHCP (Dynamic Host Configuration Protocol), which assigns IP addresses for clients automatically. In some rare cases, this might have caused the issue. To resolve this, Tap on the network then tap on “Advanced options.” under IP settings tap and select “Static.” Now Scroll down to IP address and enter the IP address for your router manually.

You should somehow find the IP address details for your router, either using “ipconfig” command from a PC that is connected to the network or should get it from other devices connected to the network.

To get details using an android phone goto Network > Wi-Fi option in settings. Then tap on the Network and scroll down to network details.
Solution 5: Reset the Accesspoint or Router
If any changes were done on the router setting, it would prevent us from connecting to the network due to misconfiguration. If you don’t remember those modifications, you can reset your router from the admin panel in Router’s configuration webpage. This option will vary depending on the manufacturer. So follow the manual provided along with the router. The generic method is to log in as admin into the configuration portal for your router and search for the option reset under System tools or maintenance tabs.

Most routers have external reset buttons. Press and hold the button for a few seconds, and the router will restart, resetting the router. From here, we have to reconfigure the router from scratch. Use manuals and web help specific to your router manufacturer and model. After router reset, connect the phone to the router and check.
Solution 6: Check interference
Wi-Fi signal requires straight and obstacles free path to travel. The phone cannot connect if your room is full of obstacles or you are using from another room when the router is in a different room. Try moving closer to the router or access point and check.

If the router is yours, place the router in the center of the room for full round coverage. Walls completely block the signals. Hence you cannot connect from behind the wall even if the router is near the other side of the wall. Connections work only between a specific distance. That distance varies with regards to the Wi-Fi band and antenna type. Typical routers work within 10-20 meters. So keep your distance within the limit.
Solution 7: Router Key Encryption / Mac address filtering
Your router may support multiple security modes like WEP, WPA, etc., but your phone doesn’t support them all. So it is always recommended to keep the security mode as WPS2-PSK and encryption type as AES for easy work through. Go to router settings and change the options under Wireless > Wireless Security.
When mac filtering is turned on, your router will deny connection requests from devices having a specified mac address. So, disable this option to resolve our issue. If the method works, you can later add our device (phone) to whitelist to prevent further blocking. This option also will be available under Wireless > wireless Mac filtering.
Solution 8: Reset your phone
If none of the methods solved your issue, and you are sure that the issue is within your phone, then the last hope is to perform a factory reset of your phone. This removes misconfigurations and all settings, including apps and data. Create a backup of everything before attempting this method since this will wipe everything.

To reset, go to Setting > System > Reset options and tap on Erase all data. Now tap on confirmation to confirm your action. This action will reset everything to factory defaults and will reboot the phone.
Conclusion
So to wrap it up, these were the solutions that you can try to solve the “Obtaining IP address” or “Unable to connect” issue. If the issue still persists, it may be due to damaged hardware or software of router or phone. At that point, it is better to reach out to customer service for better solutions. If you have a warranty on the product, now it is time to claim it.