当前位置:网站首页>rhel8.3 系统下修改有线网卡配置信息实现联网
rhel8.3 系统下修改有线网卡配置信息实现联网
2022-08-03 17:45:00 【多于少的区别】
rhel8.3 系统下修改有线网卡配置信息实现联网
问题描述:
因为之前实验的原因,宿主机的有线网卡ip被修改了,导致无法上网,需要重新配置有线网卡信息来实现联网。
问题解决:
1.查找宿主机所在局域网中空闲的IP
首先可以通过将网卡设置为DHCP模式,获取所在局域网的路由器分配的空闲IP地址。
[[email protected] network-scripts]# pwd
/etc/sysconfig/network-scripts
[[email protected] network-scripts]# cat ifcfg-enp6s0f4u2u1
NAME=enp6s0f4u2u1
DEVICE=enp6s0f4u2u1
ONBOOT=yes
BOOTPROTO=dhcp
[[email protected] network-scripts]# nmcli connection reload
[[email protected] network-scripts]# nmcli connection down enp6s0f4u2u1
Connection 'enp6s0f4u2u1' successfully deactivated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/15)
[[email protected] network-scripts]# nmcli connection up enp6s0f4u2u1
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/16)
[[email protected] network-scripts]# ip addr show enp6s0f4u2u1
2: enp6s0f4u2u1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 2c:16:db:a5:e3:e2 brd ff:ff:ff:ff:ff:ff
inet 192.168.1.27/24 brd 192.168.1.255 scope global dynamic noprefixroute enp6s0f4u2u1
valid_lft 86394sec preferred_lft 86394sec
[[email protected] network-scripts]#
## 2.将IP通过nmcli命令工具生存ifcfg配置文件,设置为静态IP
两种方式:
1)方式一:nmcli modify直接修改
[[email protected] network-scripts]# nmcli connection modify enp6s0f4u2u1 con-name enp6s0f4u2u1 ifname enp6s0f4u2u1 ipv4.method manual ipv4.addresses 192.168.1.27/24 ipv4.gateway 192.168.1.1 ipv4.dns 114.114.114.114
[[email protected] network-scripts]# nmcli connection down enp6s0f4u2u1
Connection 'enp6s0f4u2u1' successfully deactivated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/17)
[[email protected] network-scripts]# nmcli connection up enp6s0f4u2u1
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/18)
[[email protected] network-scripts]#
[[email protected] network-scripts]# cat ifcfg-enp6s0f4u2u1
NAME=enp6s0f4u2u1
DEVICE=enp6s0f4u2u1
ONBOOT=yes
BOOTPROTO=none
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
IPADDR=192.168.1.27
PREFIX=24
GATEWAY=192.168.1.1
DNS1=114.114.114.114
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=no
UUID=3fb4a032-24a9-637d-d7a8-15a0744daa71

2)方式二:删除ifcfg文件,再通过nmcli命令添加
[[email protected] network-scripts]# rm -f ifcfg-enp6s0f4u2u1
[[email protected] network-scripts]# nmcli connection add con-name enp6s0f4u2u1 ifname enp6s0f4u2u1 ipv4.method manual ipv4.addresses 192.168.1.27/24 ipv4.gateway 192.168.1.1 ipv4.dns 114.114.114.114 type ethernet
Warning: There is another connection with the name 'enp6s0f4u2u1'. Reference the connection by its uuid 'baba6b0a-f1db-4e23-b120-dd8336227a54'
Connection 'enp6s0f4u2u1' (baba6b0a-f1db-4e23-b120-dd8336227a54) successfully added.
[[email protected] network-scripts]# nmcli connection reload
[[email protected] network-scripts]# nmcli connection down enp6s0f4u2u1
Connection 'enp6s0f4u2u1' successfully deactivated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/19)
[[email protected] network-scripts]# nmcli connection up enp6s0f4u2u1
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/20)
[[email protected] network-scripts]# cat ifcfg-enp6s0f4u2u1-1
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=none
IPADDR=192.168.1.27
PREFIX=24
GATEWAY=192.168.1.1
DNS1=114.114.114.114
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=enp6s0f4u2u1
UUID=baba6b0a-f1db-4e23-b120-dd8336227a54
DEVICE=enp6s0f4u2u1
ONBOOT=yes
[[email protected] network-scripts]#

此时就可以联网了。
边栏推荐
- LeetCode - 102. 二叉树的层序遍历;110. 平衡二叉树;098. 验证二叉搜索树
- 关于vscode安装包下载太慢解决方法
- 【mysql】SIGN(x)函数
- 2021年数据泄露成本报告解读
- DataWorks 标准版怎样实现SQL代码的复用?
- Cool open technology x StarRocks: unified OLAP analysis engine, comprehensive building digital model of OTT
- 论文解读(JKnet)《Representation Learning on Graphs with Jumping Knowledge Networks》
- 【时间的比较】
- websocket Handshake failed due to invalid Upgrade header
- 【刻意练习观后管】刻意练习
猜你喜欢

【技术白皮书】第一章:OCR智能文字识别新发展——深度学习的文本信息抽取

使用.NET简单实现一个Redis的高性能克隆版(一)

华为ECS云服务器上安装Docker及部署Redis详细教程【华为云至简致远】

云图说丨初识华为云微服务引擎CSE

Is OnePlus Ace worth buying?Use strength to interpret the power of performance

星巴克输血赶不上流血

gcc的学习及 版本太低如何在conda环境下重新进行安装

yaml数据格式

es6新增-Generator(异步编程的解决方案2)

JS string to GBK encoding ultra-reduced implementation
随机推荐
一文带你弄懂 CDN 技术的原理
七夕
【Deliberately practice the view of the back tube】deliberately practice
341. Flatten Nested List Iterator
云图说丨初识华为云微服务引擎CSE
新“妖股”13个交易日暴涨320倍,市值3100亿美元超阿里
工程仪器设备在线监测管理系统常见问题和注意事项
全尺度表示的上下文非局部对齐,南科大&优图提出NAFS解决基于文本的Re ID
中国算力大会昇腾鲲鹏生态论坛举办;快手成立独立to B业务部门…
WPF 实现柱形统计图
uniapp 切换 history 路由模
如何直击固定资产管理的难题?
Interpretation of the paper (JKnet) "Representation Learning on Graphs with Jumping Knowledge Networks"
ICDAR competition technology sharing
腾讯电竞的蓝翔梦
Atomic Wallet已支持TRC20-USDT
A complete detailed tutorial on building intranet penetration ngrok (with pictures and truth)
论文解读(JKnet)《Representation Learning on Graphs with Jumping Knowledge Networks》
Digital IC Handwriting - MCMM, WNS and TNS
mysql命令