You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Port forwards the remote port to local system through a jumphost.
117
+
# Here, the remote port is port 80 (generally HTTP) and the local
118
+
# port is 8080. This would permit accessing the 'target-system'
119
+
# webserver using the 'http://localhost:8080' URL.
120
+
ssh -N -L 8080:target-system:80 user@jump-system
111
121
```
112
122
113
123
<!-- System Administration: Non-Systemd -->
@@ -414,17 +424,33 @@ $ du -h
414
424
415
425
## Querying Network Information
416
426
417
-
**NOTE:** These commands are listed for diagnostic purposes.
418
-
You probably want to use Network Manager to configure your networking instead.
419
-
See the [next section](#managing-networking-network-manager) for more details.
427
+
**NOTE:** These commands are listed for diagnostic purposes. You probably want to use NetworkManager to
428
+
configure your system's networking instead. See the [next section](#managing-networking-networkmanager) for more details.
420
429
421
-
Most Linux distributions run Network Manager to configure and manage networking nowadays. This is a common point of confusion, as many guides online reference older, network-scripts based network management and the deprecated `ifconfig` command.
430
+
Most Linux distributions run NetworkManager to configure and manage networking nowadays. This is a common point of confusion, as many guides online reference older, network-scripts based network management and the deprecated `ifconfig` command.
422
431
423
432
It is possible to configure networking with variations of these commands. Generally, though, you'll almost always be better off using a tool like `NetworkManager` or `systemd-networkd`, unless you have a very specific use case.
424
433
425
434
For more information, see this [very detailed guide](https://axil.gitlab.io/iproute2/).
426
435
427
-
#### Show Network Interface Link-Layer Info</h3>
436
+
#### Show Network Interface Driver and Firmware
437
+
438
+
```Bash
439
+
# Generally 'ethtool' is not installed on Linux systems by default
440
+
$ ethtool -i enp2s0
441
+
driver: r8169
442
+
version: 6.14.8
443
+
firmware-version: rtl8168h-2_0.0.2 02/26/15
444
+
expansion-rom-version:
445
+
bus-info: 0000:02:00.0
446
+
supports-statistics: yes
447
+
supports-test: no
448
+
supports-eeprom-access: no
449
+
supports-register-dump: yes
450
+
supports-priv-flags: no
451
+
```
452
+
453
+
#### Show Network Interface Link-Layer Info
428
454
429
455
Displays interface status and MAC address. More detailed output is possible by
430
456
using the `-d` option (without the `-br` option).
@@ -439,6 +465,29 @@ enp2s0 DOWN xx:xx:xx:xx:xx:xx <NO-CARRIER,BROADCAST,MULTICAS
439
465
wlan0 UP xx:xx:xx:xx:xx:xx <BROADCAST,MULTICAST,UP,LOWER_UP>
440
466
```
441
467
468
+
#### Show Network Interface Link-Layer Stats
469
+
470
+
Statistics available depend on the device.
471
+
472
+
```Bash
473
+
# Generally 'ethtool' is not installed on Linux systems by default
474
+
$ ethtool -S enp2s0
475
+
NIC statistics:
476
+
tx_packets: 0
477
+
rx_packets: 0
478
+
tx_errors: 0
479
+
rx_errors: 0
480
+
rx_missed: 0
481
+
align_errors: 0
482
+
tx_single_collisions: 0
483
+
tx_multi_collisions: 0
484
+
unicast: 0
485
+
broadcast: 0
486
+
multicast: 0
487
+
tx_aborted: 0
488
+
tx_underrun: 0
489
+
```
490
+
442
491
#### Show Network Interface IP-Layer Info
443
492
444
493
These commands display IPv4 and IPv6 information in addition to other detailed information including interface status, MAC address, MTU, and interface routing table, among other things (some of which require `-d` option). More detailed output is possible by using the `-d` option (without the `-br` option).
@@ -493,6 +542,28 @@ cache
493
542
$ ip route show table 10
494
543
```
495
544
545
+
```Bash
546
+
# Shorthand is 'ip r'. Will show all IPv4 routing tables.
547
+
# The '169.254.0.0/16' route is link-local IPv4 and is mostly default.
548
+
$ ip route
549
+
default via 10.199.0.1 dev wlan0 proto dhcp metric 600
550
+
10.199.0.0/20 dev wlan0 proto kernel scope link src 10.199.4.142 metric 600
551
+
169.254.0.0/16 dev wlan0 scope link metric 1000
552
+
553
+
# Show IPv6 routing tables only
554
+
$ ip -6 route
555
+
::1 dev lo proto kernel metric 256 pref medium
556
+
fe80::/64 dev wlan0 proto kernel metric 1024 pref medium
557
+
558
+
# Determine what route traffic will take for a specific address, here '8.8.8.8'
559
+
$ ip route get 8.8.8.8
560
+
8.8.8.8 via 10.199.0.1 dev wlan0 src 10.199.4.142 uid 1000
561
+
cache
562
+
563
+
# Show routes in routing table 10
564
+
$ ip route show table 10
565
+
```
566
+
496
567
#### Show Open Sockets (Existing Connections)
497
568
498
569
I typically use this as `ss -tulpn` and `grep` for what I want. If you run as root (e.g. with `sudo`), you will also see the program that is using the socket.
At a high level, Network Manager configures 'connections' which are established using a backing network interface, or in Network Manager terms, 'device'. These network interfaces are either managed or unmanaged from Network Manager's perspective.
590
+
At a high level, NetworkManager configures 'connections' which are established using a backing network interface, or in NetworkManager terms, 'device'. These network interfaces are either managed or unmanaged from NetworkManager's perspective.
520
591
521
-
Generally, most users will be fine with Network Manager configuring all of their
522
-
network interfaces, typically only WiFi and Ethernet (although Network Manager can do much more). There are times, though, where it is appropriate to have Network Manager[ignore specific interfaces](#set-device-management), for example, when doing [WiFi packet capture](@/blog/2023-10-wifi-packet-capture.md).
592
+
Generally, most users will be fine with NetworkManager configuring all of their
593
+
network interfaces, typically only WiFi and Ethernet (although NetworkManager can do much more). There are times, though, where it is appropriate to have NetworkManager[ignore specific interfaces](#set-device-management), for example, when doing [WiFi packet capture](@/blog/2023-10-wifi-packet-capture.md).
523
594
524
-
This section details some of the most basic and more-useful (from my perspective) NetworkManager CLI commands. See `man nmcli-examples` for more examples and more advanced usage of Network Manager.
595
+
This section details some of the most basic and more-useful (from my perspective) NetworkManager CLI commands. See `man nmcli-examples` for more examples and more advanced usage of NetworkManager.
525
596
526
597
#### Show All Devices
527
598
528
-
Shows all Network Manager-tracked network devices, including both devices
529
-
that are managed and unmanaged by Network Manager.
599
+
Shows all NetworkManager-tracked network devices, including both devices
600
+
that are managed and unmanaged by NetworkManager.
530
601
531
602
```Bash
532
603
# Shorthand shown. Full command is 'nmcli device'
@@ -619,7 +690,7 @@ $ nmcli c m SSID_NAME \
619
690
620
691
## Querying WiFi Information
621
692
622
-
**NOTE:** Most Linux systems use Network Manager to manage and configure networking, including WiFi. See the [Managing Networking](#managing-networking-network-manager) section for more details.
693
+
**NOTE:** Most Linux systems use NetworkManager to manage and configure networking, including WiFi. See the [Managing Networking](#managing-networking-networkmanager) section for more details.
623
694
624
695
On Linux WiFi interfaces are created using a parent radio device, referred to as 'phys'. These radios come in a variety of form factors, including single radio, single phy and single radio, multi-phy. To view all system phys, run `ls /sys/class/ieee80211/`, which lists all `ieee80211` devices (WiFi phys). Supported interfaces, combinations, and settings depend on the radio firmware and associated Linux device driver. By default, a single WiFi interface is created per phy on system boot in 'managed' mode (WiFi station).
625
696
@@ -630,7 +701,6 @@ While most will be content with `NetworkManager` managing their WiFi interface s
630
701
Includes STA MAC, SSID, phy device, channel, frequency, transmit power.
631
702
632
703
```Bash
633
-
# Can also run 'iw dev wlan0 info', but 'dev' is optional
634
704
$ iw wlan0 info
635
705
Interface wlan0
636
706
ifindex 3
@@ -652,8 +722,9 @@ Interface wlan0
652
722
Includes AP MAC (if station), SSID, frequency, bandwidth, RSSI (if station), and phy rate (MCS),
653
723
among other things. Phy rate may or may not include NSS.
654
724
725
+
I often run this command in a loop while doing other testing using the commands in [this section](#run-command-every-n-seconds).
726
+
655
727
```Bash
656
-
# Can also run 'iw dev wlan0 link', but 'dev' is optional
657
728
# Anonymized MAC here is the AP's BSSID
658
729
$ iw wlan0 link
659
730
Connected to xx:xx:xx:xx:xx:xx (on wlan0)
@@ -670,6 +741,54 @@ Connected to xx:xx:xx:xx:xx:xx (on wlan0)
670
741
beacon int: 100
671
742
```
672
743
744
+
#### Show WiFi Interface Station Information
745
+
746
+
**NOTE:** This command will only show meaningful output when the WiFi interface is connected (associated).
747
+
748
+
This is effectively a combination of the `iw wlan0 info` and `iw wlan0 link` commands. For station interfaces,
749
+
this lists information related to the AP the station is associated with. In 802.11 terminology,
750
+
the station and AP are both stations, with the former (e.g. phone, laptop) being a non-AP station.
751
+
752
+
For AP interfaces, this list information for all stations associated to that AP interface.
0 commit comments