キー/値ペア辞書の正しい構文

キー/値ペア辞書の正しい構文

私は文書を読んだ。ここそしてここ。私の目標は、IP-sec VPN接続のみを設定することですnmcli。私はXサーバーなしでUbuntu 20.04サーバーを実行しています。すでに別のコンピュータに接続ファイルがあるため、必要なすべての情報があります。

[connection]
id=myVPN
uuid=blabla-blabla-blabla
type=vpn
autoconnect=false
permissions=user:mark:;

[vpn]
IKE DH Group=dh2
IPSec ID=myID
IPSec gateway=myGateway
IPSec secret-flags=1
Local Port=0
NAT Traversal Mode=natt
Perfect Forward Secrecy=server
Vendor=cisco
Xauth password-flags=1
Xauth username=myUser
ipsec-secret-type=save
xauth-password-type=save
service-type=org.freedesktop.NetworkManager.vpnc

[ipv4]
dns-search=
method=auto

[ipv6]
addr-gen-mode=stable-privacy
dns-search=
method=auto

[proxy]

最初の試みは次のとおりです。

sudo nmcli connection add connection.id myVPN connection.type vpn connection.autoconnect false connection.permissions mark vpn.data {"IKE DH Group"="dh2" "IPSec ID"="myID" "IPSec gateway"="myGateway" "IPSec secret-flags"="1" "Local Port"="0" "NAT Traversal Mode"="natt" "Perfect Forward Secrecy"="server" "Vendor"="cisco" "Xauth password-flags"="1" "Xauth username"="myUser" "ipsec-secret-type"="save" "xauth-password-type"="save" } vpn.service-type=org.freedesktop.NetworkManager.vpnc

次のエラーで失敗します。

エラー:<設定>。<プロパティ> 'IPSec ID = myID'が無効です。

キーと値のペアを割り当てる.代わりに必要であることを理解してください。=2番目の試みは次のとおりです。

エラー:vpn.dataを修正できません。 「{IKE DH Group.dh2」は無効です。 =

今反対だと言います。 `=記号が欲しい。これらのキーと値のペアを設定する正しい構文は何ですか?

ベストアンサー1

構成があれば、ただインポートするのはどうでしょうか?nmcli connection importコマンドを使用してください。nmcli最初のリンクのドキュメント

import [--temporary] [type type] [file file]

Import an external/foreign configuration as a NetworkManager connection profile. The type of the input file is specified by type option.

Only VPN configurations are supported at the moment. The configuration is imported by NetworkManager VPN plugins. type values are the same as for vpn-type option in nmcli connection add. VPN configurations are imported by VPN plugins. Therefore the proper VPN plugin has to be installed so that nmcli could import the data.

The imported connection profile will be saved as persistent unless --temporary option is specified, in which case the new profile won't exist after NetworkManager restart.

おすすめ記事