Here’s a tutorial that explains how to set your Mac to use IPv4 instead of IPv6. Instructions have been tested and confirmed on macOS Sierra (10.12.3), though this should work on other OS versions too.
Ah, the Internet.
You’ve probably heard of an Internet Protocol (IP) address, even if you’re not super tech savvy. It’s how TV investigators find their suspects, right? Anyway, IP version 4 (IPv4) was the first version of the protocol that was deployed to manage data traffic, back when the Internet was in its infancy. An IP address identifies where data traffic should move, and IPv4 addresses are represented as four numbers, each of which can range from 0 to 255 (e.g., 188.8.131.52). This format allows for more than 4 BILLION unique addresses, which in 1983 seemed like enough to last forever.
Well – turns out the Internet got kind of popular, and we eventually started running low on available IP addresses. So the smarties over at the Internet Engineering Task Force (IETF) came up with IP version 6, which would allow for 3.4 x 10^38 unique addresses (i.e., a shitload). Anyway, the Internet has started migrating toward IPv6, and though you probably didn’t notice it, it’s possible that your device has now been assigned an IPv6 address, instead of an IPv4 address. If you Googled “what’s my IP?”, it might look something like the following:
This would all be well and good, except for the fact that there are still some situations where you’d still want to use an IPv4 address.
Here’s my real-life example.
I use Amazon RDS for many of my database needs (except, quite sadly, for redis as they don’t support it). My security group configurations use IP whitelisting to allow inbound connections to RDS instances, but AWS doesn’t support IPv6 addressing, so when my machine gets assigned an IPv6 address, I’m unfortunately unable to connect to my databases!
To get around this, I’m able to follow the simple instructions below to switch my Mac to use an IPv4 address instead. Here’s how to do it.
Two Easy Steps
Step 1) Open Terminal
Terminal is how you input commands that tend to affect the deeper parts of your Mac’s system. Don’t worry if you’ve never done this before – there’s only one thing you have to do and it’s super simple!
Step 2) Copy and Paste the Following Line Into Terminal
Copy and past the line of text below into Terminal, and press Enter.
[syntax type=”html|php|js|css”]networksetup -setv6off Wi-Fi[/syntax]
It’s possible that the system will ask you to enter your Mac user’s password. This will look something like the below. Type in your password and press Enter or click “Modify Configuration”.
You can Google “what’s my IP?” again to confirm that your machine is now using IPv4. If it worked, the result will look something like the following (i.e., 4 numbers separated by periods).