關於 CentOS 7 網路設定

來源:互聯網
上載者:User

標籤:centos7 vmware網路

1、nmcli con
[[email protected] ~]# nmcli con
NAME    UUID                                  TYPE            DEVICE
enp2s3  392f1079-f6eb-af36-31cb-9ce552231745  802-3-ethernet  enp2s3
enp2s0  8c6fd7b1-ab62-a383-5b96-46e083e04bb1  802-3-ethernet  enp2s0


2、開啟/etc/sysconfig/network-scripts/ifcfg-enp2s0檔案,
TYPE=Ethernet
BOOTPROTO=dhcp
NAME=enp2s0
UUID=00eaabe5-1f75-4c01-a21f-79bf9c76d496
DEVICE=enp2s0
ONBOOT=yes

以步驟1中DEVICE名字對應的UUID,更新本文檔的UUID.
說明:
(1)一般情況下,網路裝置預設的UUID值與實際的DEVICE是不匹配的,需要需要以實際的UUID更新。
(2)ONBOOT項設定為yes 啟用 

更新後檔案為:
[[email protected] ~]# cat /etc/sysconfig/network-scripts/ifcfg-enp2s0
TYPE=Ethernet
BOOTPROTO=dhcp
NAME=enp2s0
UUID=8c6fd7b1-ab62-a383-5b96-46e083e04bb1
DEVICE=enp2s0
ONBOOT=yes


3、網卡資訊
[[email protected] ~]# dmesg | grep -in eth
554:[    2.134579] e1000 0000:02:00.0 eth0: (PCI:66MHz:32-bit) 00:0c:29:9c:f8:d5
555:[    2.134588] e1000 0000:02:00.0 eth0: Intel(R) PRO/1000 Network Connection
565:[    2.561570] e1000 0000:02:03.0 eth1: (PCI:66MHz:32-bit) 00:0c:29:9c:f8:df
566:[    2.561575] e1000 0000:02:03.0 eth1: Intel(R) PRO/1000 Network Connection
567:[    2.568309] systemd-udevd[238]: renamed network interface eth1 to enp2s3
568:[    2.578203] systemd-udevd[240]: renamed network interface eth0 to enp2s0


4、更改網卡的名字 -  由enp2s0改為eth0

[[email protected] ~]# cat /etc/default/grub
GRUB_TIMEOUT=5
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="rd.lvm.lv=centos/root rd.lvm.lv=centos/swap crashkernel=auto rhgb quiet"
GRUB_DISABLE_RECOVERY="true"

修改grub中的GRUB_CMDLINE_LINUX,追加語句"net.ifnames=0 biosdevname=0“。
然後執行# grub2-mkconfig -o /boot/grub2/grub.cfg


5、重啟網路服務。
servie network restart


6、centOS7 mini版無ifconfig等工具,在系統串連外網暢通情況下,root執行以下命令,安裝ifconfig工具,如下:
#yum install -y net-tools\*


7、亂碼問題

export LANG=zh_CN.GBK



本文出自 “技術樂園” 部落格,請務必保留此出處http://zhonglaif.blog.51cto.com/10487639/1676111

關於 CentOS 7 網路設定

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.