Information Technology Grimoire

Version .0.0.1

IT Notes from various projects because I forget, and hopefully they help you too.

Link Detection

Interface Details

Every operating system has a different way of giving you information about the network interfaces. Here are some samples of what might work depending on your operating system.

Windows

wmic

wmic nicconfig where "IPEnabled=true" get IPAddress, IPSubnet

Powershell

Get-NetIPAddress | Where-Object { $_.IPAddress -notlike '::*' }
Get-NetAdapter

netsh

netsh interface ip show config
netsh interface show interface

ipconfig (windows)

C:\>ipconfig /all

Ethernet adapter Ethernet:

   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Realtek USB GbE Family Controller
   Physical Address. . . . . . . . . : C8-F7-50-C2-4A-1F
   DHCP Enabled. . . . . . . . . . . : Yes
   Autoconfiguration Enabled . . . . : Yes
   Link-local IPv6 Address . . . . . : fe80::6440:8906:1317:6f83%19(Preferred)
   IPv4 Address. . . . . . . . . . . : 192.168.1.20(Preferred)
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Lease Obtained. . . . . . . . . . : Tuesday, September 21, 2021 7:36:38 PM
   Lease Expires . . . . . . . . . . : Sunday, October 3, 2021 7:36:51 AM
   Default Gateway . . . . . . . . . : 192.168.1.1
   DHCP Server . . . . . . . . . . . : 192.168.1.1
   DHCPv6 IAID . . . . . . . . . . . : 255601712
   DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-27-2A-16-88-9C-B6-D0-C4-62-EB
   DNS Servers . . . . . . . . . . . : 208.67.222.222
                                       8.8.8.8
   NetBIOS over Tcpip. . . . . . . . : Enabled

Wireless LAN adapter Wi-Fi:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . : local.tld
   Description . . . . . . . . . . . : Killer Wireless-n/a/ac 1535 Wireless Network Adapter
   Physical Address. . . . . . . . . : 9C-B6-D0-C4-62-EB
   DHCP Enabled. . . . . . . . . . . : Yes
   Autoconfiguration Enabled . . . . : Yes

Linux

ip addr eth0

5: eth0@if6: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 00:16:3e:13:c8:5b brd ff:ff:ff:ff:ff:ff link-netnsid 0
    inet 100.115.92.202/28 brd 100.115.92.207 scope global eth0
       valid_lft forever preferred_lft forever

ifconfig -a

enp1s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.201  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 fe80::730b:b89a:7199:8851  prefixlen 64  scopeid 0x20<link>
        ether b4:a9:fc:e5:b7:0b  txqueuelen 1000  (Ethernet)
        RX packets 4593373  bytes 3906568360 (3.9 GB)
        RX errors 0  dropped 127  overruns 0  frame 0
        TX packets 4742930  bytes 646304458 (646.3 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

ethtool enp1s0

Settings for enp1s0:
        Supported ports: [ TP MII ]
        Supported link modes:   10baseT/Half 10baseT/Full 
                                100baseT/Half 100baseT/Full 
                                1000baseT/Full 
        Supported pause frame use: Symmetric Receive-only
        Supports auto-negotiation: Yes
        Supported FEC modes: Not reported
        Advertised link modes:  10baseT/Half 10baseT/Full 
                                100baseT/Half 100baseT/Full 
                                1000baseT/Full 
        Advertised pause frame use: Symmetric Receive-only
        Advertised auto-negotiation: Yes
        Advertised FEC modes: Not reported
        Link partner advertised link modes:  10baseT/Half 10baseT/Full 
                                             100baseT/Half 100baseT/Full 
                                             1000baseT/Full 
        Link partner advertised pause frame use: Symmetric
        Link partner advertised auto-negotiation: Yes
        Link partner advertised FEC modes: Not reported
        Speed: 1000Mb/s
        Duplex: Full
        Port: Twisted Pair
        PHYAD: 0
        Transceiver: internal
        Auto-negotiation: on
        MDI-X: Unknown
Cannot get wake-on-lan settings: Operation not permitted
        Link detected: yes

Vendor

show interfaces
show interfaces status

Some network cards are configured to tell you quite a bit of details about their connection. If Link is not Up, or there are errors, it’s worth nothing the lights and their flashing sequence, if any.

There are many ways vendors represent what the meaning of red,amber,green can be. Reviewing them can provide detailed information - for example (just an example):

Status Lights

LED BehaviorMeaning
OffNo power or is in a boot up
Solid GreenCard has valid IP settings
Solid OrangeCard does not have valid IP settings
Flashing GreenCard does not have valid IP settings
Flashing OrangeMaking BootP requests
Alternating SlowCarc is making DHCP request
Alternating FastCard is booting
LED BehaviorMeaning
OffNo power or no network cable or switch is off
Solid GreenOn network that is rated at xxMbps
Solid OrangeOn network that is rated at xxxMbps
Flashing GreenReceiving data at xxMbps
Flashing OrangeReceiving data at XXXMbps