Estadísticas del código: Clase para configurar la red en Linux - Python

Imágen de perfil
Val: 666
Bronce
Ha disminuido 1 puesto en Python (en relación al último mes)
Gráfica de Python

Clase para configurar la red en Linux


Python

estrellaestrellaestrellaestrellaestrella(1)
Publicado el 27 de Junio del 2019 por Xavi (548 códigos)
1.059 visualizaciones desde el 27 de Junio del 2019
Clase que permite leer y escribir los archivos de configuración de las interfaces alojados en /etc/network/interfaces.d/

checkInterfacesSource() - Comprueba si el archivo de interfaces tiene una fuente ....
readFiles() - Lee todos los archivos en la carpeta /etc/network/interfaces.d/ y llena el diccionario
getValue() - Obtiene el valor de la interfaz
setValue() - Actualizar o agregar valor
createIface() - crea un iface .... (iface eth0 inet static)
getValueIface() - Obtiene el valor del iface
setValueIface() - Actualizar o agregar un valor en iface
removeIFace() - Eliminar iface
removeInterface() - Eliminar el archivo de la interfaz
save() - Guarda cualquier cambio en los archivos

Un archivo de configuración es similar a:
1
2
3
4
5
6
7
8
auto eth0                       getValue(), setValue()
allow-hotplug eth0              getValue(), setValue()
iface eth0 inet static          createIface(), getValueIface()
    address 192.168.0.102       getValueIface(), setValueIface()
    netmask 255.255.255.0       getValueIface(), setValueIface()
    network 192.168.0.0         getValueIface(), setValueIface()
    broadcast 192.168.0.255     getValueIface(), setValueIface()
    gateway 192.168.0.2         getValueIface(), setValueIface()

23 visualizaciones durante los últimos 90 días


1
0