Change the IP address to avoid hacking your computer (by IP address) or just to get a new IP address. You can change the IP address of your Mac through System Preferences.
Steps
Method 1 of 3: How to change the IP address

Step 1. Click on the Apple logo

You will find it in the upper left corner of the screen. A menu will open.

Step 2. Click on System Preferences
You will find this option in the About This Mac section.

Step 3. Click on Network
It's on the third line next to the "iCloud" option.

Step 4. Click on the network you are using on the left sidebar
For example, if your computer is connected to a wireless network, click Wi-Fi.

Step 5. Click on Advanced
You will find this option in the lower right corner of the window.

Step 6. Click the TCP / IP tab
You will find it at the top of the window next to the DNS, WINS, 802.1X, Proxy, and Hardware tabs.

Step 7. Open the menu next to "Configure IPv4" and click "Manual"
Alternatively, you can click Renew DHCP to have the computer automatically create a new IP address

Step 8. Enter the new IP address in the "IPv4 Address" line
You can enter the current IP address, but with the last digit changed. For example, if the current IP address is 10.0.1.8, enter something like 10.0.1.129.

Step 9. Click on OK > Apply.
The IP address will be changed.
Method 2 of 3: How to use a proxy server

Step 1. Click on the Apple logo

You will find it in the upper left corner of the screen. A menu will open.
Use this method if your current network is down, as the proxy will work over a different but temporary network

Step 2. Click on System Preferences
You will find this option in the About This Mac section.

Step 3. Click on Network
It's on the third line next to the "iCloud" option.

Step 4. Click on the network you are using on the left sidebar
For example, if your computer is connected to a wireless network, click Wi-Fi.

Step 5. Click on Advanced
You will find this option in the lower right corner of the window.

Step 6. Click the Proxy tab
You will find it at the top of the window next to the DNS, WINS, 802.1X, TCP / IP, and Hardware tabs.

Step 7. Check the box next to the required protocol in the "Select a protocol" section
- Check the "SOCKS" box if you don't know which protocol to choose. SOCKS is often used to transfer network packets between clients and servers through a proxy server; this protocol is designed to improve security and hide the IP address.
- Web proxy (HTTP) and secure web proxy (HTTPS) are also widely used, but they are less secure than the SOCKS protocol.

Step 8. Enter the IP address of the selected proxy server in the blank line
If you want to use a SOCKS proxy server, a list of them can be found at http://sockslist.net/ (select an IP address of type 4 or 5)

Step 9. Click OK > Apply.
The computer will connect to the proxy server.
Method 3 of 3: How to Disconnect Your Router / Modem

Step 1. Disconnect your router or modem
Sometimes the router and modem are one device, so just unplug the cable from the same electrical outlet. If your router and modem are two different devices, turn off either one to reset the IP address.
Wait a couple of minutes. Most home computers are assigned a so-called dynamic IP address. That is, your ISP assigns a new IP address to your computer every time your router or modem connects to the network

Step 2. Connect your router
Wait for the router to connect to the network.

Step 3. Check if the IP address has changed
You can find out in the "Network" section of the "System Preferences" menu.