centos 網絡卡配置

2022-04-29 17:03:07 字數 1981 閱讀 1122

1.檢視網路mac位址

[root@centos ~]# cat /etc/udev/rules.d/70-persistent-net.rules

顯示如下資訊

# pci device 0x15ad:0x07b0 (vmxnet3)

subsystem=="net", action=="add", drivers=="?*", attr=="00:50:56:94:04:3c", attr=="1", kernel=="eth*", name="eth0"

# pci device 0x15ad:0x07b0 (vmxnet3)

subsystem=="net", action=="add", drivers=="?*", attr=="00:50:56:94:53:24", attr=="1", kernel=="eth*", name="eth1"

eth0:對應第一張網絡卡,eth1:對就第二張網絡卡。當前使用eth0連線路由器,eth1保留(伺服器一般用來,連線其它主機)

2.修改主機名稱

[root@centos ~]# vim /etc/sysconfig/network

開啟檔案,修改以下內容並儲存

networking=yes      #使用網路

hostname=centos      #設定主機名稱

3.修改網絡卡

[root@centos ~]# vim /etc/sysconfig/network-scripts/ifcfg-eth0

開啟檔案,修改以下內容並儲存

device=eth0          #對應第一張網絡卡

type=ethernet

onboot=yes          #是否啟動時執行

nm_controlled=yes

bootproto=static       #使用靜態ip,而不是由dhcp分配ip

defroute=yes

ipv4_failure_fatal=yes

ipv6init=no

name="system eth0"      #名稱

hwaddr=00:50:56:94:04:3c  #必須對應etho是的mac位址(/etc/udev/rules.d/70-persistent-net.rules)

peerdns=yes

peerroutes=yes

ipaddr=192.168.2.249     #指定本機ip位址

netmask=255.255.255.0    #指定子網掩碼

gateway=192.168.2.1     #指定閘道器

4.修改dns

[root@centos ~]# vim /etc/resolv.conf

開啟檔案,修改以下內容並儲存

nameserver 8.8.8.8      #google的dns伺服器

nameserver 61.144.56.100 #指定當前城市最近的dns伺服器(各城市不一樣,上網搜尋)

nameserver 192.168.2.1   #指定經路由器上指定的dns伺服器

5.重新啟動網路配置

[root@centos ~]#service network restart

6.重啟

[root@centos ~]#shutdown -r now

7.檢視當前ip設定

[root@centos ~]# ifconfig

8.測試是否連線外網

注意:各位正在配置的同學們 千萬不要把字母寫錯了  ipaddr 不要寫成ipadr gateway 千萬不要少個w 樓主就是這麼錯的 哎...

Centos網絡卡配置

安裝完成後,在esxi下,如果網絡卡型別為虛擬,則centos5.5無法使用網絡卡。解決方法 1 新增網絡卡,e1000。2 ifconfig a,檢視網絡卡資訊。3 重啟網路服務,restart network service。4 修改 etc sysconfig network scripts ...

CentOs 配置網絡卡

首先檢視網絡卡裝置ifconfig a 看下有幾塊網絡卡裝置根據網絡卡裝置名稱在 etc sysconfig network script裡建立相對應的檔案 如 我的網絡卡是eth0則建立ifcfg eth0 vi etc sysconfig network script ifcfg eth0 修改...

CentOS網絡卡配置

centos網絡卡配置原始檔如下 device eth0 hwaddr 00 0c 29 a8 67 46 type ethernet uuid 4103d7a8 d073 4e93 ac68 e6f8496f35f0 onboot no nm controlled yes bootproto dh...