Linux配置虚拟网卡
修改主机名
#查看主机名
hostname
#主机名的配置文件
cat /etc/hostname
#修改主机名 hostnamectl set-hostname 主机名
hostnamectl set-hostname servera
#刷新当前bash
bash
su -关闭防火墙
#关闭防火墙
systemctl stop firewalld.service
#查看防火墙状态
systemctl status firewalld.service
#不让服务开机自启
systemctl disable firewalld.service关闭Selinux
#查看当前Selinux的状态
getenforce
显示:Enforcing
#修改配置文件,将Selinux的状态设置为disabled
vim /etc/sysconfig/selinux
#SELINUX=disabled 修改的内容为此行设置IP地址
#设置vmware软件的虚拟网络编辑器的nat模式的网段及网关
#查看硬件网卡信息
nmcli device show ens32
#查看网卡连接状态
nmcli connection show
#新增类型为ethernet的网卡eth0,逻辑连接名,,开机自联
nmcli connection add type ethernet con-name eth0 ifname ens32 connection.autoconnect yes autoconnect yes
#设置eth0网卡的地址、网关、dns、模式等信息
nmcli connection modify eth0 ipv4.addresses "192.168.0.10/24" ipv4.gateway 192.168.0.254 ipv4.dns 8.8.8.8 ipv4.method manual
#重启网卡
nmcli connection down eth0
nmcli connection up eth0
#验证
ping www.baidu.com -c 4重启验证
reboot
1. 验证主机名
2. 验证防火墙是否关闭
3. 验证Selinux是否关闭
4, ping baidu 验证外网是否正常访问
5. ping vmnet1,验证仅主机模式网卡是否正常
关机
poweroff
做快照
本文版权归原作者所有。建议访问原文,转载本文请联系原作者。