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
👋 Just a few little things I noticed when encountering the README for the first time.
Thanks for maintaining this project—it's super useful!
(p.s. This is _absolutely not_ part of Hacktoberfest 😒).
Copy file name to clipboardExpand all lines: README.md
+11-25Lines changed: 11 additions & 25 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,12 +17,13 @@ Kubernetes also uses network namespaces. Kubelets creates a network namespace pe
17
17
18
18
Cool thing about namespaces is that you can switch between them. You can enter a different container's network namespace, perform some troubleshooting on its network's stack with tools that aren't even installed on that container. Additionally, `netshoot` can be used to troubleshoot the host itself by using the host's network namespace. This allows you to perform any troubleshooting without installing any new packages directly on the host or your application's package.
19
19
20
-
***Container's Network Namespace:** If you're having networking issues with your application's container, you can launch `netshoot` with that container's network namespace like this:
20
+
***Container's Network Namespace:** If you're having networking issues with your application's container, you can launch `netshoot` with that container's network namespace like this:
21
21
22
-
`$ docker run -it --net container:<container_name> nicolaka/netshoot`
22
+
`$ docker run -it --net container:<container_name> nicolaka/netshoot`
23
23
24
-
***Host's Network Namespace:** If you think the networking issue is on the host itself, you can launch `netshoot` with that host's network namespace. This is how:
25
-
`$ docker run -it --net host nicolaka/netshoot`
24
+
***Host's Network Namespace:** If you think the networking issue is on the host itself, you can launch `netshoot` with that host's network namespace:
25
+
26
+
`$ docker run -it --net host nicolaka/netshoot`
26
27
27
28
***Network's Network Namespace:** If you want to troubleshoot a Docker network, you can enter the network's namespace using `nsenter`. This is explained in the `nsenter` section below.
28
29
@@ -107,7 +108,7 @@ To troubleshoot these issues, `netshoot` includes a set of powerful tools as rec
107
108
108
109
## iperf
109
110
110
-
Purpose: test networking performance between two containers/hosts.
111
+
Purpose: test networking performance between two containers/hosts.
More info on `tcpdump` can be found [here](http://www.tcpdump.org/tcpdump_man.html).
188
189
189
-
190
-
191
190
## netstat
192
191
193
192
Purpose: `netstat` is a useful tool for checking your network configuration and activity.
@@ -225,7 +224,6 @@ There are several states that ports will be discovered as:
225
224
-`closed`: the pathway to the port is open but there is no application listening on this port.
226
225
-`filtered`: the pathway to the port is closed, blocked by a firewall, routing rules, or host-based rules.
227
226
228
-
229
227
## iftop
230
228
231
229
Purpose: iftop does for network usage what top does for CPU usage. It listens to network traffic on a named interface and displays a table of current bandwidth usage by pairs of hosts.
@@ -287,7 +283,7 @@ perf-test-b. 600 IN A 10.0.3.4 <<<<<<<<<<<<<<<<<<<<<<<<<< Service VIP
287
283
288
284
## netcat
289
285
290
-
Purpose: a simple Unix utility that reads and writes data across network connections, using the TCP or UDP protocol. It's useful for testing and troubleshooting TCP/UDP connections. If there's a firewall rule blocking certain ports, `netcat` can be used to detect
286
+
Purpose: a simple Unix utility that reads and writes data across network connections, using the TCP or UDP protocol. It's useful for testing and troubleshooting TCP/UDP connections. `netcat` can be used to detect if there's a firewall rule blocking certain ports.
291
287
292
288
```
293
289
🐳 → docker network create -d overlay my-ovl
@@ -304,8 +300,7 @@ Connection to service-a 8080 port [tcp/http-alt] succeeded!
304
300
305
301
```
306
302
## netgen
307
-
`netgen` is a simple [script](netgen.sh) that will generate a packet of data between containers periodically using `netcat`. It's purpose is to use the generated traffic to demonstrate different features of the networking stack.
308
-
303
+
Purpose: `netgen` is a simple [script](netgen.sh) that will generate a packet of data between containers periodically using `netcat`. The generated traffic can be used to demonstrate different features of the networking stack.
309
304
310
305
`netgen <host> <ip>` will create a `netcat` server and client listening and sending to the same port.
311
306
@@ -350,7 +345,6 @@ srvc.2.vu47gf0sdmje@moby | Listener started on port 5000
350
345
...
351
346
```
352
347
353
-
354
348
## iproute2
355
349
356
350
purpose: a collection of utilities for controlling TCP / IP networking and traffic control in Linux.
@@ -383,7 +377,6 @@ More info on `iproute2` [here](http://lartc.org/howto/lartc.iproute2.tour.html)
383
377
384
378
Purpose: `nsenter` is a powerful tool allowing you to enter into any namespaces. `nsenter` is available inside `netshoot` but requires `netshoot` to be run as a privileged container. Additionally, you may want to mount the `/var/run/docker/netns` directory to be able to enter any network namespace including bridge and overlay networks.
385
379
386
-
387
380
With `docker run --name container-B --net container:container-A `, docker uses `container-A`'s network namespace ( including interfaces and routes) when creating `container-B`. This approach is helpful for troubleshooting network issues at the container level. To troubleshoot network issues at the bridge or overlay network level, you need to enter the `namespace` of the network _itself_. `nsenter` allows you to do that.
388
381
389
382
For example, if we wanted to check the L2 forwarding table for a overlay network. We need to enter the overlay network namespace and use same tools in `netshoot` to check these entries. The following examples go over some use cases for using `nsenter` to understand what's happening within a docker network ( overlay in this case).
@@ -452,12 +445,11 @@ For example, if we wanted to check the L2 forwarding table for a overlay network
# The overlay network that we created had an id of 9tp0f348donsdj75pktssd97b. All overlay networks are named <number>-<id>. We can see it in the list as `1-9tp0f348do`. To enter it:
462
454
463
455
/ # nsenter --net=/var/run/docker/netns/1-9tp0f348do sh
@@ -564,7 +556,6 @@ br0 8000.0215b8e7deb3 no vxlan1
564
556
veth2
565
557
veth3
566
558
veth4
567
-
568
559
```
569
560
570
561
## CTOP
@@ -573,9 +564,7 @@ ctop is a free open source, simple and cross-platform top-like command-line tool
573
564
574
565
To get data into ctop, you'll need to bind docker.sock into the netshoot container.
575
566
576
-
```
577
-
/ # docker run -it --rm -v /var/run/docker.sock:/var/run/docker.sock nicolaka/netshoot ctop
578
-
```
567
+
`/ # docker run -it --rm -v /var/run/docker.sock:/var/run/docker.sock nicolaka/netshoot ctop`
579
568
580
569

581
570
@@ -585,7 +574,6 @@ It will display running and existed containers with useful metrics to help troub
585
574
586
575
Termshark is a terminal user-interface for tshark. It allows user to read pcap files or sniff live interfaces with Wireshark's display filters.
587
576
588
-
589
577
```
590
578
# Launching netshoot with NET_ADMIN and CAP_NET_RAW capabilities. Capturing packets on eth0 with icmp
@@ -598,8 +586,6 @@ Termshark is a terminal user-interface for tshark. It allows user to read pcap f
598
586
```
599
587
More info on `termshark`[here](https://github.com/gcla/termshark)
600
588
601
-
602
-
## Feedback + Contribution
589
+
## Feedback & Contribution
603
590
604
591
Feel free to provide feedback and contribute networking troubleshooting tools and use-cases by opening PRs. If you would like to add any package, open a PR with the rationale and ensure that you update both the Dockerfile and the README with some examples on how to use it!
0 commit comments