centos nmtui 使用_CentOS7使用nmtui和nmcli配置网络

centos nmtui 使用_CentOS7使用nmtui和nmcli配置网络CentOS7 使用 nmtui 和 nmcli 配置网络 CentOS7 配置网络推荐使用 NetworkManag 服务 不推荐 network 服务 图形化方式 nmtui 或 Applications gt SystemTools gt Settings gt Network 命令方式 nmclinmtui 要求安装了 NetworkManag tui 包 nmcli 要求安装了 NetworkManag 包

CentOS7使用nmtui和nmcli配置网络

CentOS7配置网络推荐使用NetworkManager服务(不推荐network服务)。

图形化方式:nmtui或Applications->System Tools->Settings->Network

命令方式:nmcli

nmtui要求安装了NetworkManager-tui包

nmcli要求安装了NetworkManager包

注:nmtui与nmcli均是通过NetworkManager实现对网络进行配置

1.  nmtui图形化方式

nmtui->

49ef88e1fdbb297720a325aa88f20124.png

fb5d76765f33e0d3ef670797bd986359.png

e510676dfc387a4af76485d4400da2f5.png

8029bafddb75567b96b6d93242b1c8bd.png

67d51d37341a5297cbb8374145a70934.png

d776210ecb96a38094bdfe5d077b6155.png

ab063a11a103068de52ebffedf473a62.png

[ ] Require IPv4 addressing for this connect->默认不勾选->IPv4寻址方式

[X] Automatically connect->默认->自动连接->ONBOOT=yes

[X] Available to all users->默认->所有用户均可使用

IPv4 CONFIGURATION  Manual->静态配置->BOOTPROTO=none

Profile name  ens33->NAME=ens33

cat /etc/sysconfig/network-scripts/ifcfg-ens33

HWADDR=00:0C:29:B4:F1:FE

TYPE=Ethernet

PROXY_METHOD=none

BROWSER_ONLY=no

BOOTPROTO=none

IPADDR=9.9.9.111

PREFIX=24

GATEWAY=9.9.9.254

DNS1=9.9.9.111

DNS2=9.9.9.112

DOMAIN=oracle.com

DEFROUTE=yes

IPV4_FAILURE_FATAL=no

IPV6INIT=no

NAME=ens33

UUID=e-b421-4299-9ace-b1509e

ONBOOT=yes

cat /etc/sysconfig/network-scripts/ifcfg-ens34

HWADDR=00:0C:29:B4:F1:08

TYPE=Ethernet

PROXY_METHOD=none

BROWSER_ONLY=no

BOOTPROTO=none

IPADDR=99.99.99.111

PREFIX=24

DEFROUTE=yes

IPV4_FAILURE_FATAL=no

IPV6INIT=no

NAME=ens34

UUID=53f2aa6a-cb9c-4ff9-812b-be2ef549bced

ONBOOT=yes

cat /etc/resolv.conf

# Generated by NetworkManager

search oracle.com

nameserver 9.9.9.111

nameserver 9.9.9.112

cat /etc/hostname

rac111

2.  Applications->System Tools->Settings->Network图形化

Applications->System Tools->Settings->Network

b_0_201808030931149876.jpg

3.  nmcli命令方式

nmcli命令方式非常适合用于批处理脚本

主机名配置

hostnamectl set-hostname rac111  ->/etc/hostname

网卡配置

nmcli connection add type ethernet ifname ens33 con-name ens33 ipv4.method manual ipv4.addresses 9.9.9.111/24 ipv4.gateway 9.9.9.254 ipv4.dns 9.9.9.111,9.9.9.112 ipv4.dns-search oracle.com ipv6.method ignore

nmcli connection add type ethernet ifname ens34 con-name ens34 ipv4.method manual ipv4.addresses 99.99.99.111/24 ipv6.method ignore

#nmcli connection add type ethernet ifname ens33 con-name ens33 autoconnect yes save yes ipv4.method manual ipv4.addresses 9.9.9.111/24 ipv4.gateway 9.9.9.254 ipv4.dns 9.9.9.111,9.9.9.112 ipv4.dns-search oracle.com ipv6.method ignore

#nmcli connection add type ethernet ifname ens34 con-name ens34 autoconnect yes save yes ipv4.method manual ipv4.addresses 99.99.99.111/24 ipv6.method ignore

autoconnect yes->默认->[X] Automatically connect

save yes->默认->/etc/sysconfig/network-scripts/ifcfg-ens33->ifcfg-ens33可以改名(NAME=ens33)

[X] Available to all users->默认->没找到相关设置值

确认有哪些设置值

nmcli con edit

->

Enter connection type: ethernet

->

help

->

print

nmcli connection up ens33

nmcli connection down ens33

nmcli connection delete ens33

nmcli connection show

nmcli device show

nmcli device status

ifconfig

ip address->ip a

CentOS6不勾选“Available to all users”,无/etc/sysconfig/network-scripts/ifcfg-Wired_connection_1配置文件(CentOS7仍会生成对应配置文件,只与save yes有关,默认就是yes)

82e3c4af026ba0def3017e011fdd5840.png

希望与广大网友互动??

点此进行留言吧!

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/215421.html原文链接:https://javaforall.net

(0)
上一篇 2026年3月18日 下午1:57
下一篇 2026年3月18日 下午1:58


相关推荐

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号