Cent os 7 安裝後進行網絡配置
因為對7使用還不太熟悉,趕緊周末安裝一個cent os 7 試試,結果發現網絡配置居然有坑。
默認沒有eth這種顯示了,具體的就不多說了,親測vmware下這樣配置是可以ssh是可以連通的
首先iptables/firewall/selinux等關閉
編輯網卡的配置文件 vi /etc/sysconfig/network-scripts/ifcfg-ens33 將裏面的NAME和DEVICE項修改為eth0
[root@ocbsdb01 ~]# vim /etc/sysconfig/network-scripts/ifcfg-ens33
TYPE=Ethernet
BOOTPROTO=static
NAME=eth0
DEVICE=eth0
ONBOOT=yes
HWADRR=00:0c:29:d9:86:dc
IPADDR=192.168.10.128
NETMASK=255.255.255.0
2.重命名網卡配置文件ifcfg-ens33為ifcfg-eth0
[root@ocbsdb01 ~]# cd /etc/sysconfig/network-scripts/
[root@ocbsdb01 network-scripts]# mv ifcfg-ens33 ifcfg-eth0
3.編輯/etc/default/grub並加入“net.ifnames=0 biosdevname=0 ”到GRUBCMDLINELINUX變量
[root@ocbsdb01 network-scripts]# vi /etc/default/grub
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="crashkernel=auto net.ifnames=0 biosdevname=0 rhgb quiet"
GRUB_DISABLE_RECOVERY="true"
4.運行命令grub2-mkconfig -o /boot/grub2/grub.cfg 來重新生成GRUB配置並更新內核參數。
[root@ocbsdb01 network-scripts]# grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.10.0-514.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-514.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-b7f83ca165964a47b8b283907b126140
Found initrd image: /boot/initramfs-0-rescue-b7f83ca165964a47b8b283907b126140.img
done
5.重啟系統
[root@ocbsdb01 network-scripts]# reboot
Cent os 7 安裝後進行網絡配置