CentOS網路配置

2021-08-29 03:03:29 字數 851 閱讀 9195

ping本機位址檢視網口有無故障

ifconfig檢視現有網口名稱,可能是eth0或ens33

vim /etc/sysconfig/network-scripts/ifcfg-eth0,檔名應根據現有網口名稱,如為ens33需重新命名為ifcfg-ens33(這點很重要)再進行編輯

type=ethernet 

bootproto=static

defroute=yes

ipv4_failure_fatal=no

ipv6init=yes

ipv6_autoconf=yes

ipv6_defroute=yes

ipv6_failure_fatal=no

name=

uuid=

device=

onboot=yes

peerdns=yes

peerroutes=yes

ipv6_peerdns=yes

ipv6_peerroutes=yes

ipaddr=(ip位址)

netmask=255.255.255.0(子網掩碼)

gateway=(閘道器)

bootproto、ipaddr、netmask、gateway項需要按實際情況配置,其它yes或no同上

修改dns配置,vim /etc/resolv.conf

新增nameserver 114.114.114.114重啟網絡卡service network restart如還有問題重啟主機(虛擬機器)

centos 網路配置

一 centos 修改ip位址 修改對應網絡卡的ip位址的配置檔案 vi etc sysconfig network scripts ifcfg eth0 device eth0 hwaddr 44 33 4c 00 18 98 type ethernet uuid 5d40d966 3bf9 4b...

CentOS配置網路

1 配置ip vim etc sysconfig network scripts ifcfg eth0 檔案不存在就建立乙個,名字為 ifcfg 具體網絡卡的命名 可以用ifconfig命令檢視,左邊顯示的就是 device eth0 物理裝置名 ipaddr 192.168.1.100 ip位址 ...

centos網路配置

修改ip位址 1 使用setup命令 使用setup命令進入圖形介面,根據提示進入network configuration,edit device,根據提示進行ip設定 2 直接編輯檔案進行修改 vi etc sysconfig network scripts ifcfg eth0 此處的ifcf...