CentOS7修改網卡為eth0

來源:互聯網
上載者:User

CentOS7修改網卡為eth0

1.編輯網卡資訊

[root@linux-node2~]# cd /etc/sysconfig/network-scripts/#進入網卡目錄

[root@linux-node2network-scripts]# mv ifcfg-eno16777728 ifcfg-eth0#重新命名網卡名稱

[root@linux-node2network-scripts]# cat ifcfg-eth0 #編輯網卡資訊

TYPE=Ethernet

BOOTPROTO=static

DEFROUTE=yes

PEERDNS=yes

PEERROUTES=yes

IPV4_FAILURE_FATAL=no

NAME=eth0#name修改為eth0

ONBOOT=yes

IPADDR=192.168.56.12

NETMASK=255.255.255.0

GATEWAY=192.168.56.2

DNS1=192.168.56.2

2.修改grub

[root@linux-node2~]# cat /etc/sysconfig/grub#編輯核心資訊,添加紅色欄位的

GRUB_TIMEOUT=5

GRUB_DEFAULT=saved

GRUB_DISABLE_SUBMENU=true

GRUB_TERMINAL_OUTPUT="console"

GRUB_CMDLINE_LINUX="crashkernel=autorhgbnet.ifnames=0 biosdevname=0quiet"

GRUB_DISABLE_RECOVERY="true"

[root@linux-node2~]# grub2-mkconfig -o /boot/grub2/grub.cfg#產生啟動菜單

Generatinggrub configuration file ...

Foundlinux image: /boot/vmlinuz-3.10.0-229.el7.x86_64

Foundinitrd image: /boot/initramfs-3.10.0-229.el7.x86_64.img

Foundlinux image: /boot/vmlinuz-0-rescue-1100f7e6c97d4afaad2e396403ba7f61

Foundinitrd image: /boot/initramfs-0-rescue-1100f7e6c97d4afaad2e396403ba7f61.img

Done

3.驗證是否修改成功

[root@linux-node2~]# reboot#必須重啟系統生效

[root@linux-node2~]# yum install net-tools#預設centos7不支援ifconfig需要看裝net-tools包

[root@linux-node2~]# ifconfig eth0#在次查看網卡資訊

eth0:flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500

inet 192.168.56.12 netmask 255.255.255.0 broadcast 192.168.56.255

inet6 fe80::20c:29ff:fe5c:7bb1 prefixlen 64scopeid 0x20<link>

ether 00:0c:29:5c:7b:b1 txqueuelen 1000 (Ethernet)

RX packets 152 bytes 14503 (14.1 KiB)

RX errors 0 dropped 0overruns 0 frame 0

TX packets 98 bytes 14402 (14.0 KiB)

TX errors 0 dropped 0 overruns 0 carrier 0collisions 0

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.