文章介绍:当我们有多个服务端时,我们想Windows和macOS客户端启动时指定默认服务器,请通过下面的方式解决。

一、Anylink配置修改

1.1、windows

C:\ProgramData\Cisco\Cisco Secure Client\VPN\Profile\profile_anylink.xml
<?xml version="1.0" encoding="UTF-8"?>
<AnyConnectProfile xmlns="http://schemas.xmlsoap.org/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                   xsi:schemaLocation="http://schemas.xmlsoap.org/encoding/ AnyConnectProfile.xsd">

    <ClientInitialization>
        <UseStartBeforeLogon UserControllable="false">false</UseStartBeforeLogon>
        <StrictCertificateTrust>false</StrictCertificateTrust>
        <RestrictPreferenceCaching>false</RestrictPreferenceCaching>
        <RestrictTunnelProtocols>IPSec</RestrictTunnelProtocols>
        <BypassDownloader>true</BypassDownloader>
        <AutoUpdate UserControllable="false">false</AutoUpdate>
        <LocalLanAccess UserControllable="true">true</LocalLanAccess>
        <WindowsVPNEstablishment>AllowRemoteUsers</WindowsVPNEstablishment>
        <LinuxVPNEstablishment>AllowRemoteUsers</LinuxVPNEstablishment>
        <CertEnrollmentPin>pinAllowed</CertEnrollmentPin>
        <CertificateMatch>
            <KeyUsage>
                <MatchKey>Digital_Signature</MatchKey>
            </KeyUsage>
            <ExtendedKeyUsage>
                <ExtendedMatchKey>ClientAuth</ExtendedMatchKey>
            </ExtendedKeyUsage>
        </CertificateMatch>

    </ClientInitialization>

    <ServerList>

        <HostEntry>
            <HostName>公司</HostName>
            <HostAddress>ip/域名+端口(443端口默认不加)</HostAddress>
        </HostEntry>

    </ServerList>
</AnyConnectProfile>
C:\ProgramData\Cisco\Cisco Secure Client\VPN\Profile\profile.xml
<?xml version="1.0" encoding="UTF-8"?>
<AnyConnectProfile xmlns="http://schemas.xmlsoap.org/encoding/"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
  xsi:schemaLocation="http://schemas.xmlsoap.org/encoding/ AnyConnectProfile.xsd">
    <ClientInitialization>
        <IPProtocolSupport>IPv4</IPProtocolSupport>
        <AutoReconnect UserControllable="true">
            true
            <AutoReconnectBehavior UserControllable="true">ReconnectAfterResume</AutoReconnectBehavior>
        </AutoReconnect>
        <AutoUpdate UserControllable="false">false</AutoUpdate>
 
        <BackupServerList>
            <HostAddress>ip/域名+端口(443端口默认不加)(上面的配置文件有多个HostEntry时,这里是优选显示)</HostAddress>
        </BackupServerList>
        <LocalLanAccess>true</LocalLanAccess>
        <BypassDownloader>true</BypassDownloader>
    </ClientInitialization>
    <ServerList>
    </ServerList>
</AnyConnectProfile>

二、macOS

sudo nano /opt/cisco/anyconnect/profile/Profile.xml
<?xml version="1.0" encoding="UTF-8"?>
<AnyConnectProfile> 
<ServerList> 
     <HostEntry>
          <User> 用户账户名称 </User>
          <HostName> 自定义显示名称 </HostName>
          <HostAddress> 服务器地址 </HostAddress>
     </HostEntry>
     <HostEntry>
          <User> 用户账户名称 </User>
          <HostName> 自定义显示名称 </HostName>
          <HostAddress> 服务器地址 </HostAddress>
     </HostEntry>
</ServerList>
</AnyConnectProfile>

三、Windows

Windows系统目录默认在C:\Users\你的用户名\AppData\Local\Cisco\Cisco Secure Client\VPN\preferences.xml

3.1、快捷方式一

C:\Users\%username%\AppData\Local\Cisco\Cisco Secure Client\VPN

yydy_2024-04-26_23-23-33

3.2、快捷方式二

Windows+R打开运行框输入:%appdata%,回车,你会进入C:\Users\你的用户名\AppData\Roaming目录,然后鼠标点击返回上一层目录,在按照上面的顺序往下点就可以找到了。

%appdata%

yydy_2024-04-26_23-13-46
yydy_2024-04-26_23-14-05
yydy_2024-04-26_23-14-16
yydy_2024-04-26_23-14-50

<?xml version="1.0" encoding="UTF-8"?>
<AnyConnectPreferences>
<DefaultUser> 默认用户名 </DefaultUser>
<DefaultSecondUser/>
<ClientCertificateThumbprint/>
<ServerCertificateThumbprint/>
<DefaultHostName> 默认服务器地址 </DefaultHostName>
<DefaultHostAddress/>
<DefaultGroup> 默认组 </DefaultGroup>
<ProxyHost/>
<ProxyPort/>
<SDITokenType/>
<ControllablePreferences>
<EnableAutomaticServerSelection>false</EnableAutomaticServerSelection>
<LocalLanAccess>false</LocalLanAccess>
<BlockUntrustedServers>false</BlockUntrustedServers>
</ControllablePreferences>
</AnyConnectPreferences>