Handbook:SPARC/Networking/Extending/ko

From Gentoo Wiki
Jump to:navigation Jump to:search
This page is a translated version of the page Handbook:SPARC/Networking/Extending and the translation is 100% complete.
SPARC 핸드북
설치
설치 정보
매체 선택
네트워크 설정
디스크 준비
스테이지 3 설치
베이스 시스템 설치
커널 설정
시스템 설정
도구 설치
부트로더 설정
마무리
젠투 활용
포티지 소개
USE 플래그
포티지 기능
초기화 스크립트 시스템
환경 변수
포티지 활용
파일 및 디렉터리
변수
소프트웨어 브랜치 함께 사용하기
추가 도구
꾸러미 저장소 개별 설정
고급 기능
네트워크 설정
시작하기
고급 설정
모듈러 네트워크
무선 네트워크
기능 추가
동적 관리

기본 함수 훅

시작/멈춤 동작과 관련하여 호출하는 네가지 함수를 /etc/conf.d/net에 정의할 수 있습니다. 이 함수는 인터페이스 이름으로 먼저 호출하여 해당 함수에서 여러 어댑터를 제어할 수 있습니다.

preup()predown() 함수의 반환 값은 인터페이스의 설정 또는 설정 해제를 계속할 수 있다는 의미의 0(성공) 값이어야 합니다. preup()에서 0값이 아닌 값을 반환하면 인터페이스 설정을 멈춥니다. predown()에서 0값이 아닌 값을 반환하면 인터페이스 설정 해제를 계속할 수 없습니다.

postup()postdown() 함수의 반환 값은 실패했을 경우 아무런 조치를 취하지 않기 때문에 무시합니다.

${IFACE}는 올리고 내릴 인터페이스 설정 값입니다. ${IFVAR}는 배시에서 허용하는 변수 이름로 바꾼 ${IFACE}입니다.

파일 /etc/conf.d/netpre/post up/down 함수 예제
preup() {
  # Test for link on the interface prior to bringing it up.  This
  # only works on some network adapters and requires the ethtool
  # package to be installed.
  if ethtool ${IFACE} | grep -q 'Link detected: no'; then
    ewarn "No link on ${IFACE}, aborting configuration"
    return 1
  fi
  
  # Remember to return 0 on success
  return 0
}
  
predown() {
  # The default in the script is to test for NFS root and disallow
  # downing interfaces in that case.  Note that if you specify a
  # predown() function you will override that logic.  Here it is, in
  # case you still want it...
  if is_net_fs /; then
    eerror "root filesystem is network mounted -- can't stop ${IFACE}"
    return 1
  fi
  
  # Remember to return 0 on success
  return 0
}
  
postup() {
  # This function could be used, for example, to register with a
  # dynamic DNS service.  Another possibility would be to
  # send/receive mail once the interface is brought up.
       return 0
}
  
postdown() {
  # This function is mostly here for completeness... I haven't
  # thought of anything nifty to do with it yet ;-)
  return 0
}
참고
함수 작성에 대해 더 알아보려면 /usr/share/doc/netifrc-*/net.example.bz2를 살펴보십시오.

무선 네트워크 도구 함수 훅

참고
이 부분은 WPA Supplicant와 동작하지 않습니다만 ${ESSID}${ESSIDVAR} 변수는 postup() 함수에서 동작하는 변수입니다.

연결 함수와 관련하여 호출하는 두가지 함수를 /etc/conf.d/net에 정의할 수 있습니다. 이 함수는 인터페이스 이름으로 먼저 호출하여 해당 함수에서 여러 어댑터를 제어할 수 있습니다.

preassociate() 함수의 반환 값은 인터페이스 설정 및 설정해제를 계속할 수 있음을 나타내는 0값(성공)이 되어야 합니다. preassociate() 함수에서 0 값이 아닌 값을 반환하면 인터페이스 설정을 멈춥니다.

postassociate() 함수의 반환 값은 실패했을 경우 아무런 조치를 취하지 않기 떄문이 무시합니다.

${ESSID}는 시스템이 연결한 AP에서 제공하는 정확한 ESSID 설정입니다. ${ESSIDVAR}는 배시에서 허용하는 변수 이름으로 바꾼 ${ESSID}입니다.

파일 /etc/conf.d/netpre/post 연결 함수
preassociate() {
  # The below adds two configuration variables leap_user_ESSID
  # and leap_pass_ESSID. When they are both configured for the ESSID
  # being connected to then we run the CISCO LEAP script
  
  local user pass
  eval user=\"\$\{leap_user_${ESSIDVAR}\}\"
  eval pass=\"\$\{leap_pass_${ESSIDVAR}\}\"
  
  if [[ -n ${user} && -n ${pass} ]]; then
    if [[ ! -x /opt/cisco/bin/leapscript ]]; then
      eend "For LEAP support, please emerge net-misc/cisco-aironet-client-utils"
      return 1
    fi
    einfo "Waiting for LEAP Authentication on \"${ESSID//\\\\//}\""
    if /opt/cisco/bin/leapscript ${user} ${pass} | grep -q 'Login incorrect'; then
      ewarn "Login Failed for ${user}"
      return 1
    fi
  fi
  
  return 0
}
  
postassociate() {
  # This function is mostly here for completeness... I haven't
  # thought of anything nifty to do with it yet
  
  return 0
}
참고
${ESSID}${ESSIDVAR}predown()postdown() 함수에서 사용할 수 없습니다.
참고
개별 정의 함수 작성에 대해 더 알아보려면 /usr/share/doc/netifrc-*/net.example.bz2를 살펴보십시오.