Operation System/Unix & Linux

ifdown과 ifconfig down flags 차이

junsuyoun 2022. 12. 19. 17:11
728x90
반응형

리눅스에서 특정 이더넷을 다운 시키는 명령어 두가지가 있습니다. 두 명령어 모두 해당 이더넷으로 접속을 못하게 되는데요.  두 명령 수행 결과에 따라 이더넷 flags 상태 값에 차이가 있습니다.

  • ifdown <ethernet>
  • ifconfig <ethernet> down

ifdown <ethernet>
[root@host ~]# ifconfig -a
ens36: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.78.21  netmask 255.255.255.0  broadcast 192.168.78.255
        inet6 fe80::db6f:5a7b:d011:e418  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:1e:fe:ba  txqueuelen 1000  (Ethernet)
        RX packets 202  bytes 23718 (23.1 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 14  bytes 1422 (1.3 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
[root@host ~]# ifdown ens36
장치 'ens36'의 연결이 성공적으로 해제되었습니다.
[root@host ~]# ifconfig -a
ens36: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        ether 00:0c:29:1e:fe:ba  txqueuelen 1000  (Ethernet)
        RX packets 202  bytes 23718 (23.1 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 16  bytes 1722 (1.6 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
ifconfig <ethernet> down
[root@host ~]# ifconfig -a
ens36: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.78.21  netmask 255.255.255.0  broadcast 192.168.78.255
        inet6 fe80::db6f:5a7b:d011:e418  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:1e:fe:ba  txqueuelen 1000  (Ethernet)
        RX packets 202  bytes 23718 (23.1 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 27  bytes 2920 (2.8 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
[root@host ~]# ifconfig ens36 down
[root@host ~]# ifconfig -a
ens36: flags=4098<BROADCAST,MULTICAST>  mtu 1500
        inet 192.168.78.21  netmask 255.255.255.0  broadcast 192.168.78.255
        ether 00:0c:29:1e:fe:ba  txqueuelen 1000  (Ethernet)
        RX packets 202  bytes 23718 (23.1 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 30  bytes 3104 (3.0 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

flags 값 확인
[root@host ~]# ifconfig -a
ens36: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
[root@host ~]# ifdown ens36
장치 'ens36'의 연결이 성공적으로 해제되었습니다.
[root@host ~]# ifconfig -a
ens36: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500

[root@host ~]# ifconfig -a
ens36: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
[root@host ~]# ifconfig ens36 down
[root@host ~]# ifconfig -a
ens36: flags=4098<BROADCAST,MULTICAST>  mtu 1500
  • ifdown <ethernet>
    • flags 값에 변동이 없습니다.
  • ifconfig <ethernet> down
    • flags 값의 RUNNING 값이 빠져 변경 됨

이더넷 플래그 값을 통해 쉘 스크립트나 코드를 작성할 경우 주의해야 합니다.



 

728x90
반응형