CentOS6上配置靜態IP位址 DNS等

2021-07-03 14:36:01 字數 1707 閱讀 1659

問題

預設情況下,centos 6安裝沒有網路接入相關配置,需要你對網路介面進行配置。

解決方案

介面相關配置儲存在/etc/sysconfig/network-scripts目錄下,下面顯示的是預設的介面配置。

[root@centos65 network-scripts]# more /etc/sysconfig/network-scripts/ifcfg-eth0   

device=eth0

hwaddr=00:0c:29:c1:48:03

type=ethernet

uuid=b2bbb718-caa6-46c3-ae12-587cbedfd5fa

onboot=no

nm_controlled=yes

bootproto=dhcp

# vi /etc/sysconfig/network-scripts/ifcfg-eth0  

device=eth0

type=ethernet

uuid=ba6db3a7-4921-414a-ad19-32f1ba035c03

onboot=yes

nm_controlled=yes

bootproto=none

ipaddr=192.168.200.122

prefix=24

gateway=192.168.200.1

dns1=192.168.200.13

dns2=192.168.200.14

domain=wlyd.local

defroute=yes

ipv4_failure_fatal=yes

ipv6init=no

# vi /etc/sysconfig/network  

networking=yes

gateway=192.168.200.1

[root@centos65 network-scripts]# /etc/rc.d/init.d/network restart  

shutting down inte***ce eth0: [ ok ]

shutting down loopback inte***ce: [ ok ]

bringing up loopback inte***ce: [ ok ]

bringing up inte***ce eth0: determining if ip address 192.168

.200

.122

is already in use for device eth0...

[ ok ]

# vi /etc/resolv.conf  

nameserver x

.x.x

.x# replace with your nameserver ip

nameserver y

.y.y

.y# replace with your nameserver ip

檢視介面配置

使用」ip a」或ifconfig命令可以檢視當前介面配置資訊

參考資料

1. centos:inte***ce configuration files

centOS6配置靜態IP

vim etc sysconfig network scripts ifcfg eth0 device eth0 bootproto static hwaddr 00 0c 29 c5 9d 1e ipv6init yes nm controlled yes onboot yes type ethe...

CentOS6靜態IP配置

在新裝系統後,需配置靜態ip 1 使用dhcp獲取ip 檢視當前是否聯網 ifconfig 取得當前ip,以及子網掩碼 netstat rn 獲取閘道器位址 以0.0.0.0開頭的行為預設閘道器位址 禁用dhcp和ipv6 service networkmanager stop service ip...

CentOS6配置靜態IP

centos6配置靜態ip 1.編輯網絡卡配置 vi etc sysconfig network scripts ifcfg eth0 device eth0 hwaddr 不需要改 type ethernet uuid 不需要改 onboot yes nm controlled yes bootp...