溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

RHEL7中如何添加自定義網(wǎng)卡并更改網(wǎng)卡接口

發(fā)布時間:2022-02-18 14:07:02 來源:億速云 閱讀:138 作者:小新 欄目:開發(fā)技術(shù)

這篇文章給大家分享的是有關(guān)RHEL7中如何添加自定義網(wǎng)卡并更改網(wǎng)卡接口的內(nèi)容。小編覺得挺實用的,因此分享給大家做個參考,一起跟隨小編過來看看吧。


環(huán)境

VMware Workstation Pro Red Hat Enterprise Linux Server release 7.3

查看當(dāng)前網(wǎng)卡信息

[root@Jaking ~]# cat /etc/redhat-releaseRed Hat Enterprise Linux Server release 7.3 (Maipo)
[root@Jaking ~]# ifconfigens33: flags=4163  mtu 1500
       inet 192.168.10.11  netmask 255.255.255.0  broadcast 192.168.10.255
       inet6 fe80::250:56ff:fe2b:88bf  prefixlen 64  scopeid 0x20
       ether 00:50:56:2b:88:bf  txqueuelen 1000  (Ethernet)
       RX packets 454  bytes 44638 (43.5 KiB)
       RX errors 0  dropped 0  overruns 0  frame 0
       TX packets 339  bytes 33150 (32.3 KiB)
       TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73  mtu 65536
       inet 127.0.0.1  netmask 255.0.0.0
       inet6 ::1  prefixlen 128  scopeid 0x10
       loop  txqueuelen 1  (Local Loopback)
       RX packets 112  bytes 9492 (9.2 KiB)
       RX errors 0  dropped 0  overruns 0  frame 0
       TX packets 112  bytes 9492 (9.2 KiB)
       TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

添加網(wǎng)卡

RHEL7中如何添加自定義網(wǎng)卡并更改網(wǎng)卡接口
RHEL7中如何添加自定義網(wǎng)卡并更改網(wǎng)卡接口
RHEL7中如何添加自定義網(wǎng)卡并更改網(wǎng)卡接口

取消紅框內(nèi)的鉤

RHEL7中如何添加自定義網(wǎng)卡并更改網(wǎng)卡接口
RHEL7中如何添加自定義網(wǎng)卡并更改網(wǎng)卡接口
RHEL7中如何添加自定義網(wǎng)卡并更改網(wǎng)卡接口
RHEL7中如何添加自定義網(wǎng)卡并更改網(wǎng)卡接口
RHEL7中如何添加自定義網(wǎng)卡并更改網(wǎng)卡接口

查看網(wǎng)卡信息

[root@Jaking ~]# ifconfigens33: flags=4163  mtu 1500
       inet 192.168.10.11  netmask 255.255.255.0  broadcast 192.168.10.255
       inet6 fe80::250:56ff:fe2b:88bf  prefixlen 64  scopeid 0x20
       ether 00:50:56:2b:88:bf  txqueuelen 1000  (Ethernet)
       RX packets 488  bytes 47935 (46.8 KiB)
       RX errors 0  dropped 0  overruns 0  frame 0
       TX packets 356  bytes 35698 (34.8 KiB)
       TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

ens38: flags=4163  mtu 1500
       ether 00:0c:29:46:f9:b8  txqueuelen 1000  (Ethernet)
       RX packets 5  bytes 594 (594.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

lo: flags=73  mtu 65536
       inet 127.0.0.1  netmask 255.0.0.0
       inet6 ::1  prefixlen 128  scopeid 0x10
       loop  txqueuelen 1  (Local Loopback)
       RX packets 112  bytes 9492 (9.2 KiB)
       RX errors 0  dropped 0  overruns 0  frame 0
       TX packets 112  bytes 9492 (9.2 KiB)
       TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

配置網(wǎng)卡并更改網(wǎng)卡接口

[root@Jaking ~]# cd /etc/sysconfig/network-scripts/[root@Jaking network-scripts]# lsifcfg-ens33  ifdown-ipv6    ifdown-TeamPort  ifup-ippp   ifup-routes       network-functions
ifcfg-lo     ifdown-isdn    ifdown-tunnel    ifup-ipv6   ifup-sit          network-functions-ipv6
ifdown       ifdown-post    ifup             ifup-isdn   ifup-Team
ifdown-bnep  ifdown-ppp     ifup-aliases     ifup-plip   ifup-TeamPort
ifdown-eth   ifdown-routes  ifup-bnep        ifup-plusb  ifup-tunnel
ifdown-ib    ifdown-sit     ifup-eth         ifup-post   ifup-wireless
ifdown-ippp  ifdown-Team    ifup-ib          ifup-ppp    init.ipv6-global

添加網(wǎng)卡后,需要創(chuàng)建對應(yīng)的網(wǎng)卡配置文件

[root@Jaking network-scripts]# cp ifcfg-ens33 ifcfg-ens34[root@Jaking network-scripts]# vim ifcfg-ens34          TYPE=Ethernet
BOOTPROTO=static
DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
IPV4_FAILURE_FATAL=no
NAME=ens34
DEVICE=ens34
ONBOOT=yes
IPADDR=172.16.100.100
NETMASK=255.255.255.0

禁用ens38接口

[root@Jaking network-scripts]# ip link set ens38 down  [root@Jaking network-scripts]# ifconfigens33: flags=4163  mtu 1500
       inet 192.168.10.11  netmask 255.255.255.0  broadcast 192.168.10.255
       inet6 fe80::250:56ff:fe2b:88bf  prefixlen 64  scopeid 0x20
       ether 00:50:56:2b:88:bf  txqueuelen 1000  (Ethernet)
       RX packets 812  bytes 74791 (73.0 KiB)
       RX errors 0  dropped 0  overruns 0  frame 0
       TX packets 537  bytes 61780 (60.3 KiB)
       TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73  mtu 65536
       inet 127.0.0.1  netmask 255.0.0.0
       inet6 ::1  prefixlen 128  scopeid 0x10
       loop  txqueuelen 1  (Local Loopback)
       RX packets 112  bytes 9492 (9.2 KiB)
       RX errors 0  dropped 0  overruns 0  frame 0
       TX packets 112  bytes 9492 (9.2 KiB)
       TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

重命名ens38接口為ens34

[root@Jaking network-scripts]# ip link set ens38 name ens34

啟用修改完成的ens34接口

[root@Jaking network-scripts]# ip link set ens34 up                     
[root@Jaking network-scripts]# systemctl restart network[root@Jaking network-scripts]# ifconfig                ens33: flags=4163  mtu 1500
       inet 192.168.10.11  netmask 255.255.255.0  broadcast 192.168.10.255
       inet6 fe80::250:56ff:fe2b:88bf  prefixlen 64  scopeid 0x20
       ether 00:50:56:2b:88:bf  txqueuelen 1000  (Ethernet)
       RX packets 1389  bytes 123239 (120.3 KiB)
       RX errors 0  dropped 0  overruns 0  frame 0
       TX packets 913  bytes 117924 (115.1 KiB)
       TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

ens34: flags=4163  mtu 1500
       inet 172.16.100.100  netmask 255.255.255.0  broadcast 192.168.100.255
       ether 00:0c:29:46:f9:b8  txqueuelen 1000  (Ethernet)
       RX packets 5  bytes 594 (594.0 B)
       RX errors 0  dropped 0  overruns 0  frame 0
       TX packets 2  bytes 120 (120.0 B)
       TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73  mtu 65536
       inet 127.0.0.1  netmask 255.0.0.0
       inet6 ::1  prefixlen 128  scopeid 0x10
       loop  txqueuelen 1  (Local Loopback)
       RX packets 148  bytes 12552 (12.2 KiB)
       RX errors 0  dropped 0  overruns 0  frame 0
       TX packets 148  bytes 12552 (12.2 KiB)
       TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0


感謝各位的閱讀!關(guān)于“RHEL7中如何添加自定義網(wǎng)卡并更改網(wǎng)卡接口”這篇文章就分享到這里了,希望以上內(nèi)容可以對大家有一定的幫助,讓大家可以學(xué)到更多知識,如果覺得文章不錯,可以把它分享出去讓更多的人看到吧!

向AI問一下細節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI