Corgi Dog Bark

ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • NM CLI 명령어 사용법 정리
    뜯고 또 뜯어보는 컴퓨터/컴퓨터 OS 2022. 1. 11. 22:47
    반응형

    NM CLI

    nmcli 명령어는 Gnome 프로젝트에 나와있듯이 네트워크를 관리해주는 툴입니다. 

     

     

    SYNOPSIS

    명령어 자체는 단순하게 되어 있으며, 다음과 같이 사용된다.

    nmcli [Options 옵션] {help | general | networking | radio 등등 택1} [Command 명령어] [Args..]

     

     

    DESCRIPTION

    nm cli 는 네트워킹 관리를 위한 커맨드라인 도구이며, 네트워크의 상태를 보여줄 수 있습니다. 또 다른 GNOME 프로젝트인 nm-applet 을 대신할 수 있으며, 다른 GUI를 대신 할 수 있습니다. 몇가지 전형적인 예시가 있는데, 

      - 스크립트 : script 프로세싱으로 손쉽게 네트워크 관리를 할 수 있도록 도와줍니다.

      - 서버, headless machine(ex, ssh), 터미널 : nmcli 는 다음과 같이 GUI 가 없는 상황에서 손쉽게 네트워크를 창조, 수정, 시작 , 멈출 수 있도록 명령어를 제공하여 줍니다.

     

     

    OPTIONS

    -  -a / -c / -e /-f / -g / -h 등의 다양한 옵션이 존재하고 있음. 공식문서 참조.

     

    COMMANDS

    1. 네트워킹 컨트롤 commands :
      // 네트워크를 킬지 끌지, 연결상태를 확인하고 싶을 때 사용.
      nmcli networking {on / off / connectivity 중 택1} [Args..]
      
      // ex ) 네트워크를 끌 때, nmcli networking off​
       
    2.  radio control 명령어 :
      // radio 스위치의 상태를 보여주고, 켤 지, 끌지를 결정할 수 있다.
      
      nmcli radio { all | wifi | wwan } [ARGUMENTS...]
      
      // wifi 설정이 궁금하다 
      	nmcli radio wifi​
    3.  Connection Management 명령어 :
      //사용법: Connection 명령어는 네트워크의 Config 파일 즉, 연결에 대한 설정파일을 담고 있다. 따라서 
      //       (Layer 2 요소라든가 IP 주소값 등등) 을 나타낸다. 
      
      nmcli connection { show | up | down | modify | add | edit | clone | delete | monitor | reload | load | import | export } [ARGUMENTS...]​
    4. Device Management 명령어 :
      // 말 그대로 , 장치를 제어하기 위한 명령어 집합이다.
      
      nmcli device { status | show | set | connect | reapply | modify | disconnect | delete | monitor | wifi | lldp 중 택 1} [ARGUMENTS...]
      
      // ex1) nmcli device status : 현재 연결되어 있는 디바이스 의 상태들을 보여준다 .
      // ex2) nmcli dev wifi : 네트워크 매니저에 의해 wifi access 포인트들을 보여준다. 
      // ex3) nmcli dev wifi con "<네트워크 이름>" : <네트워크 이름> 의 wifi 네트워크 에 연결한다.​

     

    - 그 외 명령어들 집합 

    nmcli -t -f RUNNING general		tells you whether NetworkManager is running or not.
    
    nmcli -t -f STATE general		shows the overall status of NetworkManager.
    
    nmcli radio wifi off		switches Wi-Fi off.
    
    nmcli connection show		lists all connections NetworkManager has.
    
    nmcli -p -m multiline -f all con show		shows all configured connections in multi-line mode.
    
    nmcli connection show --active		lists all currently active connections.
    
    nmcli -f name,autoconnect c s		shows all connection profile names and their auto-connect property.
    
    nmcli -p connection show "<연결 종류 : Connection >"		shows details for "<연결 종류 : Connection >" connection profile.
    예) nmcli -p connection show "docker0"
    
    nmcli --show-secrets connection show "<wifi 이름>"		shows details for "My Home Wi-Fi" connection profile with all passwords. Without --show-secrets option, secrets would not be displayed.
    예) nmcli --show-secrets connection show "olleh_GiGA_WiFi_<>"
    
    nmcli -f profile con s "My wired connection"		shows static configuration details of the connection profile with "My wired connection" name.
    
    nmcli -p con up "My wired connection" ifname eth0		activates the connection profile with name "My wired connection" on interface eth0. The -p option makes nmcli show progress of the activation.
    
    nmcli con up 6b028a27-6dc9-4411-9886-e9ad1dd43761 ap 00:3A:98:7C:42:D3		connects the Wi-Fi connection with UUID 6b028a27-6dc9-4411-9886-e9ad1dd43761 to the AP with BSSID 00:3A:98:7C:42:D3.
    
    nmcli device status		shows the status for all devices.
    
    nmcli dev disconnect em2		disconnects a connection on interface em2 and marks the device as unavailable for auto-connecting. As a result, no connection will automatically be activated on the device until the device's 'autoconnect' is set to TRUE or the user manually activates a connection.
    
    nmcli -f GENERAL,WIFI-PROPERTIES dev show wlan0		shows details for wlan0 interface; only GENERAL and WIFI-PROPERTIES sections will be shown.
    
    nmcli -f CONNECTIONS device show wlp3s0		shows all available connection profiles for your Wi-Fi interface wlp3s0.
    
    nmcli dev wifi		lists available Wi-Fi access points known to NetworkManager.
    
    nmcli dev wifi con "Cafe Hotspot 1" password caffeine name "My cafe"		creates a new connection named "My cafe" and then connects it to "Cafe Hotspot 1" SSID using password "caffeine". This is mainly useful when connecting to "Cafe Hotspot 1" for the first time. Next time, it is better to use nmcli con up id "My cafe" so that the existing connection profile can be used and no additional is created.
    
    nmcli -s dev wifi hotspot con-name QuickHotspot		creates a hotspot profile and connects it. Prints the hotspot password the user should use to connect to the hotspot from other devices.
    
    nmcli wifi device list
    nmcli device wifi connect [SSID] password [Password]

     

     

    - NM CLI 명령어는 다양한 네트워킹 command 가 가능하므로, 여러가지 cli 를 활용해서 활용하길 바라겠습니다. 

    반응형

    '뜯고 또 뜯어보는 컴퓨터 > 컴퓨터 OS' 카테고리의 다른 글

    프로세스란 in LINUX  (0) 2022.01.14

    댓글

Designed by Tistory.