[教程] 在 macOS 上禁用 IPv6

IPv6尚未全面普及。

本文是一篇旧文,首发在 https://zblogs.top/how-to-disable-ipv6-macos/

今天发现公司的 Mac mini 打开某些网站(e.g. 公司官网)不是很快。问了一下公司的 IT 部同事,他们建议我在 macOS 上禁用 IPv6 试试。

IPv6 是什么

IPv6(Internet Protocol version 6)是互联网协议的一种版本,它是IPv4(Internet Protocol version 4)的继承者。IPv6旨在解决IPv4中存在的IP地址不足的问题,以满足不断增长的互联网连接需求,并提供更多的IP地址。

以下是IPv6的一些主要特点和重要信息:

  1. 更多的IP地址: IPv4使用32位地址,最多支持大约42亿个唯一的IP地址。然而,随着全球互联网的扩展,IPv4地址池逐渐枯竭。IPv6采用128位地址,这几乎可以提供无限数量的唯一IP地址,足以支持未来互联网连接的需求。
  2. 改进的安全性: IPv6包括一些安全性功能,如IPsec(Internet Protocol Security),这有助于提高互联网通信的安全性,包括数据加密和身份验证。
  3. 简化的头部: IPv6的首部(Header)相对于IPv4更简化,减少了路由器处理数据包的开销,提高了路由效率。
  4. 地址分配: IPv6引入了更简单和更灵活的地址分配方式,包括自动配置和无状态地址配置,使网络管理更容易。
  5. 向后兼容性: 尽管IPv6和IPv4不是向后兼容的,但IPv6支持一种称为“双栈”(dual-stack)的配置方式,允许IPv6和IPv4共存,并逐渐过渡到IPv6。

IPv6的推广是为了满足全球互联网的增长,并确保足够的IP地址可用于连接各种设备,包括智能手机、物联网设备、云计算和其他新兴技术。虽然IPv4仍然广泛使用,但IPv6已经在全球范围内推广,并在互联网基础设施中发挥越来越重要的作用。许多互联网服务提供商和网络运营商已经开始支持IPv6,并逐渐过渡到使用IPv6。

目前很多网站并未全面支持 IPv6,如果发现在 Mac 开启 IPv6 后访问某些网站反而变慢了,那可以考虑禁用 IPv6。

macOS 禁用 IPv6 具体步骤

在 macOS 上禁用 IPv6 需要在终端上操作,具体步骤如下:

  1. 打开终端 app,运行以下命令,macOS 会提示你输入 Mac 登录密码。输入完密码后按下 Enter 键以查看 macOS 所有网络接口及其名称:

    sudo networksetup -listallnetworkservices
    sudo networksetup -listallnetworkservices
  2. 在终端 app 内输入以下命令依次在 Wi-Fi 和 以太网接口上禁用 IPv6:

    sudo networksetup -setv6off Wi-Fi
    sudo networksetup -setv6off Ethernet
    sudo networksetup -setv6off

执行完这两条命令后,你已在 macOS 上禁用 IPv6。

如何在 macOS 上重新启用 IPv6

如果将来需要在 macOS 上重新启用 IPv6,可在终端 app 上依次输入以下命令:

sudo networksetup -setv6automatic Ethernet

sudo networksetup -setv6automatic Wi-Fi


Image by rawpixel.com on Freepik

More Reading

Post navigation

16 Comments

  • you are really a good webmaster. The website loading velocity is incredible. It seems that you are doing any distinctive trick. In addition, The contents are masterpiece. you have done a fantastic process in this subject!

  • Howdy! This is kind of off topic but I need some help from an established blog. Is it hard to set up your own blog? I’m not very techincal but I can figure things out pretty quick. I’m thinking about making my own but I’m not sure where to start. Do you have any ideas or suggestions? Many thanks

  • Hi there I am so happy I found your web site, I really found you by error, while I was searching on Google for something else, Regardless I am here now and would just like to say thank you for a tremendous post and a all round thrilling blog (I also love the theme/design), I don’t have time to look over it all at the moment but I have saved it and also included your RSS feeds, so when I have time I will be back to read a lot more, Please do keep up the excellent job.

  • Nice post. I was checking constantly this blog and I’m impressed! Very useful information particularly the last part 🙂 I care for such info a lot. I was seeking this particular info for a very long time. Thank you and good luck.

  • Way cool, some valid points! I appreciate you making this article available, the rest of the site is also high quality. Have a fun.

  • hey there and thank you for your info – I have certainly picked up anything new from right here. I did however expertise a few technical issues using this website, since I experienced to reload the web site many times previous to I could get it to load correctly. I had been wondering if your web hosting is OK? Not that I am complaining, but slow loading instances times will sometimes affect your placement in google and could damage your high-quality score if ads and marketing with Adwords. Well I’m adding this RSS to my email and could look out for a lot more of your respective interesting content. Make sure you update this again very soon..

  • 读起来像小说。谢谢 心情。 [url=https://iqvel.com/zh-Hans/a/%E4%B9%8C%E5%85%8B%E5%85%B0/Desnyansko-Starogutsky]觀景塔[/url] 我偶尔阅读 旅游博客。增长见识阅读游记。

  • Most of the things you articulate happens to be astonishingly legitimate and that makes me ponder the reason why I had not looked at this with this light before. Your article truly did switch the light on for me personally as far as this specific issue goes. But at this time there is one particular position I am not necessarily too comfy with so while I attempt to reconcile that with the central theme of your position, permit me see what the rest of the subscribers have to say.Well done.

  • I have read several good stuff here. Definitely worth bookmarking for revisiting. I surprise how much effort you put to make such a fantastic informative web site.

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注