网络配置
1、 给本地网卡配置在原会话的基础上配置多会话,会话分别为eth1和eth2.
添加会话
- nmcli connection add type ethernet con-name eth1 ifname ens160
- nmcli connection add type ethernet con-name eth2 ifname ens160
2、 通过nmcli con modify的方式将会话eth1配置为静态ip,ip地址为xxx.xxx.xxx.100/24
- nmcli connection modify eth1 ipv4.addresses "192.168.1.100/24 "
- nmcli connection modify eth1 ipv4.method manual
- nmcli con mod eth2 ipv4.addresses "192.168.2.200/24 "
3、通过nmcli con edit 的方式将会话eth2配置为静态ip,ip地址为xxx.xxx.xxx.200/24
- nmcli con mod eth2 ipv4.addresses "192.168.2.200/24 "
- nmcli con mod eth2 ipv4.gateway 192.168.0.1
- nmcli con mod eth2 ipv4.dns 114.114.114.114
4、默认会话ens160配置为动态获取地址。注:网关,dns根据实际情况自行配置 - vim /etc/sysconfig/network-scripts/ifcfg-ens160
5、将自己创建的网卡会话删除。 --------(做之前切记确认有无快照)
- rm -rf /etc/sysconfig/network-scripts/ifcfg-ens160