Jump to content
  • 0

Как по rci отключить/подключить IPv6 на заданном интерфейсе?


Zeleza
 Share

Question

Собственно вопрос в теме сообщения.
 

Edited by Zeleza
Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0
Posted (edited)

Доброго всем дня,

Памяти ради и науки для, отвечаю сам себе на вопрос в теме.

INFACE_PART_REQUEST='localhost:79/rci/interface'
CMD_LIST="address prefix name-servers"
# ------------------------------------------------------------------------------------------
#
#	Функция вЫключения IPv6
#	$1 - CLI интерфейс
#
# ------------------------------------------------------------------------------------------
ipv6_inface_off(){
	inface="${1}"
	for cmd in ${CMD_LIST}; do
      		curl -s -d '{"auto":true,"no":true}' "${INFACE_PART_REQUEST}/${inface}/ipv6/${cmd}" &> /dev/null
	done
}
# ------------------------------------------------------------------------------------------
#
#	Функция включения IPv6
#	$1 - CLI интерфейс
#
# ------------------------------------------------------------------------------------------
ipv6_inface_on(){
	inface="${1}"
        for cmd in ${CMD_LIST}; do
      		curl -s -d '{"auto":true}' "${INFACE_PART_REQUEST}/${inface}/ipv6/${cmd}" &> /dev/null
        done
}
# ------------------------------------------------------------------------------------------
#
#	Функция проверки статуса IPv6
#	$1 - CLI интерфейс
#	Возвращает:
#	0 - ipv6 подключен
#	1 - ipv6 отключен
#
# ------------------------------------------------------------------------------------------
ipv6_status(){
        inface="${1}"; res=0
        for cmd in ${CMD_LIST}; do
          	[ -n "$(curl -s "${INFACE_PART_REQUEST}/${inface}/ipv6/${cmd}" | grep true )" ] && res=$((res+1))
        done
        if [ "${res}" -eq 3 ]; then echo 0; else echo 1; fi
}

Благодарю за помощь @eralde.

Edited by Zeleza
  • Thanks 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...