瀏覽代碼

Linux net stuff

Håvard O. Nordstrand 5 年之前
父節點
當前提交
05ccc293f9
共有 2 個文件被更改,包括 47 次插入11 次删除
  1. 44 10
      config/linux-general/examples.md
  2. 3 1
      config/network/linux.md

+ 44 - 10
config/linux-general/examples.md

@@ -16,11 +16,11 @@ breadcrumbs:
 ### Files
 
 - Find files:
-  - By UID: `find / -user <UID>`
-  - Without a user: `find / -nouser`
-  - With setuid permission bit: `find / -perm /4000`
+    - By UID: `find / -user <UID>`
+    - Without a user: `find / -nouser`
+    - With setuid permission bit: `find / -perm /4000`
 - Recursive search and replace: `find <dir> \( -type d -name .git -prune \) -o -type f -print0 | xargs -0 sed -i 's/123/456/g'`
-  - `-type d -name .git -prune` skips `.git` directories and can be excluded outside of git repos.
+    - `-type d -name .git -prune` skips `.git` directories and can be excluded outside of git repos.
 
 ### Fun
 
@@ -30,12 +30,37 @@ breadcrumbs:
 
 - Find packages depending on the package (APT): `apt rdepends --installed <package>`
 
-### Monitoring
-
-- Monitor system and processes: `htop`
-- Monitor interrupt usage: `irqtop`
-- Monitor network load: `nload`
-- Monitor lots of stuff: `glances`
+### Network
+
+- Monitor usage:
+    - `nload <if>`
+    - `speedometer -t <if> -r <if>`
+      - Prettier than nload.
+      - Multiple interfaces can be specified.
+- Monitor per-process usage:
+    - `nethog`
+- Test throughput:
+    - Internet: `speedtest` (the official one, not `speedtest-cli`)
+    - Internal: `iperf3`
+- Show sockets:
+    - `netstat -tulpn`
+        - `tu` for TCP and UDP, `l` for listening, `p` for protocol, `n` for numerical post numbers.
+    - `ss <options>`
+- Show interface stats:
+    - `ip [-s] link`
+    - `netstat -i`
+- Show interfaces and addresses:
+    - `ip a` (MAC, IPv4, IPv6)
+- Show neighbors:
+    - `ip n`
+- Show routes:
+    - `ip r` & `ip -6 r`
+    - `netstat -r`
+- Show multicast groups:
+    - `netstat -g`
+- Show misc. stats:
+    - `nstat`
+    - `netstat -s` (statistics)
 
 ### Performance and Power Efficiency
 
@@ -52,6 +77,15 @@ breadcrumbs:
 
 - Show CPU vulnerabilities: `tail -n +1 /sys/devices/system/cpu/vulnerabilities/*`
 
+### System
+
+- Monitor system and processes: `htop`
+- Monitor interrupts:
+    - `irqtop`
+    - `watch -n0.1 /proc/interrupts`
+    - 
+- Monitor lots of stuff: `glances`
+
 ## Tasks
 
 ### Burn Windows ISO

+ 3 - 1
config/network/linux.md

@@ -45,6 +45,8 @@ Issues may also be related to stupid things like which ports you're using on the
 
 - Disabling dynamic frequency and voltage scaling (Intel SpeedStep).
 - Disabling multithreading (Intel Hyper-Threading).
-- Make sure network interrupts are distributed across all cores.
+- Disable protocol hardware offloading as it typically causes more problems than it solves.
+- Make sure network interrupts from a given NIC are distributed across all cores.
+    - See `/proc/interrupts`.
 
 {% include footer.md %}