FOR TIPS, gUIDES & TUTORIALS

subscribe to our Youtube

GO TO YOUTUBE

14455 questions

17168 answers

28195 comments

0 members

We are migrating to our new platform at https://community.teltonika.lt. Moving forward, you can continue discussions on this new platform. This current platform will be temporarily maintained for reference purposes.
0 votes
154 views 1 comments
by anonymous

Hi, 

I am trying to setup the WAN IP on a RUT240 using the JSON UCI commands.

The request is the following:

{

    "jsonrpc":"2.0", "id":1, "method":"call", "params":

    [

        "{{session_id}}", "uci", "set",

        {

            "config":"network",

            "section":"wan",

            "values":

            {          

                "protocol":"static",                      

                "ipadrr":"192.168.1.1"

            }

        }

    ]

} 

 And I am getting the following response:

{

    "jsonrpc": "2.0",

    "id": 1,

    "result": [

        0

    ]

}

Am I writting my request propperly ?

doesn't result 0 mean that the operation was succesfull?

Thank you in advance

SOLVED:

The problem was not in the request, I needed to commit the change and reload. 

{
    "jsonrpc":"2.0", "id":1, "method":"call", "params":
    [
        "{{session_id}}", "uci", "commit", 
        {
            "config":"network"
        }
    ]
}

1 Answer

0 votes
by anonymous

Hello

May I ask what IP are you looking to change, also what kind of connectivity are you getting

I would like to remind that, you will not be able to change the WAN IP for a mobile connectivity

but for a wired connectivity ,you should be able to change.

also  ,result 0 mean that the operation was not successful. 

Thanks and Regards

Shahl

Best answer
by anonymous

Hello,

Thank you for your answer. 

I would like to change the wired WAN IP. 

By default, it is on dhcp mode and I would like to change it to static and set an IP. 

For the tests I am connected to the LAN, so I won't be having problems if the IP changes.

I have also tried (with no luck) to send all the parameters instead just the value I would like to change as follows: 

{
    "jsonrpc": "2.0",
    "id": 1,
    "result": [
        0,
        {
            "values": {
                ".anonymous": false,
                ".type": "interface",
                ".name": "wan",
                "ifname": "eth1",
                "metric": "1",
                "netmask": "255.255.255.0",
                "delegate": "1",
                "force_link": "0",
                "proto": "static",
                "ipaddr": "192.168.1.4",
                "protocol": "static",
                "ipadrr": "192.168.1.1"
            }
        }
    ]
}

Regarding the result code, I have been looking for its meanings, but I haven't find anything. Do you know where can I find the explanations of each result code?

Thank you and best regards,