このセクションでは、nmtui コマンドからネットワーク設定する方法を紹介します。

まず、nmtui コマンドが見つからない場合には、パッケージをインストールする必要があります。

[root@kube-master ~]# nmtui
-bash: nmtui: command not found
[root@kube-master ~]# 

NetworkManager のパッケージをインストールします。

[root@kube-master ~]# yum install NetworkManager-tui
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: ftp-srv2.kddilabs.jp
 * extras: ftp-srv2.kddilabs.jp
 * updates: ftp-srv2.kddilabs.jp
Resolving Dependencies
--> Running transaction check
---> Package NetworkManager-tui.x86_64 1:1.12.0-8.el7_6 will be installed
--> Processing Dependency: NetworkManager-libnm(x86-64) = 1:1.12.0-8.el7_6 for package: 1:NetworkManager-tui-1.12.0-8.el7_6.x86_64
--> Processing Dependency: NetworkManager = 1:1.12.0-8.el7_6 for package: 1:NetworkManager-tui-1.12.0-8.el7_6.x86_64
--> Processing Dependency: libnm.so.0(libnm_1_8_0)(64bit) for package: 1:NetworkManager-tui-1.12.0-8.el7_6.x86_64
--> Processing Dependency: libnm.so.0(libnm_1_6_0)(64bit) for package: 1:NetworkManager-tui-1.12.0-8.el7_6.x86_64
--> Processing Dependency: libnm.so.0(libnm_1_2_0)(64bit) for package: 1:NetworkManager-tui-1.12.0-8.el7_6.x86_64
--> Processing Dependency: libnm.so.0(libnm_1_0_0)(64bit) for package: 1:NetworkManager-tui-1.12.0-8.el7_6.x86_64
--> Processing Dependency: libnm.so.0()(64bit) for package: 1:NetworkManager-tui-1.12.0-8.el7_6.x86_64
--> Running transaction check
---> Package NetworkManager.x86_64 1:1.12.0-8.el7_6 will be installed
---> Package NetworkManager-libnm.x86_64 1:1.12.0-8.el7_6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package                   Arch        Version               Repository    Size
================================================================================
Installing:
 NetworkManager-tui        x86_64      1:1.12.0-8.el7_6      updates      239 k
Installing for dependencies:
 NetworkManager            x86_64      1:1.12.0-8.el7_6      updates      1.7 M
 NetworkManager-libnm      x86_64      1:1.12.0-8.el7_6      updates      1.4 M

Transaction Summary
================================================================================
Install  1 Package (+2 Dependent packages)

Total download size: 3.3 M
Installed size: 12 M
Is this ok [y/d/N]: y
Downloading packages:
(1/3): NetworkManager-1.12.0-8.el7_6.x86_64.rpm            | 1.7 MB   00:04     
(2/3): NetworkManager-tui-1.12.0-8.el7_6.x86_64.rpm        | 239 kB   00:00     
(3/3): NetworkManager-libnm-1.12.0-8.el7_6.x86_64.rpm      | 1.4 MB   00:04     
--------------------------------------------------------------------------------
Total                                              667 kB/s | 3.3 MB  00:05     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : 1:NetworkManager-libnm-1.12.0-8.el7_6.x86_64                 1/3 
  Installing : 1:NetworkManager-1.12.0-8.el7_6.x86_64                       2/3 
  Installing : 1:NetworkManager-tui-1.12.0-8.el7_6.x86_64                   3/3 
  Verifying  : 1:NetworkManager-tui-1.12.0-8.el7_6.x86_64                   1/3 
  Verifying  : 1:NetworkManager-1.12.0-8.el7_6.x86_64                       2/3 
  Verifying  : 1:NetworkManager-libnm-1.12.0-8.el7_6.x86_64                 3/3 

Installed:
  NetworkManager-tui.x86_64 1:1.12.0-8.el7_6                                    

Dependency Installed:
  NetworkManager.x86_64 1:1.12.0-8.el7_6                                        
  NetworkManager-libnm.x86_64 1:1.12.0-8.el7_6                                  

Complete!
[root@kube-master ~]# 

NetworkManager サービスを起動します。

■ 起動
[root@kube-master ~]# systemctl start NetworkManager
[root@kube-master ~]# 

■ 起動状態の確認
[root@kube-master ~]# systemctl status NetworkManager
● NetworkManager.service - Network Manager
   Loaded: loaded (/usr/lib/systemd/system/NetworkManager.service; enabled; vendor preset: enabled)
   Active: active (running) since Mon 2019-02-11 10:46:06 UTC; 3s ago
     Docs: man:NetworkManager(8)
 Main PID: 13829 (NetworkManager)
   CGroup: /system.slice/NetworkManager.service
           ├─13829 /usr/sbin/NetworkManager --no-daemon
           ├─13845 /sbin/dhclient -d -q -sf /usr/libexec/nm-dhcp-helper -pf /...
           └─13861 /usr/libexec/nm-dhcp-helper

Feb 11 10:46:08 kube-master.novalocal NetworkManager[13829]: <info>  [1549881...
Feb 11 10:46:08 kube-master.novalocal NetworkManager[13829]: <info>  [1549881...
Feb 11 10:46:08 kube-master.novalocal NetworkManager[13829]: <info>  [1549881...
Feb 11 10:46:08 kube-master.novalocal NetworkManager[13829]: <info>  [1549881...
Feb 11 10:46:08 kube-master.novalocal NetworkManager[13829]: <info>  [1549881...
Feb 11 10:46:08 kube-master.novalocal NetworkManager[13829]: <info>  [1549881...
Feb 11 10:46:09 kube-master.novalocal dhclient[13845]: DHCPDISCOVER on eth0 t...
Feb 11 10:46:09 kube-master.novalocal dhclient[13845]: DHCPREQUEST on eth0 to...
Feb 11 10:46:09 kube-master.novalocal dhclient[13845]: DHCPOFFER from 172.16....
Feb 11 10:46:09 kube-master.novalocal dhclient[13845]: DHCPACK from 172.16.2....
Hint: Some lines were ellipsized, use -l to show in full.
[root@kube-master ~]# 

NetworkManager サービスの自動起動を有効化します。

■ 自動起動の有効化
[root@kube-master ~]# systemctl enable NetworkManager
[root@kube-master ~]#

■ 自動起動の状態確認 
[root@kube-master ~]# systemctl is-enabled NetworkManager
enabled
[root@kube-master ~]# 

nmtui コマンドを実行します。

[root@kube-master ~]# nmtui

NetworkManager TUI 画面が起動しますので、[ Edit a connection ] メニューをクリックします。

[ System eth0 ] メニューをクリックします。ここでは、 インターフェイス eth0 のネットワークを設定します。

eth0 のネットワークを設定します。

画面を下にスクロールし、< OK > ボタンを押します。

< 戻る > ボタンを押し、前の画面に戻ります。

< OK > ボタンを押し、設定を終了します。