https://github.com/maelvls/switch_interfaces
Switch network interface and proxy simultaneously (Gnome + NetworkManager). Useful for switching networks when working behind a corporate firewall 😁
https://github.com/maelvls/switch_interfaces
gnome networking networkmanager nmcli proxy
Last synced: 11 months ago
JSON representation
Switch network interface and proxy simultaneously (Gnome + NetworkManager). Useful for switching networks when working behind a corporate firewall 😁
- Host: GitHub
- URL: https://github.com/maelvls/switch_interfaces
- Owner: maelvls
- License: mit
- Created: 2018-11-10T07:36:00.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2020-05-30T14:40:00.000Z (about 6 years ago)
- Last Synced: 2025-06-10T02:39:31.701Z (about 1 year ago)
- Topics: gnome, networking, networkmanager, nmcli, proxy
- Language: Shell
- Homepage:
- Size: 3.91 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Switch interfaces and proxy server easily
```shell
> ./switch_interfaces --help
A small script for helping me switch interfaces + local proxies.
Usage: switch_interfaces (primary | secondary)
switch_interfaces --status
switch_interfaces --help
With:
(primary, secondary) are configured in /home/mvalais/.switch_interfaces.conf,
which should look like something like (in brackets = optionnal service
name that should be launched when this interface goes up):
primary=eth1[,cntlm]
secondary=enp0s3[,squid]
Environement variables:
COLOR = (auto | always) [value: auto]
In auto mode, colors will be removed when launched from a tty instead of
an interactive shell.
TIMEOUT = 1s, 2s, 1m... [value: ]
During connexion or deconnexion using nmcli, the tool may get stuck/stall.
Example of /home/mvalais/.switch_interfaces.conf:
# Set the primary and secondary interfaces you want to switch back and forth.
# After the comma ',' means that a service (here, cntlm and squid) can
# be associated so that when the interface is up, the service is launched. You
# can skip this though (and remove the comma). Uncomment to enable
# Example 1:
# primary=eth1,cntlm
# secondary=enp0s3,squid
# Example 2:
# primary=eth1
# secondary=enp0s3
Maël Valais, 2018
```
Written using [shellcheck] and [shfmt] as well as the [shellcheck-vscode]
and [shell-format-vscode]\ (using vscode).
[shellcheck]: https://www.shellcheck.net
[shfmt]: https://github.com/mvdan/sh
[shell-format-vscode]: https://marketplace.visualstudio.com/items?itemName=foxundermoon.shell-format
[shellcheck-vscode]: https://marketplace.visualstudio.com/items?itemName=timonwong.shellcheck
## Install
git clone
cd
make install
Maël Valais, 2018