IT博客汇
  • 首页
  • 精华
  • 技术
  • 设计
  • 资讯
  • 扯淡
  • 权利声明
  • 登录 注册

    [原]OSX: 尝试禁止Bonjour广播带来的问题解决(10.11.x或更新)

    afatgoat发表于 2016-08-10 13:34:13
    love 0

    前些日子,希望尝试禁止Bonjour广播来减少其在局域网内的影响,于是找了一些方案:

    1. 最老的的方案,适合于10.9的是:

    launchctl unload -w /System/Library/LaunchDaemons/com.apple.mDNSResponder.plist
    

    2. 到了10.10后,应该使用:

    defaults write /System/Library/LaunchDaemons/com.apple.mDNSResponder.plist ProgramArguements -array-add '{-NoMulticastAdvertisements;}'
    

    或者

    plistbuddy -c "add :ProgramArguments:1 -NoMulticastAdvertisements" /System/Library/LaunchDaemons/com.apple.mDNSResponderHelper.plist
    


    改动了之后,正好休息两个星期,于是就没有启动,也就快忘记了。到了家之后,忘了什么时候重新启动了一次,发现最近总是觉得上网很慢,打开一个网页要等个几秒钟才能看到内容,App Store也总是不能连接服务器,最初以为是网络服务商的问题或者我的无线路由的问题,检查了一遍没有发现问题。后来发现命令行的softwareupdate也无法连接服务器,Google Chrome浏览器的更新也是出现错误,而且命令行中ping google.com也是无法解析域名了,那么应该是本机自己的问题,再看看系统日志,产生无数的dnssd_clientstub ConnectToServer的错误信息。于是回想起原来禁用Bonjour广播的尝试,那么改回去之后重启,正常多了!

    $ sudo plistbuddy -c "print :ProgramArguments:1" /System/Library/LaunchDaemons/com.apple.mDNSResponderHelper.plist
    -NoMulticastAdvertisements
    $ sudo plistbuddy -c "delete :ProgramArguments:1" /System/Library/LaunchDaemons/com.apple.mDNSResponderHelper.plist

    后来在jamf的论坛中找到了一条,Apple的Developer Bug Reporting团队的回复得到10.11下的一些参数,可以整理如下:

    Starting in 10.11.x(El Capitan) on OSX, the options will be:
       DebugLogging, UnicastPacketLogging, NoMulticastAdvertisements, StrictUnicastOrdering and AlwaysAppendSearchDomains
    
    To turn ON the particular option, here is what the user should do (as an example of setting two options)
       1] sudo defaults write /Library/Preferences/com.apple.mDNSResponder.plist AlwaysAppendSearchDomains -bool YES
       2] sudo defaults write /Library/Preferences/com.apple.mDNSResponder.plist NoMulticastAdvertisements -bool YES
       3] sudo reboot
    
    To turn OFF all options, here is what the user should do
       1] sudo defaults delete /Library/Preferences/com.apple.mDNSResponder.plist
       2] sudo reboot
    
    To view the current options set, here is what the user should do
       1] plutil -p /Library/Preferences/com.apple.mDNSResponder.plist
       OR
       1] sudo defaults read /Library/Preferences/com.apple.mDNSResponder.plist






沪ICP备19023445号-2号
友情链接