基於RHEL8/CentOS8的網絡基礎配置

  在rhel7上,同時支持network.service和NetworkManager.service(簡稱NM)。默認狀況下,這2個服務都有開啓,但許多人都會將NM禁用掉。而在rhel8上,已廢棄network.service,所以只能經過NM進行網絡配置,包括動態ip和靜態ip。換言之,在rhel8上,必須開啓NM,不然沒法使用網絡。至於什麼是NM?這裏就不詳述,對於NM的經常使用命令附以下:ios

# 查看ip(相似於ifconfig、ip addr)
nmcli

# 建立connection,配置靜態ip(等同於配置ifcfg,其中BOOTPROTO=none,並ifup啓動)
nmcli c add type ethernet con-name ethX ifname ethX ipv4.addr 192.168.1.100/24 ipv4.gateway 192.168.1.1 ipv4.method manual

# 建立connection,配置動態ip(等同於配置ifcfg,其中BOOTPROTO=dhcp,並ifup啓動)
nmcli c add type ethernet con-name ethX ifname ethX ipv4.method auto

# 修改ip(非交互式)
nmcli c modify ethX ipv4.addr '192.168.1.200/24'
nmcli c up ethX

# 修改ip(交互式)
nmcli c edit ethX
nmcli> goto ipv4.addresses
nmcli ipv4.addresses> change
Edit 'addresses' value: 192.168.1.200/24
Do you also want to set 'ipv4.method' to 'manual'? [yes]: yes
nmcli ipv4> save
nmcli ipv4> activate
nmcli ipv4> quit

# 啓用connection(至關於ifup)
nmcli c up ethX

# 中止connection(至關於ifdown)
nmcli c down

# 刪除connection(相似於ifdown並刪除ifcfg)
nmcli c delete ethX

# 查看connection列表
nmcli c show

# 查看connection詳細信息
nmcli c show ethX

# 重載全部ifcfg或route到connection(不會當即生效)
nmcli c reload

# 重載指定ifcfg或route到connection(不會當即生效)
nmcli c load /etc/sysconfig/network-scripts/ifcfg-ethX
nmcli c load /etc/sysconfig/network-scripts/route-ethX

# 當即生效connection,有3種方法
nmcli c up ethX
nmcli d reapply ethX
nmcli d connect ethX

# 查看device列表
nmcli d

# 查看全部device詳細信息
nmcli d show

# 查看指定device的詳細信息
nmcli d show ethX

# 激活網卡
nmcli d connect ethX

# 關閉無線網絡(NM默認啓用無線網絡)
nmcli r all off

# 查看NM納管狀態
nmcli n

# 開啓NM納管
nmcli n on

# 關閉NM納管(謹慎執行)
nmcli n off

# 監聽事件
nmcli m

# 查看NM自己狀態
nmcli

# 檢測NM是否在線可用
nm-online

 

1、固定IP的修改

  一、因爲這裏硬件資源有限,僅以VM的方式進行演示。首先,你要擁有一臺已經安裝好的CentOS8虛擬機系統,同時,在安裝的過程當中設置了網絡鏈接狀態開啓。登陸系統後,切換root用戶,由於普通用戶在網絡鏈接設置或者配置文件vi修改方面,權限存在弱容忍現象。這時候切換到「/etc/sysconfig/network-scripts」路徑下:web

cd /etc/sysconfig/network-scripts

  

  二、咱們先看一下,剛開始時候系統動態獲取的IP地址:centos

[root@localhost network-scripts]# ifconfig
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.201  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 fe80::5f41:9d04:e548:874a  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:c4:36:8d  txqueuelen 1000  (Ethernet)
        RX packets 30433  bytes 2139129 (2.0 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 41776  bytes 33082603 (31.5 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 331  bytes 36750 (35.8 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 331  bytes 36750 (35.8 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

virbr0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether 52:54:00:a5:84:87  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
返回信息

  

 ** 三、這裏還要進行多餘的一步,就是進行ifcfg-ens33文件的備份,便於往後的恢復操做:網絡

[root@localhost network-scripts]# cp ifcfg-ens33 ifcfg-ens33.bak
[root@localhost network-scripts]# ll
總用量 4
-rw-r--r--. 1 root root 280 9月  29 19:21 ifcfg-ens33
[root@localhost network-scripts]# cp ifcfg-ens33 ifcfg-ens33.bak
[root@localhost network-scripts]# ll
總用量 8
-rw-r--r--. 1 root root 280 9月  29 19:21 ifcfg-ens33
-rw-r--r--. 1 root root 280 9月  29 19:27 ifcfg-ens33.bak
操做過程

 

  四、使用vi編輯 ifcfg-ens33 文件,將 「 BOOTPROTO=dhcp 」修改成「 BOOTPROTO=static 」 ,其它先沒必要修改,保存並退出。下面是我修改後的樣子:app

[root@localhost network-scripts]# more ifcfg-ens33
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens33
UUID=0b897d67-bab3-4354-99cb-0cb3678a7036
DEVICE=ens33
ONBOOT=yes
查看修改後內容

 

     五、 利用附加輸出重定向原理,對ifcfg-ens33文件追加以下內容:(也能夠在上一步中,直接追加!  這裏爲了再練習一下今天學習的內容!ssh

    輸入命令: socket

[root@localhost network-scripts]# cat >>ifcfg-ens33

            輸入以下追加內容,並按「 Ctrl + D 」,結束並完成內容的輸入:ide

IPADDR=192.168.1.100
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
DNS1=223.5.5.5
PREFIX=24
[root@localhost network-scripts]# cat >>ifcfg-ens33
IPADDR=192.168.1.100
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
DNS1=223.5.5.5
PREFIX=24
[root@localhost network-scripts]# cat ifcfg-ens33
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens33
UUID=0b897d67-bab3-4354-99cb-0cb3678a7036
DEVICE=ens33
ONBOOT=yes
IPADDR=192.168.1.100
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
DNS1=223.5.5.5
PREFIX=24
操做過程

 

  六、對修改的內容進行NM加載,以下:oop

[root@localhost network-scripts]# nmcli c reload




[root@localhost network-scripts]# ifconfig
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.201  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 fe80::5f41:9d04:e548:874a  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:c4:36:8d  txqueuelen 1000  (Ethernet)
        RX packets 31416  bytes 2236251 (2.1 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 42243  bytes 33136317 (31.6 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 331  bytes 36750 (35.8 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 331  bytes 36750 (35.8 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

virbr0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether 52:54:00:a5:84:87  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0







[root@localhost network-scripts]# nmcli c down ens33
[root@localhost network-scripts]# nmcli c up ens33




[root@localhost network-scripts]# ifconfig
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.100  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 fe80::5f41:9d04:e548:874a  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:c4:36:8d  txqueuelen 1000  (Ethernet)
        RX packets 32245  bytes 2427805 (2.3 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 42474  bytes 33182687 (31.6 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 359  bytes 39566 (38.6 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 359  bytes 39566 (38.6 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

virbr0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether 52:54:00:a5:84:87  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

    注意:在進行完nmcli c down ens33 和nmcli c up ens33 ,即網卡重啓操做,須要等待兩分鐘,若是期間使用Windows的cmd進行登陸會出現「Connection reset by 192.168.1.100 port 22」現象。出現這種現象沒必要慌張,繼續等待一分鐘便可。具體以下:學習

[root@localhost network-scripts]# nmcli c down ens33
Connection reset by 192.168.1.201 port 22

C:\Users\Raodi>ssh 192.168.1.100
Connection reset by 192.168.1.100 port 22

C:\Users\Raodi>ssh 192.168.1.100
ssh_exchange_identification: read: Connection reset

C:\Users\Raodi>ssh 192.168.1.100
The authenticity of host '192.168.1.100 (192.168.1.100)' can't be established.
ECDSA key fingerprint is SHA256:DW5Z0SLNckIiIIqJNorcH2mo8VrIFu1tCXbHrhTSMTk.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.1.100' (ECDSA) to the list of known hosts.
raodi@192.168.1.100's password:
Activate the web console with: systemctl enable --now cockpit.socket

Last login: Sun Sep 29 18:59:20 2019 from 192.168.1.108
Activate the web console with: systemctl enable --now cockpit.socket

Last login: Sun Sep 29 18:59:20 2019 from 192.168.1.108
[raodi@localhost ~]$
外設登陸意外和重登成功

 

 

糟糕:

 我等了兩分鐘,剛開始還能ping通www.baidu.com  ,可第三分鐘以後,不論是系統內部終端仍是Windows的cmd都報錯了,以下:

[root@localhost network-scripts]# ping www.baidu.com
PING www.a.shifen.com (183.232.231.174) 56(84) bytes of data.
64 bytes from 183.232.231.174 (183.232.231.174): icmp_seq=1 ttl=55 time=25.8 ms
64 bytes from 183.232.231.174 (183.232.231.174): icmp_seq=2 ttl=55 time=15.3 ms
64 bytes from 183.232.231.174 (183.232.231.174): icmp_seq=3 ttl=55 time=16.3 ms
64 bytes from 183.232.231.174 (183.232.231.174): icmp_seq=4 ttl=55 time=15.6 ms
^C
--- www.a.shifen.com ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 7ms
rtt min/avg/max/mdev = 15.313/18.252/25.779/4.362 ms
[root@localhost network-scripts]# ping www.baidu.com
ping: www.baidu.com: 未知的名稱或服務
[root@localhost network-scripts]# ping www.baidu.com
ping: www.baidu.com: 未知的名稱或服務
[root@localhost network-scripts]# ping www.baidu.com
ping: www.baidu.com: 未知的名稱或服務











C:\Users\Raodi>ssh 192.168.1.100
ssh_exchange_identification: read: Connection reset

C:\Users\Raodi>ssh 192.168.1.100
write: Connection reset

C:\Users\Raodi>ssh 192.168.1.100
ssh_exchange_identification: read: Connection reset

C:\Users\Raodi>ssh 192.168.1.100
write: Connection reset

C:\Users\Raodi>ssh 192.168.1.100
ssh_exchange_identification: read: Connection reset

C:\Users\Raodi>ssh 192.168.1.100
write: Connection reset

C:\Users\Raodi>ssh 192.168.1.100
ssh_exchange_identification: read: Connection reset
失敗配置的惡性現象

配置靜態ip的要求:

  • 在局域網或者片網區域內,存在已有IP終端的IP不能使用!
  • 各自的DNS有所區別。看似DNS均可以使用,如「114.114.114.114」或者「223.5.5.5」。可是,這裏不建議使用通配的方法,若是你的虛擬系統是直接橋接無線路由器的,DNS一般使用「192.168.1.1」 ,不具實地的DNS配置,極可能會拖慢咱們主機與外網的互相通信能力!

  (正由於,我上述的配置過程和配置內容,均違反了配置要求條件,因此出現這種現象也不足爲怪了)

 

 

 

2、修改網卡名

  有時候,咱們甚至一度習慣於eth0,而對於ens33很難作到情有獨鍾,看到都表示難以接受。修改前的ifconfig返回信息:

[root@localhost network-scripts]# ifconfig
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.230  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 fe80::5f41:9d04:e548:874a  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:c4:36:8d  txqueuelen 1000  (Ethernet)
        RX packets 37056  bytes 3463136 (3.3 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 44001  bytes 33507729 (31.9 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 415  bytes 45198 (44.1 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 415  bytes 45198 (44.1 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

virbr0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether 52:54:00:a5:84:87  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
修改前ifconfig返回信息

 

  咱們這裏將ens33改回eth0的網卡設備類型,以下:

  一、首先,將ifcfg-ens33備份出一個ifcfg-eth0文件

[root@localhost network-scripts]# ll
總用量 8
-rw-r--r--. 1 root root 372 9月  29 20:12 ifcfg-ens33
-rw-r--r--. 1 root root 280 9月  29 19:27 ifcfg-ens33.bak
[root@localhost network-scripts]# cp ifcfg-ens33 ifcfg-eth0
[root@localhost network-scripts]# ll
總用量 12
-rw-r--r--. 1 root root 372 9月  29 20:12 ifcfg-ens33
-rw-r--r--. 1 root root 280 9月  29 19:27 ifcfg-ens33.bak
-rw-r--r--. 1 root root 372 9月  29 20:48 ifcfg-eth0
操做過程

 

  二、修改ifcfg-eth0文件中的「 NAME=ens33 」 和「 DEVICE=ens33 」,變成「  NAME=eth0 」和「 DEVICE=eth0 」。具體修改信息以下:

[root@localhost network-scripts]# cat ifcfg-eth0
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=eth0
UUID=0b897d67-bab3-4354-99cb-0cb3678a7036
DEVICE=eth0
ONBOOT=yes
IPADDR=192.168.1.250
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
DNS1=192.168.1.1
PREFIX=24
修改後的ifcfg-eth0文件內容

 

  三、禁用可預測命名空間屬性。能夠在啓動時傳遞「net.ifnames=0 biosdevname=0 」的內核參數。這是經過編輯/etc/default/grub並加入「net.ifnames=0 biosdevname=0 」到GRUBCMDLINELINUX變量來實現的。

[root@localhost network-scripts]# vi /etc/default/grub

依據如圖方式,進行修改:

 

  四、更新內核參數。從新生成GRUB配置並更新內核參數。

[root@localhost network-scripts]# grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file ...
done

 

  五、重啓系統。進行系統內核參數的加載。

[root@localhost network-scripts]# reboot
Connection to 192.168.1.230 closed by remote host.
Connection to 192.168.1.230 closed.

 

  六、驗證修改完成。開機後,從新登陸系統,我使用cmd登陸也沒有問題。

[raodi@localhost ~]$ ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.250  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 fe80::36f1:291f:dbae:d020  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:c4:36:8d  txqueuelen 1000  (Ethernet)
        RX packets 15  bytes 1264 (1.2 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 45  bytes 4998 (4.8 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 48  bytes 5616 (5.4 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 48  bytes 5616 (5.4 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

virbr0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 192.168.122.1  netmask 255.255.255.0  broadcast 192.168.122.255
        ether 52:54:00:a5:84:87  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

[raodi@localhost ~]$ ping www.baidu.com
PING www.a.shifen.com (183.232.231.172) 56(84) bytes of data.
64 bytes from 183.232.231.172 (183.232.231.172): icmp_seq=1 ttl=55 time=15.4 ms
64 bytes from 183.232.231.172 (183.232.231.172): icmp_seq=2 ttl=55 time=15.9 ms
^C
--- www.a.shifen.com ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 3ms
rtt min/avg/max/mdev = 15.436/15.677/15.918/0.241 ms
[raodi@localhost ~]$ 
主機終端
C:\Users\Raodi>ssh 192.168.1.250
The authenticity of host '192.168.1.250 (192.168.1.250)' can't be established.
ECDSA key fingerprint is SHA256:DW5Z0SLNckIiIIqJNorcH2mo8VrIFu1tCXbHrhTSMTk.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.1.250' (ECDSA) to the list of known hosts.
raodi@192.168.1.250's password:
Activate the web console with: systemctl enable --now cockpit.socket

Last login: Sun Sep 29 21:07:38 2019
[raodi@localhost ~]$ ll
總用量 0
drwxr-xr-x. 2 raodi raodi 6 9月  27 13:44 公共
drwxr-xr-x. 2 raodi raodi 6 9月  27 13:44 模板
drwxr-xr-x. 2 raodi raodi 6 9月  27 13:44 視頻
drwxr-xr-x. 2 raodi raodi 6 9月  27 13:44 圖片
drwxr-xr-x. 2 raodi raodi 6 9月  27 13:44 文檔
drwxr-xr-x. 2 raodi raodi 6 9月  27 13:44 下載
drwxr-xr-x. 2 raodi raodi 6 9月  27 13:44 音樂
drwxr-xr-x. 2 raodi raodi 6 9月  27 13:44 桌面
[raodi@localhost ~]$ ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.250  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 fe80::36f1:291f:dbae:d020  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:c4:36:8d  txqueuelen 1000  (Ethernet)
        RX packets 119  bytes 12048 (11.7 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 89  bytes 11411 (11.1 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 48  bytes 5616 (5.4 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 48  bytes 5616 (5.4 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

virbr0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 192.168.122.1  netmask 255.255.255.0  broadcast 192.168.122.255
        ether 52:54:00:a5:84:87  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

[raodi@localhost ~]$ ping www.baidu.com
PING www.a.shifen.com (183.232.231.174) 56(84) bytes of data.
64 bytes from 183.232.231.174 (183.232.231.174): icmp_seq=1 ttl=55 time=15.5 ms
64 bytes from 183.232.231.174 (183.232.231.174): icmp_seq=2 ttl=55 time=15.2 ms
^C
--- www.a.shifen.com ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 3ms
rtt min/avg/max/mdev = 15.198/15.373/15.549/0.214 ms
[raodi@localhost ~]$
cmd鏈接

 

 

3、70-persistent-ipoib.rules文件規則

[raodi@localhost rules.d]$ vi /etc/udev/rules.d/70-persistent-ipoib.rules

 

 

 

  雖然,直接將NAME="mlx4_ib3"修改爲NAME="eth0" 也能達到第二章中的效果(修改網卡名),可是不推薦在此文件中修改!由於此文件在centos6.4時通常應用於:解決克隆主機MAC地址衝突的現象。在解決克隆主機MAC地址衝突時,記得字母大寫小寫的區別!

相關文章
相關標籤/搜索