If you give your computer IP to someone else, what can be the harm?
Image Source
Risks:
DDoS Attack: If someone knows your public IP address, he can launch a DDoS (Distributed Denial of Service) attack on your system. This can slow down your internet connection, or cause the system to stop working.
Network Scanning and Vulnerability Finding: A hacker can scan your network using IP address and if any vulnerability is found, can infiltrate your computer through it.
Leakage of Geolocation Information: It is possible to determine your location (specific city or region) from IP address. Although it is not very specific, it gives an idea of your location, which can lead to loss of privacy.
Phishing and Social Engineering Attacks: Using the IP address a hacker can learn some information about your system and try phishing or other social engineering attacks based on that.
Ways to reduce risk:
Use VPN: Using VPN (Virtual Private Network) can hide your real IP address.
Use a firewall: Keep the computer's firewall active to prevent any intrusion attempts.
Keep software updated: Keeping all software on your system updated reduces security vulnerabilities.
It is better not to share public IP address unless it is necessary, as it can be a potential source of cyber attacks.