1. 程式人生 > >Centos6/7 網絡卡配置 以及踩坑例項

Centos6/7 網絡卡配置 以及踩坑例項

網絡卡配置:

vi /etc/sysconfig/network

vi /etc/sysconfig/network-scripts/ifcfg-eth0  (centos7是ifcfg-xxxx)

vi /etc/resolv.conf
DEVICE="ens33"

BOOTPROTO=none

BROADCAST=192.168.0.1

GATEWAY=192.168.0.1

IPADDR=192.168.0.166

NETMASK=255.255.255.0

NM_CONTROLLED="yes"

ONBOOT="yes"

TYPE="Ethernet"

HWADDR=00:0C:29:89:7D:BD

PREFIX=23

DNS1=192.168.0.1

DNS2=114.114.144

DEFROUTE=yes

IPV4_FAILURE_FATAL=yes

IPV6INIT=no

NAME="ens33"

LAST_CONNECT=1422865170

 

centos7.0 沒有netstat 和 ifconfig命令問題

執行 

yum install net-tools

  就OK了

 

centos7重啟網絡卡報Job for network.service failed because the control process exited with error code 錯誤

[[email protected] hadoop]# systemctl restart network

Job for network.service failed because the control process exited with error code. See "systemctl status network.service" and "journalctl -xe" for details.

[[email protected] hadoop]# journalctl -xe

10月 26 17:15:57 mina0 network[3308]: 正在開啟環回介面: [  確定  ]

10月 26 17:15:57 mina0 NetworkManager[679]: <info>  [1509009357.3386] audit: op="connec

10月 26 17:15:57 mina0 network[3308]: 正在開啟介面 ens33: 錯誤:啟用連線失敗:No suita

10月 26 17:15:57 mina0 network[3308]: [失敗]

10月 26 17:15:57 mina0 network[3308]: RTNETLINK answers: File exists

10月 26 17:15:57 mina0 network[3308]: RTNETLINK answers: File exists

10月 26 17:15:57 mina0 network[3308]: RTNETLINK answers: File exists

10月 26 17:15:57 mina0 network[3308]: RTNETLINK answers: File exists

10月 26 17:15:57 mina0 network[3308]: RTNETLINK answers: File exists

10月 26 17:15:57 mina0 network[3308]: RTNETLINK answers: File exists

10月 26 17:15:57 mina0 network[3308]: RTNETLINK answers: File exists

10月 26 17:15:57 mina0 network[3308]: RTNETLINK answers: File exists

10月 26 17:15:57 mina0 network[3308]: RTNETLINK answers: File exists

10月 26 17:15:57 mina0 polkitd[680]: Unregistered Authentication Agent for unix-process

10月 26 17:15:57 mina0 systemd[1]: network.service: control process exited, code=exited

10月 26 17:15:57 mina0 systemd[1]: Failed to start LSB: Bring up/down networking.

-- Subject: Unit network.service has failed

-- Defined-By: systemd

-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel

-- 

-- Unit network.service has failed.

-- 

-- The result is failed.

10月 26 17:15:57 mina0 systemd[1]: Unit network.service entered failed state.

10月 26 17:15:57 mina0 systemd[1]: network.service failed.

 

解決:

# systemctl stop NetworkManager

# systemctl disable NetworkManager

 

然後:重啟網絡卡:

# systemctl restart network

# ifconfig