search cancel

How do I configure network settings over console, or by command line?

book

Article ID: 254904

calendar_today

Updated On:

Products

AppNeta

Issue/Introduction

You may need to factory reset your appliance causing you to loose your IP settings.  In some circumstance you may need to resort to using the monitoring points console settings or command line (cli).

curl -ku admin -X POST -H "Content-Type: application/json" -d '{"name": "eth0", "family": "inet", "method": "dhcp"}' 'https://127.0.0.1/api/v1/interface/'

Environment

AppNeta Monitoring points:

Most models (M35, M50, M70, R90, R1000) use the following serial ports settings:  115200-8-N-1
Speed = 115200 Data bits = 8 Stop bits = 1 Parity = None Flow control = XON/XOFF

Some legacy appliance (M30, R45) use:  19200-8-N-1

Resolution

Factory default settings on AppNeta monitoring points will set the the Primary Network Connection interface (typically Eth0) to use DHCP. 
After a factory reset, the admin password for the monitoring point is:

appneta.admin

In circumstances where you may need to set Static IP's on various interfaces, the commands to set the interfaces are found below.

In our example, we'll use the following:

Interface: Eth0
IP: 192.168.1.100
Mask: 255.255.255.0
Default Gateway:  192.168.1.1

1.  Add the static IP on eth0:

curl -k -u admin -X POST -H "Content-Type: application/json" -d '{"name": "eth0", "family": "inet", "method": "static", "address":"192.168.1.100", "netmask":"255.255.255.0", "gateway":"192.168.1.1"}' 'https://127.0.0.1/api/v1/interface/'

You should be prompted for the admin password for the appliance.

2.  Changes to interfaces need to be followed by a Network Restart:

curl -k -u admin -X PUT -H 'Content-Type: application/json' -d {} 'https://127.0.0.1/api/v1/service/networking/?action=restart'

or

sudo systemctl restart networking

 

3.  Similarly you can change an interface to use DHCP.
Change eth0 to use DHCP:

curl -ku admin -X POST -H "Content-Type: application/json" -d '{"name": "eth0", "family": "inet", "method": "dhcp"}' 'https://127.0.0.1/api/v1/interface/'


4.  Interfaces can also be deleted using the following command, which is removing the eth1 interface:

curl -k -u admin -X DELETE -H 'Accept: application/json' 'https://127.0.0.1/api/v1/interface/eth1/?family=inet'

5.  If you configured a second interface, you may need to set that interface to be the Default Interface:

curl -ku admin -X PUT "https://127.0.0.1/api/v1/interface/eth0.2/?action=setdefault" -H "accept: application/json" -H "Content-Type: application/json" -d "{}"

 

Additional Information


-  Remember to restart networking after any change; you need to apply settings
-  All commands can be changed to reflect other interfaces, such as the command below to set 192.168.1.101 to eth1.  Please also note in this example that we are sending the curl command to 'localhost' in place of 127.0.0.1

curl -k -u admin -X POST -H "Content-Type: application/json" -d '{"name": "eth1", "family": "inet", "method": "static", "address":"192.168.1.101", "netmask":"255.255.255.0", "gateway":"192.168.1.1"}' 'https://localhost/api/v1/interface/'

*VLAN interfaces can also be created using the same methods

Once you have configure the IP, you can use command line to perform ping tests, and ultimately log into the monitoring point's WebUI through its configured IP:
Example:  http://192.168.1.100/