Skip to content

Commit

Permalink
Merge pull request #19 from DanieelJP/patch-11
Browse files Browse the repository at this point in the history
Create slapd4_client.sh
  • Loading branch information
DonComProject authored May 30, 2024
2 parents d26fb49 + 759e79e commit 7397b69
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/scripts/slapd4_client.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash

# Verificar si se pasaron los argumentos necesarios
if [ "$#" -ne 3 ]; then
echo "Uso: $0 <interfaz> <nueva_ip> <mascara>"
echo "Ejemplo: $0 enp3s0 192.168.12.200/24"
exit 1
fi

# Asignar los argumentos a variables
INTERFAZ=$1
NUEVA_IP=$2
MASCARA=$3

# Eliminar la IP actual (asumimos que hay una sola)
sudo ip addr flush dev $INTERFAZ

# Asignar la nueva IP con la máscara especificada
sudo ip addr add $NUEVA_IP/$MASCARA dev $INTERFAZ

# Subir la interfaz para aplicar los cambios
sudo ip link set dev $INTERFAZ up

# Mostrar la configuración de la interfaz
ip addr show dev $INTERFAZ

echo "La nueva IP $NUEVA_IP/$MASCARA ha sido asignada a la interfaz $INTERFAZ."

0 comments on commit 7397b69

Please sign in to comment.