Jump to content

Recommended Posts

Posted

Коллеги, прошу помощи.

Никак не могу сообразить, каков будет аналог команды

ndmq -p "interface PPPoE0 (no)connect via GigabitEthernet1" -P message

на REST API?

Иными словами, нужно передернуть PPPoE подключение.

Posted

Приветствую и прошу помощи:

Как через rest api выполнить запрос ip host my.local 192.168.111.111? Что-то вроде

wget -qO - --post-data='[{"ip":{"host":{"my.local 192.168.111.111"}}}]' http://localhost:79/rci/

но так не работает. И как потом выполнить no ip host my.local?

 

 

Posted
5 часов назад, Geont сказал:

Приветствую и прошу помощи:

Скрытый текст

 

~ # 
~ # wget -qO - localhost:79/rci/ip/host; echo
{
}
~ # 
~ # wget -qO - --post-data='[{"domain":"my.comp1","address":"192.168.1.33"}]' localhost:79/rci/ip/host; echo
[
  {
    "status": [
      {
        "status": "message",
        "code": "22544396",
        "ident": "Dns::Manager",
        "source": "",
        "warning": "no",
        "message": "added static record for \"my.comp1\", address 192.168.1.33."
      }
    ]
  }
]
~ # wget -qO - --post-data='[{"domain":"my.comp2","address":"192.168.1.34"}]' localhost:79/rci/ip/host; echo
[
  {
    "status": [
      {
        "status": "message",
        "code": "22544396",
        "ident": "Dns::Manager",
        "source": "",
        "warning": "no",
        "message": "added static record for \"my.comp2\", address 192.168.1.34."
      }
    ]
  }
]
~ # 
~ # wget -qO - localhost:79/rci/ip/host; echo
[
  {
    "domain": "my.comp1",
    "address": "192.168.1.33"
  },
  {
    "domain": "my.comp2",
    "address": "192.168.1.34"
  }
]
~ # wget -qO - --post-data='[{"no":true,"domain":"my.comp1","address":"192.168.1.33"}]' localhost:79/rci/ip/host; echo
[
  {
    "status": [
      {
        "status": "message",
        "code": "22544397",
        "ident": "Dns::Manager",
        "source": "",
        "warning": "no",
        "message": "deleted record \"my.comp1\", address 192.168.1.33."
      }
    ]
  }
]
~ # wget -qO - localhost:79/rci/ip/host; echo
[
  {
    "domain": "my.comp2",
    "address": "192.168.1.34"
  }
]
~ # wget -qO - --post-data='[{"no":true,"domain":"my.comp2","address":"192.168.1.34"}]' localhost:79/rci/ip/host; echo
[
  {
    "status": [
      {
        "status": "message",
        "code": "22544397",
        "ident": "Dns::Manager",
        "source": "",
        "warning": "no",
        "message": "deleted record \"my.comp2\", address 192.168.1.34."
      }
    ]
  }
]
~ # 
~ # wget -qO - localhost:79/rci/ip/host; echo
{
}
~ # 

 

 

  • Thanks 3
  • TheBB pinned this topic
  • 2 weeks later...
Posted
В 16.09.2021 в 12:23, Geont сказал:

Коллеги, прошу помощи.

Никак не могу сообразить, каков будет аналог команды

ndmq -p "interface PPPoE0 (no)connect via GigabitEthernet1" -P message

на REST API?

Иными словами, нужно передернуть PPPoE подключение.

Включить:

curl -X POST -d '{}' "http://localhost:79/rci/interface/connect?name=PPPoE0&via=ISP"

Выключить:

curl -X DELETE http://localhost:79/rci/interface/connect?name=PPPoE0

  • Thanks 1
Posted

Понадобилось отсканировать документ и... oops! "Саня" (sane) в ступоре:

...
I [Oct  7 13:22:39] saned[4602]: check_host: access by remote host: IP.ADD.RE.SS 
I [Oct  7 13:22:40] saned[4602]: check_host: getaddrinfo for local hostname failed: Temporary failure in name resolution 
I [Oct  7 13:22:40] saned[4602]: init: access by host IP.ADD.RE.SS denied 
I [Oct  7 13:22:40] saned[4602]: saned exiting
...

чиним-с...

Скрытый текст

смотрим

~ # echo $HOSTNAME
KN-1910
~ # 
~ # ping -c 3 $HOSTNAME
ping: bad address 'KN-1910'
~ #

вызываем фиксиков

~ # /opt/etc/init.d/S00fix_hosts start
~ # 
~ # ping -c 3 $HOSTNAME
PING KN-1910 (IP.ADD.RE.SS): 56 data bytes
64 bytes from IP.ADD.RE.SS: seq=0 ttl=64 time=0.684 ms
64 bytes from IP.ADD.RE.SS: seq=1 ttl=64 time=0.463 ms
64 bytes from IP.ADD.RE.SS: seq=2 ttl=64 time=0.550 ms

--- KN-1910 ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max = 0.463/0.565/0.684 ms
~ #

"велосипед"

~ # cat /opt/etc/init.d/S00fix_hosts 
#!/bin/sh

[ "$1" != "start" ] && exit 0

IP="$(wget -qO - localhost:79/rci/show/interface/Home/address | sed 's,",,g')"

if ! ping -c 3 "$(echo $HOSTNAME)" > /dev/null 2>&1; then
    echo "$IP $HOSTNAME" >> /etc/hosts
fi
~ #

 

 

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
Reply to this topic...

×   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.

  • Recently Browsing   0 members

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

Important Information

This site uses cookies. By clicking "I accept" or continuing to browse the site, you authorize their use in accordance with the Privacy Policy.