📜  更改 dns 服务器以进行 vpn 连接 - Shell-Bash 代码示例

📅  最后修改于: 2022-03-11 14:51:08.850000             🧑  作者: Mango

代码示例1
function set_nextdns_for_vpn {
    vpn_id=`nmcli con show --active | grep -i vpn | grep -v 'dummy' | awk '{print $3}'`
    if [ ! -z "$vpn_id" ]
    then
        nmcli connection modify "$vpn_id" ipv4.ignore-auto-dns true
        nmcli connection modify "$vpn_id" ipv4.dns 45.90.28.28,45.90.30.28
    fi
}