CentOS 7 Minimal 설치 후 ifconfig: command not found 대응하기

ifconfig-notworking-on-centos-7

모두가 잘 알고 계시듯이 ifconfig 명령은 GNU/Linux 시스템의 네트워크 설정을 하는데에 사용됩니다. 이 명령을 사용하여 IP 주소, MAC 주소, 네트워크 인터페이스 카드의 상태와 같은 상세한 정보를 조회할 수 있습니다. 하지만 이 명령은 더이상 사용되지 않으며 RHEL 7 및 클론 버전인 CentOS 7, Oracle Linux 7, Scientific Linux 7의 Minimal 설치시 함께 설치되지 않습니다.

CentOS Minimal 서버에서 네트워크 인터페이스 정보 조회

CentOS 7 Minimal 시스템에서 네트워크 인터페이스 카드의 상세 정보를 조회하기 위해서는 ip addr 또는 ip link 명령을 사용해야 합니다. 다음은 이 명령들의 예시입니다.

# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: venet0: <BROADCAST,POINTOPOINT,NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN 
    link/void 
    inet 127.0.0.1/32 scope host venet0
    inet 192.168.1.101/32 brd 192.168.1.101 scope global venet0:0

네트워크 인터페이스의 사용 통계를 보고 싶다면 다음의 명령을 사용하면 됩니다.

# ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN mode DEFAULT 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: venet0: <BROADCAST,POINTOPOINT,NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN mode DEFAULT 
    link/void

또는 다음의 명령을 통해 좀 더 상세한 정보를 조회할 수 있습니다.

# ip -s link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN mode DEFAULT 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    RX: bytes  packets  errors  dropped overrun mcast   
    0          0        0       0       0       0      
    TX: bytes  packets  errors  dropped carrier collsns 
    0          0        0       0       0       0      
2: venet0: <BROADCAST,POINTOPOINT,NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN mode DEFAULT 
    link/void 
    RX: bytes  packets  errors  dropped overrun mcast   
    8515667    6667     0       0       0       0      
    TX: bytes  packets  errors  dropped carrier collsns 
    300403     4249     0       0       0       0

CentOS 7 Minimal 서버에서 ifconfig 명령 활성화

만약에 어떤 패키지가 ifconfig 명령을 제공하는지 모른다면 간단하게 다음과 같은 명령을 사용하여 검색하는 것이 가능합니다.

# yum provides ifconfig
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.aol.in
 * extras: centos.aol.in
 * updates: centos.aol.in
net-tools-2.0-0.17.20131004git.el7.x86_64 : Basic networking tools
Repo        : @base
Matched from:
Filename    : /usr/sbin/ifconfig

또는 다음의 명령도 동일한 결과를 얻을 수 있습니다.

# yum whatprovides ifconfig

이 yum의 provides 또는 whatprovides 명령은 특정 기능이나 파일을 어떤 패키지가 제공하는지 찾을 수 있게 해줍니다. 위의 실행 결과를 보면 net-tools 패키지가 ifconfig 명령을 제공하고 있다는것을 할 수 있습니다. 그럼 이제 net-tools 패키지를 설치해 보도록 하겠습니다.

# yum install net-tools

이제부터 ifconfig 명령을 평소처럼 사용할 수 있게 되었습니다.

# ifconfig -a
lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 16436
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 0  (Local Loopback)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
venet0: flags=211<UP,BROADCAST,POINTOPOINT,RUNNING,NOARP>  mtu 1500
        inet 127.0.0.1  netmask 255.255.255.255  broadcast 0.0.0.0  destination 127.0.0.1
        unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  txqueuelen 0  (UNSPEC)
        RX packets 7073  bytes 8549159 (8.1 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 4611  bytes 359201 (350.7 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
venet0:0: flags=211<UP,BROADCAST,POINTOPOINT,RUNNING,NOARP>  mtu 1500
        inet 192.168.1.101  netmask 255.255.255.255  broadcast 192.168.1.101  destination 192.168.1.101
        unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  txqueuelen 0  (UNSPEC)

참고 : ‘Ifconfig’ Command Not Found In CentOS 7 Minimal Installation – A Quick Tip To Fix It