by Devin Yang
(This article was automatically translated.)

Published - 2 years ago ( Updated - 2 years 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


docker,cli

Docker container formatted display

I think if you want to write some automation functions, it may be useful to be able to format the output container content. The following are some reference examples of Docker container formatting and display instructions

MacOS

How do I compile tree instructions on MacOS?

I believe that Linux users have probably used the tree command. We can directly install the tree command through homebrew. But if we want to compile and install by ourselves, how should we do it? This article introduces how to compile tree instructions and install on your own MacOS.  

bash,cli

some commands to check cpu, ram and disk info in linux

Introduce those commands that can be used to check hardware information on the Linux host