반응형

최근 뭐때문인진 모르겠지만, 갑자기 전기세가 많이 나오고 있어서, 집에서 관리중인 서버도 자는 시간에는 rtcwake를 이용하여 절전모드로 해두고, 혹시나 긴급하게 봐야할 경우에는 wol을 이용하여 제어하는 것으로 계획을 세웠다.

 

rtcwake

  • 자는 시간이 00시부터 08시정도 이므로, 자정에 8시간동안만 절전을 활성화하면 되기 때문에 crontab을 사용하면 된다.
  • 0 0 * * * /usr/sbin/rtcwake -m mem -s 28800

 

wol (wake on lan)

  • 일단 서버가 연결되어 있는 공유기에서 wol을 지원해야 하고, 랜카드에서도 wol을 지원하는지 확인해야 한다.
  • 공유기는 모델명을 확인하여, 각 제조사 사이트에서 찾아봐야 하며, 랜카드의 경우 하드웨어에서는 지원한다고 해도, OS단에서 disable 되어 있는 경우가 있다.
  • 먼저 ifconfig 를 이용하여, 내 랜카드가 어떤 것인지 확인하고, ethtool 명령어를 아래와 같이 입력하여 wol이 설정되어 있는지 본다. 아래에서는 enp3s0이 내 랜카드라고 가정하였고, wol을 지원하고 있다면, Wake-on 란이 g 일것이고, 지원하지 않으면 d일 것이다.)
    • $ /sbin/ethtool enp3s0 
      
      #
      Settings for enp3s0:
              Supported ports: [ TP MII ]
              Supported link modes:   10baseT/Half 10baseT/Full 
                                      100baseT/Half 100baseT/Full 
                                      1000baseT/Full 
              Supported pause frame use: Symmetric Receive-only
              Supports auto-negotiation: Yes
              Supported FEC modes: Not reported
              Advertised link modes:  10baseT/Half 10baseT/Full 
                                      100baseT/Half 100baseT/Full 
                                      1000baseT/Full 
              Advertised pause frame use: Symmetric Receive-only
              Advertised auto-negotiation: Yes
              Advertised FEC modes: Not reported
              Link partner advertised link modes:  10baseT/Half 10baseT/Full 
                                                   100baseT/Half 100baseT/Full 
                                                   1000baseT/Half 1000baseT/Full 
              Link partner advertised pause frame use: No
              Link partner advertised auto-negotiation: Yes
              Link partner advertised FEC modes: Not reported
              Speed: 1000Mb/s
              Duplex: Full
              Port: MII
              PHYAD: 0
              Transceiver: internal
              Auto-negotiation: on
              Supports Wake-on: pumbg
              Wake-on: g
              Current message level: 0x00000033 (51)
                                     drv probe ifdown ifup
      #
  • 만약 Wake-on이 d로 되어 있다면 아래 명령어로 활성화 후 다시 확인해본다.
    • $ /sbin/ethtool -s enp3s0 wol g
  • 다만, 이렇게 명령어로 설정한 경우 재부팅 시에는 적용이 되지 않기 때문에, /etc/network/interface 파일을 열어서 두 줄을 추가해주어야 한다.
    • $ vi /etc/network/interface
      
      # 가장 하단에 아래 두 줄 추가
      post-up /sbin/ethtool -s enp3s0 wol g
      post-down /sbin/ethtool -s enp3s0 wol g

 

반응형
,