码迷,mamicode.com
首页 > 其他好文 > 详细

centos7 最小化安装没有ifconfig及修改网卡名enoxxx为ethX

时间:2016-05-13 09:45:19      阅读:229      评论:0      收藏:0      [点我收藏+]

标签:

问题:

1、最小化安装centos7后发现无ifconfig命令

想通过ifconfig查看ip地址发现ifconfig命令不存在,可通过命令

#ip addr       //查看ip

或者

解决:

#yum -y install net-tools

问题:

2、centos7默认将网卡1命名为eno16777736,如何修改回熟悉的eth0

解决:

[root@localhost ~]# cat /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="vconsole.keymap=us crashkernel=auto  vconsole.font=latarcyrheb-sun16 rhgb quiet"
GRUB_DISABLE_RECOVERY="true"

[root@localhost ~]#vim /etc/default/grub  //或者编辑/etc/sysconfig/grub也一样,因为是/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="net.ifnames=0 biosdevname=0 vconsole.keymap=us crashkernel=auto  vconsole.font=latarcyrheb-sun16 rhgb quiet"   #增加net.ifnames=0(不使用新的命名规则) biosdevname=0(针对dell服务器不使用类似em0的命名规则) 
GRUB_DISABLE_RECOVERY="true"
[root@localhost ~]# grub2-mkconfig -o /etc/grub2.cfg //或者指定文件/boot/grub2/grub.cfg,/etc/grub2.cfg/boot/grub2/grub.cfg的软连接
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.10.0-123.9.3.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-123.9.3.el7.x86_64.img
Warning: Please don‘t use old title `CentOS Linux, with Linux 3.10.0-123.9.3.el7.x86_64‘ for GRUB_DEFAULT, use `Advanced options for CentOS Linux>CentOS Linux, with Linux 3.10.0-123.9.3.el7.x86_64‘ (for versions before 2.00) or `gnulinux-advanced-eb8b5914-351d-4274-85f7-40c3d3357b45>gnulinux-3.10.0-123.9.3.el7.x86_64-advanced-eb8b5914-351d-4274-85f7-40c3d3357b45‘ (for 2.00 or later)
Found linux image: /boot/vmlinuz-0-rescue-9623c0e26d1b452f9dc41631215adf1c
Found initrd image: /boot/initramfs-0-rescue-9623c0e26d1b452f9dc41631215adf1c.img
done
#cp /etc/sysconfig/network-scripts/ifcfg-eno16777736 /etc/sysconfig/network-scripts/ifcfg-eth0
#vim /etc/sysconfig/network-scripts/ifcfg-eth0
NAME=eth0 #NAME=eno16777736修改为

重启服务器

centos7 最小化安装没有ifconfig及修改网卡名enoxxx为ethX

标签:

原文地址:http://www.cnblogs.com/su-han/p/5485476.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!