sábado, 14 de diciembre de 2019

noip2 en rasbian como servicio

Primero bajamos y construimos el ejecutable:

  $ wget http://www.no-ip.com/client/linux/noip-duc-linux.tar.gz
  $ tar xvf noip-duc-linux.tar.gz
  $ cd noip-2.1.9-1/
  $ make

Después los instalamos:
  $ sudo make install

Ahora nos pedirá los datos de acceso a noip2. Los completamos y terminamos.

Tras ello creamos un servicio para que no tengamos que estar lanzándolo a mano. Creamos el fichero /etc/init.d/noip2 con el siguiente contenido:

#! /bin/sh
# /etc/init.d/noip2

# Supplied by no-ip.com
# Modified for Debian GNU/Linux by Eivind L. Rygge <eivind@rygge.org>
# Updated by David Courtney to not use pidfile 130130 for Debian 6.
# Updated again by David Courtney to "LSBize" the script for Debian 7.

### BEGIN INIT INFO
# Provides:     noip2
# Required-Start: networking
# Required-Stop:
# Should-Start:
# Should-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start noip2 at boot time
# Description: Start noip2 at boot time
### END INIT INFO

# . /etc/rc.d/init.d/functions  # uncomment/modify for your killproc

DAEMON=/usr/local/bin/noip2
NAME=noip2

test -x $DAEMON || exit 0

case "$1" in
    start)
    echo -n "Starting dynamic address update: "
    start-stop-daemon --start --exec $DAEMON
    echo "noip2."
    ;;
    stop)
    echo -n "Shutting down dynamic address update:"
    start-stop-daemon --stop --oknodo --retry 30 --exec $DAEMON
    echo "noip2."
    ;;

    restart)
    echo -n "Restarting dynamic address update: "
    start-stop-daemon --stop --oknodo --retry 30 --exec $DAEMON
    start-stop-daemon --start --exec $DAEMON
    echo "noip2."
    ;;

    *)
    echo "Usage: $0 {start|stop|restart}"
    exit 1
esac
exit 0

Damos permisos de ejecución:

  $ sudo chmod a+rx /etc/init.d/noip2

Comprobamos que todo está bien:

  $ sudo /etc/init.d/noip2 start
  $ sudo noip2 -S
  1 noip2 process active. 

  Process 7065, started as noip2
  Using configuration from /usr/local/etc/no-ip2.conf
  Last IP Address set 230.127.57.182
  Account kayon.toga@togaware.com
  configured for:
          group ktware
  Updating every 30 minutes via /dev/eth0 with NAT enabled.

Finalmente activamos la ejecución automática:

  $ sudo update-rc.d noip2 defaults

y se acabó, con esto debería estar todo hecho.

be happy!




domingo, 24 de noviembre de 2019

Notas Raspbian - Varios memoria y filesystems

Copiado de Raspbian a tarjeta de memoria


#sudo dd bs=1M if=rpi_35_v6_1_2_3_jessie_kernel_4_4_50.img of=/dev/mmcblk0

Congelación del kernel

#sudo apt-mark hold linux-image

Operaciones con memorias usb

Discover the location of a USB drive:

ls /dev/sda*

/dev/sda points to the 1st hard drive
/dev/sda1 If the drive is formatted, points to the drive’s 1st partition
/dev/sda2 If the partition exists, points to the 2nd partition, etc.

To mount a USB drive:

sudo mkdir /mnt/usbdrive
sudo mount /dev/sda1 /mnt/usbdrive
ls /mnt/usbdrive

To list your file systems:

sudo fdisk -l
sudo mount -l
df -h

Before disconnecting a USB drive:

sudo umount /dev/sda1

Format

Format a drive to EXT4
sudo mkfs.ext4 /dev/sda1 -L untitled

Add macOS HFS+ read/write support
sudo apt-get install hfsutils hfsprogs

Format a drive to HFS+
sudo mkfs.hfsplus /dev/sda1 -v untitled

Add Windows NTFS read/write support
sudo apt-get install ntfs-3g

Format a drive to NTFS
sudo mkfs.ntfs /dev/sda1 -f -v -I -L untitled

Add Windows/macOS exFAT read/write support
sudo apt-get install exfat-fuse exfat-utils

Format a drive to exFAT
sudo mkfs.exfat /dev/sda1 -n untitled

Add Windows/DOS FAT32 read/write support
sudo apt-get install dosfstools

Format a drive to FAT32
sudo mkfs.vfat /dev/sda1 -n untitled

Notas Raspbian - ip stática

Hemos de abrir el siguiente fichero:

sudo nano /etc/dhcpcd.conf
Vamos al final de fichero y veremos ejemplos comentados de como hemos de hacerlo.
Estas líneas son un ejemplo de lo que necesitaremos poner:
interface eth0
static ip_address=192.168.0.10/24
static routers=192.168.0.1
static domain_name_servers=192.168.0.1

interface wlan0
static ip_address=192.168.43.233/24
static routers=192.168.0.1
static domain_name_servers=192.168.0.1