linux :ip地址配置
(1)命令行配置ip地址(自动)
read -p "please input 网卡名:" network
nmcli connection modify $network ipv4.method auto connection.autoconnect yes
nmcli connection up $network &> /dev/null
echo "$network 已经激活了"
(2)命令行配置ip地址(手动)
read -p "please input 网卡名:" network
nmcli connection modify $network ipv4.method manual ipv4.address 192.168.4.5/24 ipv4.gateway 192.168.4.254 ipv4.dns 8.8.8.8 connection.autoconnect yes
nmcli connection up $network &> /dev/null
echo "$network 已经激活了"