VM安裝了一個Linux系統(tǒng)CentOS,但是安裝后發(fā)現(xiàn)ping www.baidu.com 報錯 。查了一下發(fā)現(xiàn)需要配置網(wǎng)卡。 1.首先需要進(jìn)入目錄 /etc/sysconfig/network-scripts 這里我的centos的 iso版本是:CentOS-7-x86_64-DVD-1708.iso。進(jìn)入目錄之后可以看到有個ifcfg-ens33的文件。我們需要對這個文件做些修改。 2.vi ifcfg-ens33 這里主要需要修改幾個地方。 a.由于我要配置的靜態(tài)的IP,所以BOOTPROTO=static。 b.ONBOOT=yes。默認(rèn)為no,開啟網(wǎng)絡(luò)連接。 d.IPADDR,NETMASK,GATEWAY,DNS1,DNS2參考修改 7.重啟network service service network restart. 8.測試ping ping www.baidu.com 注:這里我VM里面的網(wǎng)卡配置的橋接方式。 centos7的網(wǎng)卡重啟方法1、centos6的網(wǎng)卡重啟方法:service network restart 2關(guān)閉防火墻并設(shè)置開機(jī)不啟動 查看防火墻狀態(tài):systemctl status firewalld.service
centos6 關(guān)閉虛擬機(jī)防火墻: 關(guān)閉命令: service iptables stop 永久關(guān)閉防火墻:chkconfig iptables off 兩個命令同時運(yùn)行,運(yùn)行完成后查看防火墻關(guān)閉狀態(tài) service iptables status 1 關(guān)閉防火墻-----service iptables stop 2 啟動防火墻-----service iptables start 3 重啟防火墻-----service iptables restart 4 查看防火墻狀態(tài)--service iptables status 5 永久關(guān)閉防火墻--chkconfig iptables off 6 永久關(guān)閉后啟用--chkconfig iptables on ———————————————— SELinux
安裝vim yum install -y vim* Vim 的全局配置一般在 VIM配置入門 |
|