Skip to content

Useful commands

systemctl

systemctl restart elasticsearch.service
systemctl status elasticsearch.service

journalctl

journalctl -u elasticsearch.service

curl

curl --cacert config/certs/http_ca.crt -u elastic:$ELASTIC_PASSWORD https://localhost:9200

Certificates

The Fingerprint of the http certificate can be obtained with the command:

openssl x509 -fingerprint -sha256 -in /etc/elasticsearch/certshttp_ca.crt

The password for the http.p12 keystore can be obtained with:

/usr/share/elasticsearch/bin/elasticsearch-keystore show xpack.security.http.ssl.keystore.secure_password

for the transport.p12:

/usr/share/elasticsearch/bin/elasticsearch-keystore show xpack.security.transport.ssl.keystore.secure_password

nmcli

Device information

nmcli device show
nmcli -p device show

Individual changes

nmcli con mod enps03 ipv4.addresses "192.168.2.20/24"
nmcli con mod enps03 ipv4.gateway "192.168.2.1"
nmcli con mod enps03 ipv4.dns "8.8.8.8"
nmcli con mod enps03 ipv4.method manual

commit changes

Info

config is written to /etc/sysconfig/network-scripts/ifcfg-enps03

nmcli con up enps03

nmcli shell script

shell script to update network connection
#!/bin/bash

# Replace these values with your actual IP address, DNS, and connection method
#!/bin/bash

# Set your variables
connection_name="YourConnectionName"
new_ip_address="192.168.1.2"
new_dns="8.8.8.8"
new_method="manual"

# Check if NetworkManager is installed
if ! command -v nmcli &> /dev/null; then
    echo "NetworkManager (nmcli) not found. Please install it."
    exit 1
fi

# Check if the connection exists
if ! nmcli connection show --active | grep -q "$connection_name"; then
    echo "Connection '$connection_name' not found or not active."
    exit 1
fi

# Update the connection settings
nmcli connection modify "$connection_name" ipv4.address "$new_ip_address" 
nmcli connection modify "$connection_name" ipv4.dns "$new_dns" 
nmcli connection modify "$connection_name" ipv4.method "$new_method"

# Restart the connection for changes to take effect
nmcli connection down "$connection_name"
nmcli connection up "$connection_name"

echo "Connection '$connection_name' updated successfully."