Linux Centos 7では、network.serviceとは何ですか?どのような役割を果たしますか?

Linux Centos 7では、network.serviceとは何ですか?どのような役割を果たしますか?

これにより、systemctl status networkステータスは失敗としてマークされますが、まだ外部URLを要求できます。誰かがこのサービスが正確に何をしているのかを説明できますか?物理接続インターフェイスですか?

ベストアンサー1

背景

まず、これは技術的なものではありませんnetwork.servicenetwork.targetCentOS 7システムでこれらのファイルを検索すると、そのファイルのみが検索network.targetされます。

$ locate network.service
$

$ locate network.target
/usr/lib/systemd/system/network.target
$

コマンドを使用すると、systemdから直接システム単位のファイル記述を取得できますsystemctl。たとえば、

$ systemctl show network | grep -i description
Description=LSB: Bring up/down networking

通知出力を見ると、systemctl status ...次の説明が表示されます。

$ systemctl status network
● network.service - LSB: Bring up/down networking
   Loaded: loaded (/etc/rc.d/init.d/network; bad; vendor preset: disabled)
   Active: failed (Result: exit-code) since Mon 2018-09-03 21:49:05 EDT; 2 days ago
     Docs: man:systemd-sysv-generator(8)
  Process: 809 ExecStart=/etc/rc.d/init.d/network start (code=exited, status=1/FAILURE)

Warning: Journal has been rotated since unit was started. Log output is incomplete or unavailable.

また、マニュアルへの参照がマニュアルページ形式で提供されていることに注意してください。

man systemd-sysv-generator
  systemd-sysv-generator is a generator that creates wrapper .service units for 
  SysV init[1] scripts in /etc/init.d/* at boot and when configuration of the 
  system manager is reloaded. This will allow systemd(1) to support them 
  similarly to native units.

  LSB headers[2] in SysV init scripts are interpreted, and the ordering specified 
  in the header is turned into dependencies between the generated unit and other 
  units. LSB facilities "$remote_fs", "$network", "$named", "$portmap", "$time" 
  are supported and will be turned into dependencies on specific native systemd 
  targets. See systemd.special(5) for more details.

  SysV runlevels have corresponding systemd targets (runlevelX.target). Wrapper 
  unit that is generated will be wanted by those targets which correspond to 
  runlevels for which the script is enabled.

  systemd does not supports SysV scripts as part of early boot, so all wrapper 
  units are ordered after basic.target.

  systemd-sysv-generator implements systemd.generator(7).

systemd-sysv-generator既存のSysV initスクリプトに基づいてターゲットとサービスを構築します。この場合、システムの「ラップされた」初期化スクリプトはこのファイルです/etc/rc.d/init.d/network

目的

このユニットファイルの役割は、指定されたネットワークインタフェースの機能を呼び出すことです/etc/sysconfig/network。これは、NetworkManagerとsystemdが存在する前にほとんどのRed Hatベースのディストリビューションで使用されていたディレクトリです。

Systemdは、以前のバージョンのRed Hat(CentOS、Fedora、RHEL)との互換性を維持するための方法で、このディレクトリに定義されているすべてのネットワークインタフェースを呼び出します。

おすすめ記事