Controllare lo stato della rete in Linux con networkctl

Mattepuffo's logo
Controllare lo stato della rete in Linux con networkctl

Controllare lo stato della rete in Linux con networkctl

networkctl è un programma di riga di comando che ci consente di vedere lo stato delle schede di rete in Linux.

Fa parte di systemd, ed ha un suo servizio specifico.

Per prima cosa controlliamo se è attivo:

$ systemctl status systemd-networkd

Potete attivarlo così:

$ sudo systemctl start systemd-networkd

Se lo volete attivare all'avvio:

$ sudo systemctl enable systemd-networkd

Detto ciò, per ottenere informazioni generali:

$ networkctl 
IDX LINK   TYPE     OPERATIONAL SETUP    
  1 lo     loopback carrier     unmanaged
  2 enp3s0 ether    routable    unmanaged

2 links listed.

Per avere informazioni in più:

$ networkctl status
● Interfaces: 2, 1
       State: routable                                       
Online state: unknown
     Address: 192.168.0.137 on enp3s0
              2a0e:410:1d28:0:4034:7adf:edbb:401 on enp3s0
              fdd7:21:ae00:3666:beb2:59cf:be0e:df3a on enp3s0
              fe80::227d:7f0f:b2dd:9025 on enp3s0
     Gateway: 192.168.0.1 on enp3s0
              fe80::6ea0:b4ff:fe49:3d21 on enp3s0

mag 13 09:51:16 fermat systemd[1]: Starting Network Configuration...
mag 13 09:51:17 fermat systemd-networkd[11719]: lo: Link UP
mag 13 09:51:17 fermat systemd-networkd[11719]: lo: Gained carrier
mag 13 09:51:17 fermat systemd-networkd[11719]: enp3s0: Link UP
mag 13 09:51:17 fermat systemd-networkd[11719]: enp3s0: Gained carrier
mag 13 09:51:17 fermat systemd-networkd[11719]: enp3s0: Gained IPv6LL
mag 13 09:51:17 fermat systemd-networkd[11719]: Enumeration completed
mag 13 09:51:17 fermat systemd[1]: Started Network Configuration.

Per avere informazioni su una specifica scheda:

$ networkctl status enp3s0
● 2: enp3s0
                   Link File: /usr/lib/systemd/network/99-default.link
                Network File: n/a
                       State: routable (unmanaged)
                Online state: unknown
                        Type: ether
                        Path: pci-0000:03:00.0
                      Driver: r8169
                      Vendor: Realtek Semiconductor Co., Ltd.
                       Model: RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (Onboard Ethernet)
            Hardware Address: 74:d4:35:be:aa:60 (GIGA-BYTE TECHNOLOGY CO.,LTD.)
                         MTU: 1500 (min: 68, max: 9194)
                       QDisc: fq_codel
IPv6 Address Generation Mode: none
    Number of Queues (Tx/Rx): 1/1
            Auto negotiation: yes
                       Speed: 1Gbps
                      Duplex: full
                        Port: tp
                     Address: 192.168.0.137
                              2a0e:410:1d28:0:4034:7adf:edbb:401
                              fdd7:21:ae00:3666:beb2:59cf:be0e:df3a
                              fe80::227d:7f0f:b2dd:9025
                     Gateway: 192.168.0.1
                              fe80::6ea0:b4ff:fe49:3d21

mag 13 09:51:17 fermat systemd-networkd[11719]: enp3s0: Link UP
mag 13 09:51:17 fermat systemd-networkd[11719]: enp3s0: Gained carrier
mag 13 09:51:17 fermat systemd-networkd[11719]: enp3s0: Gained IPv6LL

Enjoy!


Condividi

Commentami!