Modify Network Settings from CLI

Hello,

Is it possible to edit the IP address source (DHCP/Static), IP address and other network settings from the CLI on a TP600? I am familiar with the CBM on the PFC200, but cannot find the correct configuration file to make these adjustment from a terminal.

Thanks!

Hello MikePsaltis,
You can use the Wago-Config-Tools which you can find in this Path: /etc/config-tools/ on the TP600 or PFC you get access to functions which are used by the WBM and CBM.
you can run the scripts with an “-h” to get an description

2 Likes

Just a hint here : every action in the WBM is done using a script in config-tools.
When I want to get the corresponding script call to an action in WBM, I do it in the WBM, and then I go to the log file /var/log/sudo.log to get it.
Exemple when setting static IP

Be careful sometimes a simple click requires the call of several scripts.

4 Likes

I have found that the simplest way to do this for the CC100 is to directly change the netconfd.json in /etc/specific/
I assume the same thing works for the TP600/PFC200

I automate a lot of this stuff using bash scripts that I run on a connected machine.
Here is a snippet from one of them:

#!/bin/bash

echo "Setting IP"

#Command may not complete before SSH connection breaks, therefore a timeout is used.

timeout 10s sshpass -p 'wago' ssh root@192.168.1.17 "echo '
{
  \"bridge-config\": {
    \"br0\": [
      \"X1\",
      \"X2\"
    ]
  },
  \"ip-config\": {
    \"br0\": {
      \"bcast\": \"192.168.1.255\",
      \"ipaddr\": \"192.168.1.10\",
      \"netmask\": \"255.255.255.0\",
      \"source\": \"static\"
    }
  }
}' > /etc/specific/netconfd.json && sudo /etc/init.d/netconfd restart; exit"

If you want to do the same thing manually you just ssh into the controller and open the netconfd.json in vim/nano and change what you want to change. Just remember to run the “sudo /etc/init.d/netconfd restart” command to apply the changes.

edit: Oh, and also the SSH connection might hang when you apply the settings, seeing as you change the IP and all :grin:

4 Likes