麒麟系统修改网卡名步骤和网卡占用故障处理
<h1>第1章 单网卡环境修改网卡名</h1><p>■ 修改网卡配置。</p>
<p>• 检查当前网卡名称和MAC<span style="font-family: 宋体">地址,网卡名称</span><span style="font-family: 宋体">ens</span>33<span style="font-family: 宋体">,</span><span style="font-family: 宋体">M</span>AC地址00:0c:29:ab:3a:40。</p>
<div class="cnblogs_code">
<pre># ip a
</span><span style="color: rgba(128, 0, 128, 1)">1</span>: lo: <LOOPBACK,UP,LOWER_UP> mtu <span style="color: rgba(128, 0, 128, 1)">65536</span> qdisc noqueue state UNKNOWN group default qlen <span style="color: rgba(128, 0, 128, 1)">1000</span><span style="color: rgba(0, 0, 0, 1)">
link</span>/loopback <span style="color: rgba(128, 0, 128, 1)">00</span>:<span style="color: rgba(128, 0, 128, 1)">00</span>:<span style="color: rgba(128, 0, 128, 1)">00</span>:<span style="color: rgba(128, 0, 128, 1)">00</span>:<span style="color: rgba(128, 0, 128, 1)">00</span>:<span style="color: rgba(128, 0, 128, 1)">00</span> brd <span style="color: rgba(128, 0, 128, 1)">00</span>:<span style="color: rgba(128, 0, 128, 1)">00</span>:<span style="color: rgba(128, 0, 128, 1)">00</span>:<span style="color: rgba(128, 0, 128, 1)">00</span>:<span style="color: rgba(128, 0, 128, 1)">00</span>:<span style="color: rgba(128, 0, 128, 1)">00</span><span style="color: rgba(0, 0, 0, 1)">
inet </span><span style="color: rgba(128, 0, 128, 1)">127.0</span>.<span style="color: rgba(128, 0, 128, 1)">0.1</span>/<span style="color: rgba(128, 0, 128, 1)">8</span><span style="color: rgba(0, 0, 0, 1)"> scope host lo
valid_lft forever preferred_lft forever
inet6 ::</span><span style="color: rgba(128, 0, 128, 1)">1</span>/<span style="color: rgba(128, 0, 128, 1)">128</span><span style="color: rgba(0, 0, 0, 1)"> scope host
valid_lft forever preferred_lft forever
</span><span style="color: rgba(128, 0, 128, 1)">2</span>: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu <span style="color: rgba(128, 0, 128, 1)">1500</span> qdisc fq_codel state UP group default qlen <span style="color: rgba(128, 0, 128, 1)">1000</span><span style="color: rgba(0, 0, 0, 1)">
link</span>/ether <span style="color: rgba(128, 0, 128, 1)">00</span>:0c:<span style="color: rgba(128, 0, 128, 1)">29</span>:ab:3a:<span style="color: rgba(128, 0, 128, 1)">40</span><span style="color: rgba(0, 0, 0, 1)"> brd ff:ff:ff:ff:ff:ff
inet </span><span style="color: rgba(128, 0, 128, 1)">192.168</span>.<span style="color: rgba(128, 0, 128, 1)">1.161</span>/<span style="color: rgba(128, 0, 128, 1)">24</span> brd <span style="color: rgba(128, 0, 128, 1)">192.168</span>.<span style="color: rgba(128, 0, 128, 1)">1.255</span><span style="color: rgba(0, 0, 0, 1)"> scope global noprefixroute ens33
valid_lft forever preferred_lft forever
inet6 fe80::588d:c898:</span><span style="color: rgba(128, 0, 128, 1)">3370</span>:2cca/<span style="color: rgba(128, 0, 128, 1)">64</span><span style="color: rgba(0, 0, 0, 1)"> scope link noprefixroute
valid_lft forever preferred_lft forever</span></pre>
</div>
<p>• 修改网卡的配置文件名称。</p>
<div class="cnblogs_code">
<pre># cd /etc/sysconfig/network-scripts/<span style="color: rgba(0, 0, 0, 1)">
# <span style="color: rgba(0, 0, 255, 1)">mv</span> ifcfg-ens33 ifcfg-eth0</pre>
</div>
<p>• 修改网卡配置内容,将网卡和绑定设备名改成eth0,其他不用修改。</p>
<div class="cnblogs_code">
<pre># <span style="color: rgba(0, 0, 255, 1)">vi</span> ifcfg-<span style="color: rgba(0, 0, 0, 1)">eth0
NAME</span>=<span style="color: rgba(0, 0, 0, 1)">eth0
DEVICE</span>=<span style="color: rgba(0, 0, 0, 1)">eth0
# </pre>
</div>
<p>■ 修改BIOS参数。</p>
<p>• 更新内核文件,于"GRUB_CMDLINE_LINUX="行尾额外添加"net.ifnames=0 biosdevname=0"两条参数。</p>
<div class="cnblogs_code">
<pre># <span style="color: rgba(0, 0, 255, 1)">vi</span> /etc/default/<span style="color: rgba(0, 0, 0, 1)">grub
GRUB_CMDLINE_LINUX</span>=<span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">resume=/dev/mapper/klas-swap rd.lvm.lv=klas/root rd.lvm.lv=klas/swap rhgb quiet crashkernel=1024M,high audit=0 net.ifnames=0 biosdevname=0</span><span style="color: rgba(128, 0, 0, 1)">"</span></pre>
</div>
<p>• 检查系统引导启动方式。</p>
<div class="cnblogs_code">
<pre># ll /sys/firmware/<span style="color: rgba(0, 0, 0, 1)">efi
</span><span style="color: rgba(0, 0, 255, 1)">ls</span>: cannot access <span style="color: rgba(128, 0, 0, 1)">'</span><span style="color: rgba(128, 0, 0, 1)">/sys/firmware/efi</span><span style="color: rgba(128, 0, 0, 1)">'</span>: No such <span style="color: rgba(0, 0, 255, 1)">file</span><span style="color: rgba(0, 0, 0, 1)"> or directory
# dmesg | <span style="color: rgba(0, 0, 255, 1)">grep</span> <span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">EFI v</span><span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(0, 0, 0, 1)">
#</pre>
</div>
<p><strong>说明:</strong><span style="font-family: 宋体">一般系统有</span><span style="font-family: 宋体">U</span>EFI<span style="font-family: 宋体">和传统</span><span style="font-family: 宋体">B</span>IOS两种引导启动方式,如上述命令中,没有/sys/firmware/efi<span style="font-family: 宋体">文件,并且</span><span style="font-family: 宋体">dmesg命令没有E</span>FI<span style="font-family: 宋体">关键词输出,说明当前系统是传统</span><span style="font-family: 宋体">B</span>IOS<span style="font-family: 宋体">方式引导启动;如果有目录和关键词输出,说明是</span><span style="font-family: 宋体">U</span>EFI启动。</p>
<p>• 重新生成内核引导文件。</p>
<div class="cnblogs_code">
<pre># grub2-mkconfig -o /boot/grub2/<span style="color: rgba(0, 0, 0, 1)">grub.cfg
#执行成功输出如下:
Generating grub configuration </span><span style="color: rgba(0, 0, 255, 1)">file</span><span style="color: rgba(0, 0, 0, 1)"> ...
Found linux image: </span>/boot/vmlinuz-<span style="color: rgba(128, 0, 128, 1)">4.19</span>.<span style="color: rgba(128, 0, 128, 1)">90</span>-<span style="color: rgba(128, 0, 128, 1)">52.22</span><span style="color: rgba(0, 0, 0, 1)">.v2207.ky10.x86_64
Found initrd image: </span>/boot/initramfs-<span style="color: rgba(128, 0, 128, 1)">4.19</span>.<span style="color: rgba(128, 0, 128, 1)">90</span>-<span style="color: rgba(128, 0, 128, 1)">52.22</span><span style="color: rgba(0, 0, 0, 1)">.v2207.ky10.x86_64.img
Found linux image: </span>/boot/vmlinuz-<span style="color: rgba(128, 0, 128, 1)">0</span>-rescue-<span style="color: rgba(0, 0, 0, 1)">c30be0c3a35649f1b686342f9354e4aa
Found initrd image: </span>/boot/initramfs-<span style="color: rgba(128, 0, 128, 1)">0</span>-rescue-<span style="color: rgba(0, 0, 0, 1)">c30be0c3a35649f1b686342f9354e4aa.img
</span><span style="color: rgba(0, 0, 255, 1)">done</span><span style="color: rgba(0, 0, 0, 1)">
注意:如果系统引导启动方式是UEFI,那么不能在</span>/boot/grub2目录下生成内核引导文件,需要执行命令:“grub2-mkconfig -o /boot/efi/EFI/kylin/grub.cfg”,将内核文件生成到/boot/efi/EFI/kylin/下才能生效。</pre>
</div>
<p>■ 修改udev,配置网卡名和MAC地址绑定。</p>
<p>• 注释第一行,并手动添加一行,通过网卡MAC<span style="font-family: 宋体">地址绑定</span><span style="font-family: 宋体">eth</span>0网卡名。</p>
<div class="cnblogs_code">
<pre>• # <span style="color: rgba(0, 0, 255, 1)">vi</span> /usr/lib/udev/rules.d/<span style="color: rgba(128, 0, 128, 1)">60</span>-<span style="color: rgba(0, 0, 0, 1)">net.rules
#ACTION</span>==<span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">add</span><span style="color: rgba(128, 0, 0, 1)">"</span>, SUBSYSTEM==<span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">net</span><span style="color: rgba(128, 0, 0, 1)">"</span>, DRIVERS==<span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">?*</span><span style="color: rgba(128, 0, 0, 1)">"</span>, ATTR{type}==<span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">1</span><span style="color: rgba(128, 0, 0, 1)">"</span>, PROGRAM=<span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">/lib/udev/rename_device</span><span style="color: rgba(128, 0, 0, 1)">"</span>, RESULT==<span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">?*</span><span style="color: rgba(128, 0, 0, 1)">"</span>, NAME=<span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">$result</span><span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(0, 0, 0, 1)">
ACTION</span>==<span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">add</span><span style="color: rgba(128, 0, 0, 1)">"</span>, SUBSYSTEM==<span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">net</span><span style="color: rgba(128, 0, 0, 1)">"</span>, DRIVERS==<span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">?*</span><span style="color: rgba(128, 0, 0, 1)">"</span>, ATTR{type}==<span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">1</span><span style="color: rgba(128, 0, 0, 1)">"</span>, ATTR{address}==<span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">00:0c:29:ab:3a:40</span><span style="color: rgba(128, 0, 0, 1)">"</span>, NAME=<span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">eth0</span><span style="color: rgba(128, 0, 0, 1)">"</span></pre>
</div>
<p>■ 验证修改结果。</p>
<p>• 重启系统后配置生效。</p>
<div class="cnblogs_code">
<pre># reboot</pre>
</div>
<p>• 检查网卡,成功将网卡名修改为eth0。</p>
<div class="cnblogs_code">
<pre># ip a
</span><span style="color: rgba(128, 0, 128, 1)">1</span>: lo: <LOOPBACK,UP,LOWER_UP> mtu <span style="color: rgba(128, 0, 128, 1)">65536</span> qdisc noqueue state UNKNOWN group default qlen <span style="color: rgba(128, 0, 128, 1)">1000</span><span style="color: rgba(0, 0, 0, 1)">
link</span>/loopback <span style="color: rgba(128, 0, 128, 1)">00</span>:<span style="color: rgba(128, 0, 128, 1)">00</span>:<span style="color: rgba(128, 0, 128, 1)">00</span>:<span style="color: rgba(128, 0, 128, 1)">00</span>:<span style="color: rgba(128, 0, 128, 1)">00</span>:<span style="color: rgba(128, 0, 128, 1)">00</span> brd <span style="color: rgba(128, 0, 128, 1)">00</span>:<span style="color: rgba(128, 0, 128, 1)">00</span>:<span style="color: rgba(128, 0, 128, 1)">00</span>:<span style="color: rgba(128, 0, 128, 1)">00</span>:<span style="color: rgba(128, 0, 128, 1)">00</span>:<span style="color: rgba(128, 0, 128, 1)">00</span><span style="color: rgba(0, 0, 0, 1)">
inet </span><span style="color: rgba(128, 0, 128, 1)">127.0</span>.<span style="color: rgba(128, 0, 128, 1)">0.1</span>/<span style="color: rgba(128, 0, 128, 1)">8</span><span style="color: rgba(0, 0, 0, 1)"> scope host lo
valid_lft forever preferred_lft forever
inet6 ::</span><span style="color: rgba(128, 0, 128, 1)">1</span>/<span style="color: rgba(128, 0, 128, 1)">128</span><span style="color: rgba(0, 0, 0, 1)"> scope host
valid_lft forever preferred_lft forever
</span><span style="color: rgba(128, 0, 128, 1)">2</span>: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu <span style="color: rgba(128, 0, 128, 1)">1500</span> qdisc fq_codel state UP group default qlen <span style="color: rgba(128, 0, 128, 1)">1000</span><span style="color: rgba(0, 0, 0, 1)">
link</span>/ether <span style="color: rgba(128, 0, 128, 1)">00</span>:0c:<span style="color: rgba(128, 0, 128, 1)">29</span>:ab:3a:<span style="color: rgba(128, 0, 128, 1)">40</span><span style="color: rgba(0, 0, 0, 1)"> brd ff:ff:ff:ff:ff:ff
inet </span><span style="color: rgba(128, 0, 128, 1)">192.168</span>.<span style="color: rgba(128, 0, 128, 1)">1.161</span>/<span style="color: rgba(128, 0, 128, 1)">24</span> brd <span style="color: rgba(128, 0, 128, 1)">192.168</span>.<span style="color: rgba(128, 0, 128, 1)">1.255</span><span style="color: rgba(0, 0, 0, 1)"> scope global noprefixroute eth0
valid_lft forever preferred_lft forever
inet6 fe80::</span><span style="color: rgba(128, 0, 128, 1)">3445</span>:a251:8e9:8c84/<span style="color: rgba(128, 0, 128, 1)">64</span><span style="color: rgba(0, 0, 0, 1)"> scope link noprefixroute
valid_lft forever preferred_lft forever</span></pre>
</div>
<h1>第2章 多网卡环境修改网卡名</h1>
<p><strong>说明:</strong><span style="font-family: 宋体">多网卡修改网卡名的步骤和单网卡步骤一致,不同点是</span><span style="font-family: 宋体">udev配置文件中需要加多行参数,对所有网卡名和网卡M</span>AC地址进行绑定。</p>
<p>■ 修改网卡配置。</p>
<p>• 检查当前网卡名称和MAC<span style="font-family: 宋体">地址,当前有</span><span style="font-family: 宋体">ens</span>33<span style="font-family: 宋体">、</span><span style="font-family: 宋体">ens3</span>7<span style="font-family: 宋体">、</span><span style="font-family: 宋体">ens3</span>8<span style="font-family: 宋体">,共</span><span style="font-family: 宋体">3块网卡。</span></p>
<div class="cnblogs_code">
<pre># ip a
</span><span style="color: rgba(128, 0, 128, 1)">1</span>: lo: <LOOPBACK,UP,LOWER_UP> mtu <span style="color: rgba(128, 0, 128, 1)">65536</span> qdisc noqueue state UNKNOWN group default qlen <span style="color: rgba(128, 0, 128, 1)">1000</span><span style="color: rgba(0, 0, 0, 1)">
link</span>/loopback <span style="color: rgba(128, 0, 128, 1)">00</span>:<span style="color: rgba(128, 0, 128, 1)">00</span>:<span style="color: rgba(128, 0, 128, 1)">00</span>:<span style="color: rgba(128, 0, 128, 1)">00</span>:<span style="color: rgba(128, 0, 128, 1)">00</span>:<span style="color: rgba(128, 0, 128, 1)">00</span> brd <span style="color: rgba(128, 0, 128, 1)">00</span>:<span style="color: rgba(128, 0, 128, 1)">00</span>:<span style="color: rgba(128, 0, 128, 1)">00</span>:<span style="color: rgba(128, 0, 128, 1)">00</span>:<span style="color: rgba(128, 0, 128, 1)">00</span>:<span style="color: rgba(128, 0, 128, 1)">00</span><span style="color: rgba(0, 0, 0, 1)">
inet </span><span style="color: rgba(128, 0, 128, 1)">127.0</span>.<span style="color: rgba(128, 0, 128, 1)">0.1</span>/<span style="color: rgba(128, 0, 128, 1)">8</span><span style="color: rgba(0, 0, 0, 1)"> scope host lo
valid_lft forever preferred_lft forever
inet6 ::</span><span style="color: rgba(128, 0, 128, 1)">1</span>/<span style="color: rgba(128, 0, 128, 1)">128</span><span style="color: rgba(0, 0, 0, 1)"> scope host
valid_lft forever preferred_lft forever<br></span></pre>
<p class="16"><strong>2: ens33</strong>: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000</p>
<pre></pre>
<p class="16"> link/ether 00:0c:29:ab:3a:40 brd ff:ff:ff:ff:ff:ff</p>
<pre></pre>
<p class="16"> inet 192.168.1.161/24 brd 192.168.1.255 scope global noprefixroute ens33</p>
<pre></pre>
<p class="16"> valid_lft forever preferred_lft forever</p>
<pre></pre>
<p class="16"> inet6 fe80::588d:c898:3370:2cca/64 scope link noprefixroute</p>
<pre></pre>
<p class="16"> valid_lft forever preferred_lft forever</p>
<p class="16"><strong>3: ens37</strong>: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000</p>
<p class="16"> link/ether 00:0c:29:ab:3a:4a brd ff:ff:ff:ff:ff:ff</p>
<p class="16"> inet 192.168.1.162/24 brd 192.168.1.255 scope global noprefixroute ens37</p>
<p class="16"> valid_lft forever preferred_lft forever</p>
<p class="16"> inet6 fe80::7820:36ad:e6f7:59c9/64 scope link noprefixroute</p>
<p class="16"> valid_lft forever preferred_lft forever</p>
<p class="16"><strong>4: ens38</strong>: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000</p>
<p class="16"> link/ether 00:0c:29:ab:3a:54 brd ff:ff:ff:ff:ff:ff</p>
<p class="16"> inet 192.168.1.163/24 brd 192.168.1.255 scope global noprefixroute ens38</p>
<p class="16"> valid_lft forever preferred_lft forever</p>
<p class="16"> inet6 fe80::f4e9:65e6:f38d:cba3/64 scope link noprefixroute</p>
<p class="16"> valid_lft forever preferred_lft forever</p>
</div>
<p>• 修改网卡的配置文件名称。</p>
<div class="cnblogs_code">
<pre># cd /etc/sysconfig/network-scripts/<span style="color: rgba(0, 0, 0, 1)">
# <span style="color: rgba(0, 0, 255, 1)">mv</span> ifcfg-ens33 ifcfg-<span style="color: rgba(0, 0, 0, 1)">eth0
# <span style="color: rgba(0, 0, 255, 1)">mv</span> ifcfg-ens37 ifcfg-<span style="color: rgba(0, 0, 0, 1)">eth1
# <span style="color: rgba(0, 0, 255, 1)">mv</span> ifcfg-ens38 ifcfg-eth2</pre>
</div>
<p>• 修改网卡配置内容,将网卡和绑定设备名改成ethxx。</p>
<div class="cnblogs_code">
<pre># <span style="color: rgba(0, 0, 255, 1)">vi</span> ifcfg-<span style="color: rgba(0, 0, 0, 1)">eth0
NAME</span>=<span style="color: rgba(0, 0, 0, 1)">eth0
DEVICE</span>=<span style="color: rgba(0, 0, 0, 1)">eth0
# <span style="color: rgba(0, 0, 255, 1)">vi</span> ifcfg-<span style="color: rgba(0, 0, 0, 1)">eth1
NAME</span>=<span style="color: rgba(0, 0, 0, 1)">eth1
DEVICE</span>=<span style="color: rgba(0, 0, 0, 1)">eth1
# <span style="color: rgba(0, 0, 255, 1)">vi</span> ifcfg-<span style="color: rgba(0, 0, 0, 1)">eth2
NAME</span>=<span style="color: rgba(0, 0, 0, 1)">eth2
DEVICE</span>=<span style="color: rgba(0, 0, 0, 1)">eth2
# </pre>
</div>
<p><span style="font-family: 宋体">修改</span><span style="font-family: 宋体">B</span>IOS参数。</p>
<p>• 更新内核文件,于"GRUB_CMDLINE_LINUX="行尾额外添加"net.ifnames=0 biosdevname=0"两条参数。</p>
<div class="cnblogs_code">
<pre># <span style="color: rgba(0, 0, 255, 1)">vi</span> /etc/default/<span style="color: rgba(0, 0, 0, 1)">grub
GRUB_CMDLINE_LINUX</span>=<span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">resume=/dev/mapper/klas-swap rd.lvm.lv=klas/root rd.lvm.lv=klas/swap rhgb quiet crashkernel=1024M,high audit=0 net.ifnames=0 biosdevname=0</span><span style="color: rgba(128, 0, 0, 1)">"</span></pre>
</div>
<p>• 检查系统引导启动方式。</p>
<div class="cnblogs_code">
<pre># ll /sys/firmware/<span style="color: rgba(0, 0, 0, 1)">efi
</span><span style="color: rgba(0, 0, 255, 1)">ls</span>: cannot access <span style="color: rgba(128, 0, 0, 1)">'</span><span style="color: rgba(128, 0, 0, 1)">/sys/firmware/efi</span><span style="color: rgba(128, 0, 0, 1)">'</span>: No such <span style="color: rgba(0, 0, 255, 1)">file</span><span style="color: rgba(0, 0, 0, 1)"> or directory
# dmesg | <span style="color: rgba(0, 0, 255, 1)">grep</span> <span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">EFI v</span><span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(0, 0, 0, 1)">
#<br><br></pre>
<p class="16"><strong>说明:</strong>一般系统有UEFI和传统BIOS两种引导启动方式,如上述命令中,没有/sys/firmware/efi文件,并且dmesg命令没有EFI关键词输出,说明当前系统是传统BIOS方式引导启动;如果有目录和关键词输出,说明是UEFI启动。</p>
</div>
<p>• 重新生成内核引导文件。</p>
<div class="cnblogs_code">
<pre># grub2-mkconfig -o /boot/grub2/<span style="color: rgba(0, 0, 0, 1)">grub.cfg
#执行成功输出如下:
Generating grub configuration </span><span style="color: rgba(0, 0, 255, 1)">file</span><span style="color: rgba(0, 0, 0, 1)"> ...<br>Found linux image: </span>/boot/vmlinuz-<span style="color: rgba(128, 0, 128, 1)">4.19</span>.<span style="color: rgba(128, 0, 128, 1)">90</span>-<span style="color: rgba(128, 0, 128, 1)">52.22</span>.v2207.ky10.x86_64</pre>
<p class="16"> Found initrd image: /boot/initramfs-4.19.90-52.22.v2207.ky10.x86_64.img</p>
<p class="16"> Found linux image: /boot/vmlinuz-0-rescue-c30be0c3a35649f1b686342f9354e4aa</p>
<p class="16"> Found initrd image: /boot/initramfs-0-rescue-c30be0c3a35649f1b686342f9354e4aa.img</p>
<p class="16"> done</p>
</div>
<p><strong>注意:</strong><span style="font-family: 宋体">如果系统引导启动方式是</span><span style="font-family: 宋体">U</span>EFI<span style="font-family: 宋体">,那么不能在</span><span style="font-family: 宋体">/</span>boot/grub2<span style="font-family: 宋体">目录下生成内核引导文件,需要执行命令:</span><span style="font-family: 宋体">“</span>grub2-mkconfig -o /boot/efi/EFI/kylin/grub.cfg”,将内核文件生成到/boot/efi/EFI/kylin/下才能生效。</p>
<p>■ 修改udev,配置网卡名和MAC地址绑定。</p>
<p>• 注释第一行,并手动添加3行,通过网卡MAC<span style="font-family: 宋体">地址绑定</span><span style="font-family: 宋体">ethxx网卡名。</span></p>
<div class="cnblogs_code">
<pre>• # <span style="color: rgba(0, 0, 255, 1)">vi</span> /usr/lib/udev/rules.d/<span style="color: rgba(128, 0, 128, 1)">60</span>-<span style="color: rgba(0, 0, 0, 1)">net.rules
#ACTION</span>==<span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">add</span><span style="color: rgba(128, 0, 0, 1)">"</span>, SUBSYSTEM==<span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">net</span><span style="color: rgba(128, 0, 0, 1)">"</span>, DRIVERS==<span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">?*</span><span style="color: rgba(128, 0, 0, 1)">"</span>, ATTR{type}==<span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">1</span><span style="color: rgba(128, 0, 0, 1)">"</span>, PROGRAM=<span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">/lib/udev/rename_device</span><span style="color: rgba(128, 0, 0, 1)">"</span>, RESULT==<span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">?*</span><span style="color: rgba(128, 0, 0, 1)">"</span>, NAME=<span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">$result</span><span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(0, 0, 0, 1)">
ACTION</span>==<span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">add</span><span style="color: rgba(128, 0, 0, 1)">"</span>, SUBSYSTEM==<span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">net</span><span style="color: rgba(128, 0, 0, 1)">"</span>, DRIVERS==<span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">?*</span><span style="color: rgba(128, 0, 0, 1)">"</span>, ATTR{type}==<span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">1</span><span style="color: rgba(128, 0, 0, 1)">"</span>, ATTR{address}==<span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">00:0c:29:ab:3a:40</span><span style="color: rgba(128, 0, 0, 1)">"</span>, NAME=<span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">eth0</span><span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(0, 0, 0, 1)">
ACTION</span>==<span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">add</span><span style="color: rgba(128, 0, 0, 1)">"</span>, SUBSYSTEM==<span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">net</span><span style="color: rgba(128, 0, 0, 1)">"</span>, DRIVERS==<span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">?*</span><span style="color: rgba(128, 0, 0, 1)">"</span>, ATTR{type}==<span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">1</span><span style="color: rgba(128, 0, 0, 1)">"</span>, ATTR{address}==<span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">00:0c:29:ab:3a:4a</span><span style="color: rgba(128, 0, 0, 1)">"</span>, NAME=<span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">eth1</span><span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(0, 0, 0, 1)">
ACTION</span>==<span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">add</span><span style="color: rgba(128, 0, 0, 1)">"</span>, SUBSYSTEM==<span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">net</span><span style="color: rgba(128, 0, 0, 1)">"</span>, DRIVERS==<span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">?*</span><span style="color: rgba(128, 0, 0, 1)">"</span>, ATTR{type}==<span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">1</span><span style="color: rgba(128, 0, 0, 1)">"</span>, ATTR{address}==<span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">00:0c:29:ab:3a:54</span><span style="color: rgba(128, 0, 0, 1)">"</span>, NAME=<span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">eth2</span><span style="color: rgba(128, 0, 0, 1)">"</span></pre>
</div>
<p>■ 验证修改结果。</p>
<p>• 重启系统后配置生效。</p>
<p class="16"># reboot</p>
<p>• 检查网卡,成功将网卡名修改为ethx。</p>
<div class="cnblogs_code">
<pre># ip a
</span><span style="color: rgba(128, 0, 128, 1)">1</span>: lo: <LOOPBACK,UP,LOWER_UP> mtu <span style="color: rgba(128, 0, 128, 1)">65536</span> qdisc noqueue state UNKNOWN group default qlen <span style="color: rgba(128, 0, 128, 1)">1000</span><span style="color: rgba(0, 0, 0, 1)">
link</span>/loopback <span style="color: rgba(128, 0, 128, 1)">00</span>:<span style="color: rgba(128, 0, 128, 1)">00</span>:<span style="color: rgba(128, 0, 128, 1)">00</span>:<span style="color: rgba(128, 0, 128, 1)">00</span>:<span style="color: rgba(128, 0, 128, 1)">00</span>:<span style="color: rgba(128, 0, 128, 1)">00</span> brd <span style="color: rgba(128, 0, 128, 1)">00</span>:<span style="color: rgba(128, 0, 128, 1)">00</span>:<span style="color: rgba(128, 0, 128, 1)">00</span>:<span style="color: rgba(128, 0, 128, 1)">00</span>:<span style="color: rgba(128, 0, 128, 1)">00</span>:<span style="color: rgba(128, 0, 128, 1)">00</span><span style="color: rgba(0, 0, 0, 1)">
inet </span><span style="color: rgba(128, 0, 128, 1)">127.0</span>.<span style="color: rgba(128, 0, 128, 1)">0.1</span>/<span style="color: rgba(128, 0, 128, 1)">8</span><span style="color: rgba(0, 0, 0, 1)"> scope host lo
valid_lft forever preferred_lft forever
inet6 ::</span><span style="color: rgba(128, 0, 128, 1)">1</span>/<span style="color: rgba(128, 0, 128, 1)">128</span><span style="color: rgba(0, 0, 0, 1)"> scope host
valid_lft forever preferred_lft forever
</span><span style="color: rgba(128, 0, 128, 1)">2</span>: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu <span style="color: rgba(128, 0, 128, 1)">1500</span> qdisc fq_codel state UP group default qlen <span style="color: rgba(128, 0, 128, 1)">1000</span><span style="color: rgba(0, 0, 0, 1)">
link</span>/ether <span style="color: rgba(128, 0, 128, 1)">00</span>:0c:<span style="color: rgba(128, 0, 128, 1)">29</span>:ab:3a:<span style="color: rgba(128, 0, 128, 1)">40</span><span style="color: rgba(0, 0, 0, 1)"> brd ff:ff:ff:ff:ff:ff
inet </span><span style="color: rgba(128, 0, 128, 1)">192.168</span>.<span style="color: rgba(128, 0, 128, 1)">1.161</span>/<span style="color: rgba(128, 0, 128, 1)">24</span> brd <span style="color: rgba(128, 0, 128, 1)">192.168</span>.<span style="color: rgba(128, 0, 128, 1)">1.255</span><span style="color: rgba(0, 0, 0, 1)"> scope global noprefixroute eth0
valid_lft forever preferred_lft forever
inet6 fe80::</span><span style="color: rgba(128, 0, 128, 1)">3445</span>:a251:8e9:8c84/<span style="color: rgba(128, 0, 128, 1)">64</span><span style="color: rgba(0, 0, 0, 1)"> scope link noprefixroute
valid_lft forever preferred_lft forever
</span><span style="color: rgba(128, 0, 128, 1)">3</span>: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu <span style="color: rgba(128, 0, 128, 1)">1500</span> qdisc fq_codel state UP group default qlen <span style="color: rgba(128, 0, 128, 1)">1000</span><span style="color: rgba(0, 0, 0, 1)">
link</span>/ether <span style="color: rgba(128, 0, 128, 1)">00</span>:0c:<span style="color: rgba(128, 0, 128, 1)">29</span><span style="color: rgba(0, 0, 0, 1)">:ab:3a:4a brd ff:ff:ff:ff:ff:ff
inet </span><span style="color: rgba(128, 0, 128, 1)">192.168</span>.<span style="color: rgba(128, 0, 128, 1)">1.162</span>/<span style="color: rgba(128, 0, 128, 1)">24</span> brd <span style="color: rgba(128, 0, 128, 1)">192.168</span>.<span style="color: rgba(128, 0, 128, 1)">1.255</span><span style="color: rgba(0, 0, 0, 1)"> scope global noprefixroute eth1
valid_lft forever preferred_lft forever
inet6 fe80::</span><span style="color: rgba(128, 0, 128, 1)">6812</span>:c44f:ab83:9d8a/<span style="color: rgba(128, 0, 128, 1)">64</span><span style="color: rgba(0, 0, 0, 1)"> scope link noprefixroute
valid_lft forever preferred_lft forever
</span><span style="color: rgba(128, 0, 128, 1)">4</span>: eth2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu <span style="color: rgba(128, 0, 128, 1)">1500</span> qdisc fq_codel state UP group default qlen <span style="color: rgba(128, 0, 128, 1)">1000</span><span style="color: rgba(0, 0, 0, 1)">
link</span>/ether <span style="color: rgba(128, 0, 128, 1)">00</span>:0c:<span style="color: rgba(128, 0, 128, 1)">29</span>:ab:3a:<span style="color: rgba(128, 0, 128, 1)">54</span><span style="color: rgba(0, 0, 0, 1)"> brd ff:ff:ff:ff:ff:ff
inet </span><span style="color: rgba(128, 0, 128, 1)">192.168</span>.<span style="color: rgba(128, 0, 128, 1)">1.163</span>/<span style="color: rgba(128, 0, 128, 1)">24</span> brd <span style="color: rgba(128, 0, 128, 1)">192.168</span>.<span style="color: rgba(128, 0, 128, 1)">1.255</span><span style="color: rgba(0, 0, 0, 1)"> scope global noprefixroute eth2
valid_lft forever preferred_lft forever
inet6 fe80::</span><span style="color: rgba(128, 0, 128, 1)">5534</span>:cbf5:8f66:963e/<span style="color: rgba(128, 0, 128, 1)">64</span><span style="color: rgba(0, 0, 0, 1)"> scope link noprefixroute
valid_lft forever preferred_lft forever</span></pre>
</div>
<p> </p>
<h1>第3章 网卡名故障处理</h1>
<p>■ 说明:本故障处理方案适用于多网卡环境下,仅为某个或某几个网卡修改网卡名称。</p>
<h2>1.1、 现象描述</h2>
<p>■ <span style="font-family: 宋体">需求:当前系统部署</span><span style="font-family: 宋体">k8s集群,需要k8s集群中所有节点网卡名称统一为eth</span>0<span style="font-family: 宋体">,虽然系统中有多块网卡,但是只有最后一块网卡是</span><span style="font-family: 宋体">U</span>P<span style="font-family: 宋体">状态,现在需要将最后一块网卡名更改为</span><span style="font-family: 宋体">eth</span>0。</p>
<p> </p>
<p>■ <span style="font-family: 宋体">问题现象:如下图所示,在</span><span style="font-family: 宋体">udev中将最后一块网卡名称更改为eth</span>0<span style="font-family: 宋体">,重启后网卡名变成了</span><span style="font-family: 宋体">rename</span>4,并且IP<span style="font-family: 宋体">地址在</span><span style="font-family: 宋体">D</span>OWN的网卡上,导致网络不通。</p>
<p><img src="https://img2024.cnblogs.com/blog/1450920/202403/1450920-20240322152021026-1101680846.png"></p>
<h2>1.2、 问题分析</h2>
<p>■ <span style="font-family: 宋体">因为内核参数中增加了</span><span style="font-family: 宋体">“</span>net.ifnames=0 biosdevname=0<span style="font-family: 黑体">”</span><span style="font-family: 宋体">,重启系统生效后会自动分配</span><span style="font-family: 宋体">ethx的名称给每一块网卡,当前eth</span>0<span style="font-family: 宋体">名称已经被第一块网卡占用,所以修改</span><span style="font-family: 宋体">udev后会发生冲突,导致最后一块网卡名变为rename</span>4。</p>
<p> </p>
<h2>1.3、 解决思路</h2>
<p><span style="font-family: 宋体">先将第一块网卡名通过</span><span style="font-family: 宋体">udev改名,如改成eth</span>8<span style="font-family: 宋体">,解决</span><span style="font-family: 宋体">eth</span>0<span style="font-family: 宋体">名称占用问题;再将</span><span style="font-family: 宋体">rename</span>4<span style="font-family: 宋体">网卡名改成</span><span style="font-family: 宋体">eth</span>0,恢复网络故障。</p>
<p> </p>
<h2>1.4、 处理步骤</h2>
<p>• 将第一块网卡名称修改为eth8<span style="font-family: 宋体">,使用第一块网卡的</span><span style="font-family: 宋体">M</span>AC<span style="font-family: 宋体">地址修改网卡名,修改</span><span style="font-family: 宋体">udev需要重启系统生效。</span></p>
<div class="cnblogs_code">
<pre># <span style="color: rgba(0, 0, 255, 1)">vi</span> /usr/lib/udev/rules.d/<span style="color: rgba(128, 0, 128, 1)">60</span>-<span style="color: rgba(0, 0, 0, 1)">net.rules
#ACTION</span>==<span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">add</span><span style="color: rgba(128, 0, 0, 1)">"</span>, SUBSYSTEM==<span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">net</span><span style="color: rgba(128, 0, 0, 1)">"</span>, DRIVERS==<span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">?*</span><span style="color: rgba(128, 0, 0, 1)">"</span>, ATTR{type}==<span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">1</span><span style="color: rgba(128, 0, 0, 1)">"</span>, PROGRAM=<span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">/lib/udev/rename_device</span><span style="color: rgba(128, 0, 0, 1)">"</span>, RESULT==<span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">?*</span><span style="color: rgba(128, 0, 0, 1)">"</span>, NAME=<span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">$result</span><span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(0, 0, 0, 1)">
ACTION</span>==<span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">add</span><span style="color: rgba(128, 0, 0, 1)">"</span>, SUBSYSTEM==<span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">net</span><span style="color: rgba(128, 0, 0, 1)">"</span>, DRIVERS==<span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">?*</span><span style="color: rgba(128, 0, 0, 1)">"</span>, ATTR{type}==<span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">1</span><span style="color: rgba(128, 0, 0, 1)">"</span>, ATTR{address}==<span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">00:0c:29:ab:3a:40</span><span style="color: rgba(128, 0, 0, 1)">"</span>, NAME=<span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">eth8</span><span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(0, 0, 0, 1)">
# reboot</pre>
</div>
<p><span style="font-family: 宋体">重启后如下图,第一块网卡名更改为</span><span style="font-family: 宋体">eth</span>8:</p>
<p><img src="https://img2024.cnblogs.com/blog/1450920/202403/1450920-20240322152156774-1719571864.png"></p>
<p>将rename4<span style="font-family: 宋体">网卡名称修改为</span><span style="font-family: 宋体">eth</span>0<span style="font-family: 宋体">,并检查网卡配置文件</span><span style="font-family: 宋体">N</span>AME<span style="font-family: 宋体">和</span><span style="font-family: 宋体">D</span>EVICE<span style="font-family: 宋体">是否为</span><span style="font-family: 宋体">eth</span>0。</p>
<div class="cnblogs_code">
<pre># <span style="color: rgba(0, 0, 255, 1)">vi</span> /usr/lib/udev/rules.d/<span style="color: rgba(128, 0, 128, 1)">60</span>-<span style="color: rgba(0, 0, 0, 1)">net.rules
#ACTION</span>==<span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">add</span><span style="color: rgba(128, 0, 0, 1)">"</span>, SUBSYSTEM==<span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">net</span><span style="color: rgba(128, 0, 0, 1)">"</span>, DRIVERS==<span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">?*</span><span style="color: rgba(128, 0, 0, 1)">"</span>, ATTR{type}==<span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">1</span><span style="color: rgba(128, 0, 0, 1)">"</span>, PROGRAM=<span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">/lib/udev/rename_device</span><span style="color: rgba(128, 0, 0, 1)">"</span>, RESULT==<span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">?*</span><span style="color: rgba(128, 0, 0, 1)">"</span>, NAME=<span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">$result</span><span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(0, 0, 0, 1)">
ACTION</span>==<span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">add</span><span style="color: rgba(128, 0, 0, 1)">"</span>, SUBSYSTEM==<span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">net</span><span style="color: rgba(128, 0, 0, 1)">"</span>, DRIVERS==<span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">?*</span><span style="color: rgba(128, 0, 0, 1)">"</span>, ATTR{type}==<span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">1</span><span style="color: rgba(128, 0, 0, 1)">"</span>, ATTR{address}==<span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">00:0c:29:ab:3a:40</span><span style="color: rgba(128, 0, 0, 1)">"</span>, NAME=<span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">eth8</span><span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(0, 0, 0, 1)">
ACTION</span>==<span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">add</span><span style="color: rgba(128, 0, 0, 1)">"</span>, SUBSYSTEM==<span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">net</span><span style="color: rgba(128, 0, 0, 1)">"</span>, DRIVERS==<span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">?*</span><span style="color: rgba(128, 0, 0, 1)">"</span>, ATTR{type}==<span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">1</span><span style="color: rgba(128, 0, 0, 1)">"</span>, ATTR{address}==<span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">00:0c:29:ab:3a:54</span><span style="color: rgba(128, 0, 0, 1)">"</span>, NAME=<span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">eth0</span><span style="color: rgba(128, 0, 0, 1)">"</span></pre>
</div>
<div class="cnblogs_code">
<pre># <span style="color: rgba(0, 0, 255, 1)">cat</span> /etc/sysconfig/network-scripts/ifcfg-<span style="color: rgba(0, 0, 0, 1)">eth0
TYPE</span>=<span style="color: rgba(0, 0, 0, 1)">Ethernet
PROXY_METHOD</span>=<span style="color: rgba(0, 0, 0, 1)">none
BROWSER_ONLY</span>=<span style="color: rgba(0, 0, 0, 1)">no
BOOTPROTO</span>=<span style="color: rgba(0, 0, 0, 1)">none
DEFROUTE</span>=<span style="color: rgba(0, 0, 0, 1)">yes
IPV4_FAILURE_FATAL</span>=<span style="color: rgba(0, 0, 0, 1)">no
IPV6INIT</span>=<span style="color: rgba(0, 0, 0, 1)">yes
IPV6_AUTOCONF</span>=<span style="color: rgba(0, 0, 0, 1)">yes
IPV6_DEFROUTE</span>=<span style="color: rgba(0, 0, 0, 1)">yes
IPV6_FAILURE_FATAL</span>=<span style="color: rgba(0, 0, 0, 1)">no
IPV6_ADDR_GEN_MODE</span>=stable-<span style="color: rgba(0, 0, 0, 1)">privacy
NAME</span>=<span style="color: rgba(0, 0, 0, 1)">eth0
DEVICE</span>=<span style="color: rgba(0, 0, 0, 1)">eth0
ONBOOT</span>=<span style="color: rgba(0, 0, 0, 1)">yes
IPADDR</span>=<span style="color: rgba(128, 0, 128, 1)">192.168</span>.<span style="color: rgba(128, 0, 128, 1)">1.163</span><span style="color: rgba(0, 0, 0, 1)">
NETMASK</span>=<span style="color: rgba(128, 0, 128, 1)">255.255</span>.<span style="color: rgba(128, 0, 128, 1)">255.0</span><span style="color: rgba(0, 0, 0, 1)">
GATEWAY</span>=<span style="color: rgba(128, 0, 128, 1)">192.168</span>.<span style="color: rgba(128, 0, 128, 1)">1.254</span><span style="color: rgba(0, 0, 0, 1)">
# reboot</pre>
</div>
<p>• <span style="font-family: 宋体">验证故障恢复,如下图所示,状态为</span><span style="font-family: 宋体">U</span>P<span style="font-family: 宋体">的网卡更改为</span><span style="font-family: 宋体">eth</span>0,并恢复网络故障。<img src="https://img2024.cnblogs.com/blog/1450920/202403/1450920-20240322152413956-1936197319.png"></p>
<div> </div>
<div> </div>
</div>
<div id="MySignature" role="contentinfo">
- 但行好事,
莫问前程 -<br><br>
来源:https://www.cnblogs.com/Dfengshuo/p/18089597
頁:
[1]