If you’ve encountered the Internet Sharing issue, detailed in this article, on macOS, you’ll be happy to know that, fortunately, there are several methods to tackle this problem, ranging from a simple quick fix to more advanced and automated solutions.
NOTE: Before getting started, I’ve found that these solutions stop Internet Sharing from working. But the last two allow you to keep it enabled when connected to networks sharing using the
192.168.x.xIP Range, while staying out of your way on other networks.
1. The Simplest Solution
If you don’t really use it that often, then the easiest way to resolve the Internet Sharing issue is to just turn it off:
- Open System Settings, and go to General>Sharing.
- Disable Internet Sharing.
- Toggle your Network connection off, and on again.
You need to toggle your network connection, otherwise the
bridge100interface won’t be taken down by the system until it connects to a different network.
2. The Bash(ed) Solution
For users comfortable with bash commands, there’s a really simple script you can use fix the problem, without disabling Internet Sharing.
While a script can be turned into a command or run through basic automation, you could just throw this command into the terminal any time you want to fix this:
sudo ifconfig bridge100 inet 10.0.2.1 netmask 255.255.255.0 broadcast 10.0.2.255This command overwrites the current configuration of the bridge100 interface, which is integral to Internet Sharing. Keep in mind that this configuration may affect the functionality of Internet Sharing.
To revert to the default settings, you can either:
- Connect to a different network, or
- Toggle your network connection off and on again.
Here’s the script I put together to simplify, automate, and polish up this process:
Your Title Goes Here
Your content goes here. Edit or remove this text inline or in the module Content settings. You can also style every aspect of this content in the module Design settings and even apply custom CSS to this text in the module Advanced settings.
bridge100-fix.sh
#!/bin/bashset -etrap 'echo "[ERROR] Error occurred at $BASH_SOURCE:$LINENO command: $BASH_COMMAND"' ERR
current=$(netstat -nr -f inet | grep en0 | grep default)if [[ $current == *"192.168"* ]]; then echo "[WARN] en0 interface using 192.168.x.x - No need to fix..." exit 0fi
sudo ifconfig bridge100 inet 10.0.2.1 netmask 255.255.255.0 broadcast 10.0.2.255echo "bridge100 set to 10.0.2.1"echo
netstat -rn -f inet | grep bridge100
NOTE: For those who aren’t in the know, you can place this script in any directory within your shell’s
$PATHto have it recognized as a command, I recommend the~/bindirectory, further simplifying execution.
3. Using Apple Shortcuts
The most easily automated solution involves Apple’s Shortcuts. If you don’t want to set it up yourself, you can add mine to your Shortcuts collection using this link.
To set it up manually:
- Add a Get current IP address action, set to local, and IPv4.
- Add an If action, checking if Current IP Address, begins with 192.168.
- (Optional, Visual Aid): Before the Otherwise section, add a Nothing action.
- In the Otherwise section, add a Run Shell Script action, containing the main command from the bash script solution:
sudo ifconfig bridge100 inet 10.0.2.1 netmask 255.255.255.0 broadcast 10.0.2.255
NOTE: You really only need the Run Shell Script action, but if your main network also uses a
192.168.x.xIP Range, then adding this check will allow Internet Sharing to work on that network, while staying out of your hair when you don’t need it.
I know of at least 2 good options to automate this shortcut:
- Use Shortery, an easy to use third-party app, for Shortcuts automation on macOS, that has a PRO trigger for then you connect to a network.
- Alternatively, consider BetterTouchTool, which also supports automation but has a much steeper learning curve to use properly.
Shortery requires a $10 annual subscription for PRO automation triggers, whilst BetterTouchTool only requires a really affordable one-time purchase that’s honestly a steal for how much the software can do. Ultimately both choices are great, depending on your use-case.
Automation is highly recommended because the bridge100 interface resets each time you join a new network. Although you can perform manual fixes each time, setting up automation will streamline the process and save you time in the long run.
Conclusion
By choosing the method that best suits your comfort level, and needs, you can efficiently resolve the internet sharing issue on your macOS device.
I hope this article was helpful, and hope you have a wonderful day!
Related Articles:
If you want to explored this issue a little deeper, you can read about it in this article.
If you want to learn how to enable, and configure, Internet Sharing. You can read this one.
Credits
- Apple – Parts of the Featured Image.