Obter Configurações de Rede
Por meio da chamada abaixo é possível obter as configurações de rede.
Requisição - GET
http://192.168.1.201/cgi-bin/configManager.cgi?action=getConfig&name=General
param | type | description |
---|---|---|
getConfig * | String | Comando para obter |
General * | String |
Exemplo de Retorno - text/plain
table.Network.DefaultInterface=eth0
table.Network.Domain=intelbras
table.Network.Hostname=BSC
table.Network.eth0.DefaultGateway=192.168.5.1
table.Network.eth0.DhcpEnable=false
table.Network.eth0.DnsServers[0]=223.5.5.5
table.Network.eth0.DnsServers[1]=223.6.6.6
table.Network.eth0.EnableDhcpReservedIP=false
table.Network.eth0.IPAddress=192.168.5.115
table.Network.eth0.MTU=1500
table.Network.eth0.PhysicalAddress=bc:32:5f:48:59:34
table.Network.eth0.SubnetMask=255.255.255.0
table.Network.eth2.DefaultGateway=192.168.0.1
table.Network.eth2.DhcpEnable=true
table.Network.eth2.DnsServers[0]=223.5.5.5
table.Network.eth2.DnsServers[1]=223.6.6.6
table.Network.eth2.EnableDhcpReservedIP=false
table.Network.eth2.IPAddress=192.168.0.108
table.Network.eth2.MTU=1500
table.Network.eth2.PhysicalAddress=bc:32:5f:48:59:66
table.Network.eth2.SubnetMask=255.255.0.0
Exemplos
import requests
device_ip = '192.168.3.87'
username = 'admin'
password = 'acesso1234'
url = "http://{}/cgi-bin/configManager.cgi?action=getConfig&name=Network".format(
str(device_ip),
)
digest_auth = requests.auth.HTTPDigestAuth(username, password)
rval = requests.get(url, auth=digest_auth, stream=True, timeout=20, verify=False)
print(rval.text)
Habilitar/Desabilitar Servidor DHCP
Requisição - GET
http://192.168.1.201/cgi-bin/configManager.cgi?action=setConfig&Network.eth0.DhcpEnable=false
param | type | description |
---|---|---|
setConfig * | String | Comando para Definir configuração |
DhcpEnable * | Boolean | Ativa ou Desativa o Servidor DHCP |
Exemplo de Retorno - text/plain
OK
Exemplos
import requests
device_ip = '192.168.3.87'
username = 'admin'
password = 'acesso1234'
enable_dhcp = False
url = "http://{}/cgi-bin/configManager.cgi?action=setConfig&Network.eth0.DhcpEnable={}".format(
str(device_ip),
str(enable_dhcp).lower(),
)
digest_auth = requests.auth.HTTPDigestAuth(username, password)
rval = requests.get(url, auth=digest_auth, stream=True, timeout=20, verify=False)
print(rval.text)
Definir Endereço de IP
Requisição - GET
http://192.168.1.201/cgi-bin/configManager.cgi?action=setConfig&Network.eth0.IPAddress=192.168.5.115
param | type | description |
---|---|---|
setConfig * | String | Comando para Definir configuração |
IPAddress * | String | Endereço de IP Exemplo: 192.168.5.115 |
Exemplo de Retorno - text/plain
OK
Exemplos
import requests
device_ip = '192.168.3.87'
username = 'admin'
password = 'acesso1234'
ip_address = '192.168.3.87'
url = "http://{}/cgi-bin/configManager.cgi?action=setConfig&Network.eth0.IPAddress={}".format(
str(device_ip),
str(ip_address),
)
digest_auth = requests.auth.HTTPDigestAuth(username, password)
rval = requests.get(url, auth=digest_auth, stream=True, timeout=20, verify=False)
print(rval.text)