by Devin Yang
(This article was automatically translated.)

Published - 1 year ago ( Updated - 1 year ago )

I will use MacOS to dial VPN in the command line.
I provide my alias here, setting method:

 alias vpnlist=' scutil --nc list'
 alias vpn='networksetup -connectpppoeservice "Monitor"'
 alias vpnstop='scutil --nc stop Monitor'
 alias vpnstatus='networksetup -showpppoestatus "Monitor"'

Do not copy the name of the Monitor, it is the name I set, you can view the VPN you set by yourself with vpnlist.

Available network connection services in the current set (*=enabled):
* (Disconnected) 1AC8942C-7950-4E79-9422-10327900040D PPP --> L2TP "Monitor" [PPP:L2TP]

Set up an alias, when I need a vpn connection, Just use vpn to establish a connection.
For the first time, you need to manually connect and save the password

#Execute vpn alias
$vpn

#View vpn status
$vpnstatus
connected

#If you want to disconnect, just download
$vpnstop

Tags: vpn cli macos

Devin Yang

Feel free to ask me, if you don't get it.:)

No Comment

Post your comment

Login is required to leave comments

Similar Stories


vim, macos

Ultisnips requires py >= 2.7 or py3 Bugfix

If you install Vim like me, will there be an error that python2.7 or python3 is required when executing the terminal, but the system obviously has python 2.7? This article explains how I fixed this issue.

docker,php,cli

MacOS's php is not powerful, use docker to execute laravel installer

It's very simple, just add an "alias" alias laravel='docker run --rm -v ${PWD}:/var/www/html -v ~/.dlaravel/cache:/home/dlaravel/.composer /cache -ti deviny/fpm:8.1.10 /home/dlaravel/.composer/vendor/bin/laravel'

MacOS

How to disable IPV6 functionality on a specific device in MacOS

How to disable or enable IPV6 on your own MacOS, you can use networksetup -listallnetworkservices to list all MacOS network devices, and then execute the disable command.