Works for me on 10.15.2 (19C57) Catalina. -w is deprecated, and should be omitted.
sysctl net.inet.ip.ttl=65
net.inet.ip.ttl: 64 -> 65
ping localhost
PING localhost (127.0.0.1): 56 data bytes
64 bytes from 127.0.0.1: icmp_seq=0 ttl=64 time=0.040 ms
64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.065 ms
64 bytes from 127.0.0.1: icmp_seq=2 ttl=65 time=0.091 ms
64 bytes from 127.0.0.1: icmp_seq=3 ttl=65 time=0.091 ms
Using a launch daemon to persist the setting after reboot:
/Library/LaunchDaemons/com.gvalkov.ttl65.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.gvalkov.ttl65</string>
<key>MachServices</key>
<dict>
<key>com.gvalkov.ttl65</key>
<true/>
</dict>
<key>Program</key>
<string>/usr/bin/sysctl</string>
<key>ProgramArguments</key>
<array>
<string>/usr/bin/sysctl</string>
<string>net.inet.ip.ttl=65</string>
</array>
<key>UserName</key>
<string>root</string>
<key>GroupName</key>
<string>wheel</string>
<key>KeepAlive</key>
<true/>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
Note: I hope I got the path to sysctl correctly! Please run which sysctl
to obtain the actual path. I cannot currently check, because my MacBook Pro 2018 is being serviced again for swelling battery and stuck keys. :(
net.inet6.ip6.hlim=65