1、查看网络状态systemctl status NetworkManager

You can use the  systemctl status NetworkManager  command to verify its current status. When NetworkManager comes up, it reads the network card configuration scripts, which are in /etc/sysconfig/network-scripts and have a name that starts with ifcfg and is followed by the name of the network card.

[root@rhel7 ~]#  systemctl status NetworkManager
● NetworkManager.service - Network Manager
Loaded: loaded (/usr/lib/systemd/system/NetworkManager.service; enabled; vendor preset: enabled)
Active: active (running) since Mon -- :: EDT; 1min 16s ago
Main PID: (NetworkManager)
CGroup: /system.slice/NetworkManager.service
└─ /usr/sbin/NetworkManager --no-daemon Jun :: rhel7.com NetworkManager[]: <info> wpa_supplicant running
Jun :: rhel7.com NetworkManager[]: <info> (enp0s3): device state change: config -> ip-config (reason 'none') [ ]
Jun :: rhel7.com NetworkManager[]: <info> (enp0s3): device state change: ip-config -> ip-check (reason 'none') [ ]
Jun :: rhel7.com NetworkManager[]: <info> (enp0s3): device state change: ip-check -> secondaries (reason 'none') [ ]
Jun :: rhel7.com NetworkManager[]: <info> (enp0s3): device state change: secondaries -> activated (reason 'none') [ ]
Jun :: rhel7.com NetworkManager[]: <info> NetworkManager state is now CONNECTED_LOCAL
Jun :: rhel7.com NetworkManager[]: <info> NetworkManager state is now CONNECTED_GLOBAL
Jun :: rhel7.com NetworkManager[]: <info> Policy set 'enp0s3' (enp0s3) as default for IPv4 routing and DNS.
Jun :: rhel7.com NetworkManager[]: <info> (enp0s3): Activation: successful, device activated.
Jun :: rhel7.com NetworkManager[]: <info> startup complete
[root@rhel7 ~]#

2、查看网卡配置 ip addr show

To show current network settings, you can use the  ip addr show.

[root@rhel7 ~]# ip addr show
: lo: <LOOPBACK,UP,LOWER_UP> mtu qdisc noqueue state UNKNOWN
link/loopback ::::: brd :::::
inet 127.0.0.1/ scope host lo
valid_lft forever preferred_lft forever
inet6 ::/ scope host
valid_lft forever preferred_lft forever
: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu qdisc pfifo_fast state UP qlen
link/ether :::d8::0a brd ff:ff:ff:ff:ff:ff
inet 192.168.1.111/ brd 192.168.1.255 scope global enp0s3
valid_lft forever preferred_lft forever
inet6 fe80::a00:27ff:fed8:650a/ scope link
valid_lft forever preferred_lft forever
[root@rhel7 ~]#

3、Showing Current Connection Status:nmcli conn show

[root@rhel7 ~]# nmcli conn show
NAME UUID TYPE DEVICE
enp0s3 895e0994-685c--935b-a0e3af6a8cdb --ethernet enp0s3

After finding the name of the connection, you can use  nmcli con show  followed by the name of the connection to see all properties of the connection. Notice that this command shows many properties. #nmcli conn show enp0s3

[root@rhel7 ~]# nmcli conn show enp0s3
connection.id: enp0s3
connection.uuid: 895e0994-685c--935b-a0e3af6a8cdb
connection.interface-name: enp0s3
connection.type: --ethernet
connection.autoconnect: yes
connection.autoconnect-priority:
connection.timestamp:
connection.read-only: no
connection.permissions:
connection.zone: --
connection.master: --
connection.slave-type: --
connection.autoconnect-slaves: - (default)
connection.secondaries:
connection.gateway-ping-timeout:
connection.metered: unknown
--ethernet.port: --
--ethernet.speed:
--ethernet.duplex: --
--ethernet.auto-negotiate: yes
--ethernet.mac-address: --
--ethernet.cloned-mac-address: --
--ethernet.mac-address-blacklist:
--ethernet.mtu: auto
--ethernet.s390-subchannels:
--ethernet.s390-nettype: --
--ethernet.s390-options:
--ethernet.wake-on-lan: (default)
--ethernet.wake-on-lan-password: --
ipv4.method: manual
ipv4.dns:
ipv4.dns-search:
ipv4.addresses: 192.168.1.111/
ipv4.gateway: 192.168.1.100
ipv4.routes:
ipv4.route-metric: -
ipv4.ignore-auto-routes: no
ipv4.ignore-auto-dns: no
ipv4.dhcp-client-id: --
ipv4.dhcp-send-hostname: yes
ipv4.dhcp-hostname: --
ipv4.never-default: no
ipv4.may-fail: yes
ipv6.method: auto
ipv6.dns:
ipv6.dns-search:
ipv6.addresses:
ipv6.gateway: --
ipv6.routes:
ipv6.route-metric: -
ipv6.ignore-auto-routes: no
ipv6.ignore-auto-dns: no
ipv6.never-default: no
ipv6.may-fail: yes
ipv6.ip6-privacy: - (unknown)
ipv6.dhcp-send-hostname: yes
ipv6.dhcp-hostname: --
GENERAL.NAME: enp0s3
GENERAL.UUID: 895e0994-685c--935b-a0e3af6a8cdb
GENERAL.DEVICES: enp0s3
GENERAL.STATE: activated
GENERAL.DEFAULT: yes
GENERAL.DEFAULT6: no
GENERAL.VPN: no
GENERAL.ZONE: --
GENERAL.DBUS-PATH: /org/freedesktop/NetworkManager/ActiveConnection/
GENERAL.CON-PATH: /org/freedesktop/NetworkManager/Settings/
GENERAL.SPEC-OBJECT: /
GENERAL.MASTER-PATH: --
IP4.ADDRESS[]: 192.168.1.111/
IP4.GATEWAY: 192.168.1.100
IP6.ADDRESS[]: fe80::a00:27ff:fed8:650a/
IP6.GATEWAY:
[root@rhel7 ~]#

You can also use  nmcli  to show an overview of currently configured devices and the status of these devices. Type, for instance, the  nmcli dev status  command to show a list of all devices, and  nmcli dev show <devicename>  to show settings for a specific device.

[root@rhel7 ~]# nmcli dev show enp0s3
GENERAL.DEVICE: enp0s3
GENERAL.TYPE: ethernet
GENERAL.HWADDR: :::D8::0A
GENERAL.MTU:
GENERAL.STATE: (connected)
GENERAL.CONNECTION: enp0s3
GENERAL.CON-PATH: /org/freedesktop/NetworkManager/ActiveConnection/
WIRED-PROPERTIES.CARRIER: on
IP4.ADDRESS[]: 192.168.1.111/
IP4.GATEWAY: 192.168.1.100
IP6.ADDRESS[]: fe80::a00:27ff:fed8:650a/
IP6.GATEWAY:

nmcli工具还可用户直接配置、修改网络设置,但是命令用起来比较复杂,还不如直接修改配置文件或是使用nmtui命令方便。

4、使用nmtui工具配置网络

If you do not like the complicated syntax of the nmcli command line, you might like  nmtui . This is a text user interface that allows you to create network connections easily.

[root@rhel7 ~]# nmtui

                                            ┌─┤ NetworkManager TUI ├──┐
│ │
│ Please select an option │
│ │
│ Edit a connection │
│ Activate a connection │
│ Set system hostname │
│ │
│ Quit │
│ │
│ <OK> │
│ │
└─────────────────────────┘
┌───────────────────────────┤ Edit Connection ├───────────────────────────┐
│ │
│ Profile name enp0s3__________________________________ │
│ Device enp0s3 (:::D8::0A)______________ │
│ │
│ ═ ETHERNET <Show> │
│ │
│ ╤ IPv4 CONFIGURATION <Manual> <Hide> │
│ │ Addresses 192.168.1.111/24_________ <Remove> │
│ │ <Add...> │
│ │ Gateway 192.168..100____________ │
│ │ DNS servers <Add...> │
│ │ Search domains <Add...> │
│ │ │
│ │ Routing (No custom routes) <Edit...> │
│ │ [ ] Never use this network for default route │
│ │ │
│ │ [ ] Require IPv4 addressing for this connection │
│ └ │
│ │
│ ═ IPv6 CONFIGURATION <Automatic> <Show> │
│ │
│ [X] Automatically connect │
│ [X] Available to all users │
│ │
│ <Cancel> <OK> │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
└─────────────────────────────────────────────────────────────────────────┘

The nmtui interface consists of three menu options:
■ Edit a Connection: Use this option to create new connections or edit existing connections.
■ Activate a Connection: Use this to (re)activate a connection.
■ Set System Hostname: Use this to set the hostname of your computer.

5、 The nm-connection-editor interface

这个命令是登录到图形界面,在终端执行nm-connection-editor命令,打开网络配置编辑器,能完成简单的网卡配置。

6、直接修改网络配置文件

Working on Network Configuration Files   Every connection that you create is stored as a configuration file in the directory /etc/sysconfig/network-scripts. The name of the configuration files starts with ifcfg- and is followed by the name of the network interface.

[root@rhel7 ~]# vi /etc/sysconfig/network-scripts/ifcfg-enp0s3 

TYPE=Ethernet
BOOTPROTO=none
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
NAME=enp0s3
UUID=895e0994-685c--935b-a0e3af6a8cdb
DEVICE=enp0s3
ONBOOT=yes
IPADDR=192.168.1.111
PREFIX=
GATEWAY=192.168.1.100
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes

Normally, there should be no need to modify these configuration files manually. If you want to, though, you can. After making changes to the configuration file, use the  nmcli con reload  command to activate the new configuration. --修改完配置文件后,使用命令nmcli conn reload使配置生效

Configuring Network Configuration-RHEL7的更多相关文章

  1. Configuring Network in CentOS 6.3 Virtual Box + Screenshots

    Configuring Network in CentOS 6.3 Virtual Box + Screenshots Posted: May 23, 2013 in Uncategorized Ta ...

  2. Docker Network Configuration 高级网络配置

    Network Configuration TL;DR When Docker starts, it creates a virtual interface named docker0 on the ...

  3. Checking Network Configuration requirements Failed

    安装oracle执行检查,出现 Checking Network Configuration requirements ... Check complete. The overall result o ...

  4. Ubuntu网络network eth0配置 | ubuntu network configuration

    本文首发于个人博客https://kezunlin.me/post/5076bc45/,欢迎阅读! ubuntu network configuration Guide network proxy S ...

  5. 如何解决ubuntu 12.04重启后出现waiting for network configuration和网络标志消失问题

    如何解决ubuntu 12.04重启后出现waiting for network configuration和网络标志消失问题 作为菜鸟的我在学着设置网络后,重启电脑后显示 waiting forne ...

  6. Warning Please make sure the network configuration is correct!( iaas-install-mysql.sh 脚本)

    解读先电2.4版 iaas-install-mysql.sh 脚本 基础服务的操作命令已经编写成shell脚本,通过脚本进行一键安装.如下: # Controller节点 安装 执行脚本iaas-in ...

  7. Docker container network configuration

    http://xmodulo.com/networking-between-docker-containers.html How to set up networking between Docker ...

  8. 解决 Ubuntu 开机 Waiting for 60 seconds more for network configuration

    sudo vim /etc/network/interfaces, 将该文件的内容修改为如下:(也就是说删掉其他的什么auto eth0.auto wlan0) auto lo iface lo in ...

  9. 解决ubuntu14.04 启动时卡在 Waiting for network configuration...

    两种解决方法: 1.把/etc/network/interfaces中没有用到的配置删除掉 2.把 /etc/init/failsafe.conf 文件中的 sleep 40, sleep 59 注释 ...

随机推荐

  1. SQL中varchar和nvarchar有什么区别?

    varchar(n)长度为 n 个字节的可变长度且非 Unicode 的字符数据.n 必须是一个介于 1 和 8,000 之间的数值.存储大小为输入数据的字节的实际长度,而不是 n 个字节.nvarc ...

  2. 利用C++ RAII技术自动回收堆内存

    在C++的编程过程中,我们经常需要申请一块动态内存,然后当用完以后将其释放.通常而言,我们的代码是这样的: 1: void func() 2: { 3: //allocate a dynamic me ...

  3. Linux下python3与python3的多版本共存

    python3已经出来有些许时候了,python3相比python2进行了大量的改进,包括语法,新的功能,还有优化.虽然很多库已经同时支持 python2和python3了,但是有些库仍然没有很好的支 ...

  4. php 使用phpqrcode类生成带有logo的二维码 使logo不失真(透明)

    在开发中 发现phpqrcode类在加入logo时,如果 logo 是 png 图像带有透明区域时,二维码上都无法正常完美的显示出来 解决方法便是:修改phpqrcode文件中的 QRimage类下的 ...

  5. MongoDB-启动的时候出现了问题

    之前MongoDB启动的时候是正常的,不知道后来启动报错了,就把粘贴出来查询了.最后才知道是由于自己不正常的关闭导致的这个情况. --摘录:MongoDB非正常关闭后修复记录 mongod没有后台执行 ...

  6. JS读取文件,Javascript之文件操作 (IE)

    一.功能实现核心:FileSystemObject 对象      要在javascript中实现文件操作功能,主要就是依靠FileSystemobject对象. 二.FileSystemObject ...

  7. 01:Hello, World!

    描述 对于大部分编程语言来说,编写一个能够输出“Hello, World!”的程序往往是最基本.最简单的.因此,这个程序常常作为一个初学者接触一门新的编程语言所写的第一个程序,也经常用来测试开发.编译 ...

  8. Scut:SocketListener 的解析

    大致浏览了一遍,Scut 的网络模型采用的是 SAEA 模型, 它是 .NET Framework 3.5 开始支持的一种支持高性能 Socket 通信的实现. 通过分析 Scut 的套接字监听控制, ...

  9. LINUX搭建SVN客户端和多个项目的权限分组管理

    搭建SVN服务,有效的管理代码,以下三步可以快速搞定.1.安装 #yum install subversion 判断是否安装成功 1 #subversion -v svnserve, version ...

  10. c# 接口代码实例

    类和接口的实现 接口定义:为一组方法签名指定一个名称的方式. 类实现接口,就一定要提供接口所有方法的实现. 即使抽象类,也要全部实现,但是,它可以把接口方法声明为abstract的,从而把这个接口方法 ...