
配置 IP 地址
[root@svr7 ~]# nmcli connection show #查看连接名
[root@svr7 ~]# nmcli connection delete ens33 #删除
[root@svr7 ~]# nmcli connection show
NAME UUID TYPE DEVI
virbr0 0ace37a8-f7ad-45d6-9088-00b367999c0b bridge virb
有线连接 1 02cc8558-b41e-3bc4-817b-243ca95c0417 ethernet eth
重新添加网卡
[root@svr7 ~]# nmcli connection delete 有线连接\ 1
ot@svr7 ~]# nmcli connection add type ethernet ifname eth0 con-name eth0 #添加网卡
连接“eth0”(7b47bf24-859e-45f5-ace7-3b9706b61e55) 已成功添加。
[root@svr7 ~]# nmcli connection show
NAME UUID TYPE DEVICE
eth0 7b47bf24-859e-45f5-ace7-3b9706b61e55 ethernet eth0
配置 IP
[root@svr7 ~]# nmcli connection modify eth0 ipv4.method manual ipv4.addresses
192.168.10.5/24 ipv4.gateway 192.168.10.2 connection.autoconnect yes #配置 IP 地址和
网关并实现开机自动连接,此处 ip 地址和网关地址要根据自己的虚拟机网络配置来确定(参
考下一页的 P3 虚拟机网络类型步骤)
[root@svr7 ~]# nmcli connection up eth0 #激活 eth0
[root@svr7 ~]# ifconfig #查看配置的 IP
[root@svr7 ~]# route -n #查看网关
为本机指定 DNS 服务器
[root@svr7 ~]# vim /etc/resolv.conf
…
nameserver 8.8.8.8
修改指定主机映射文件
[root@svr7 ~]# vim /etc/hosts
增加:
192.168.10.5 svr7.tedu.cn
此时 ping 主机名,可以映射到 IP, 请注意:该文件应该到发起 ping 的主机上修改,而不是
目标主机(被 ping 方)。
P3 虚拟网络类型
请选择 NAT 模式
打开 Vmware 虚拟机,选择菜单中的“虚拟机”的“设置”
评论0
最新资源