Skip to content

Commit 0a73c00

Browse files
authored
minor cosmetic and wording fixes to README
👋 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 😒).
1 parent 4f4bfa6 commit 0a73c00

File tree

1 file changed

+11
-25
lines changed

1 file changed

+11
-25
lines changed

README.md

Lines changed: 11 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,13 @@ Kubernetes also uses network namespaces. Kubelets creates a network namespace pe
1717

1818
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.
1919

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:
2121

22-
`$ docker run -it --net container:<container_name> nicolaka/netshoot`
22+
`$ docker run -it --net container:<container_name> nicolaka/netshoot`
2323

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`
2627

2728
* **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.
2829

@@ -107,7 +108,7 @@ To troubleshoot these issues, `netshoot` includes a set of powerful tools as rec
107108

108109
## iperf
109110

110-
Purpose : test networking performance between two containers/hosts.
111+
Purpose: test networking performance between two containers/hosts.
111112

112113
Create Overlay network:
113114

@@ -186,8 +187,6 @@ tcpdump: listening on eth0, link-type EN10MB (Ethernet), capture size 262144 byt
186187

187188
More info on `tcpdump` can be found [here](http://www.tcpdump.org/tcpdump_man.html).
188189

189-
190-
191190
## netstat
192191

193192
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:
225224
- `closed`: the pathway to the port is open but there is no application listening on this port.
226225
- `filtered`: the pathway to the port is closed, blocked by a firewall, routing rules, or host-based rules.
227226

228-
229227
## iftop
230228

231229
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.
@@ -243,14 +241,12 @@ ce4ff40a5456 nicolaka/netshoot:latest "iperf -s -p 9999" 5 minute
243241

244242
![iftop.png](img/iftop.png)
245243

246-
247244
## drill
248245

249246
Purpose: drill is a tool to designed to get all sorts of information out of the DNS.
250247

251248
Continuing the `iperf` example, we'll use `drill` to understand how services' DNS is resolved in Docker.
252249

253-
254250
```
255251
🐳 → docker run -it --net container:perf-test-a.1.bil2mo8inj3r9nyrss1g15qav nicolaka/netshoot drill -V 5 perf-test-b
256252
;; ->>HEADER<<- opcode: QUERY, rcode: NOERROR, id: 0
@@ -287,7 +283,7 @@ perf-test-b. 600 IN A 10.0.3.4 <<<<<<<<<<<<<<<<<<<<<<<<<< Service VIP
287283

288284
## netcat
289285

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.
291287

292288
```
293289
🐳 → docker network create -d overlay my-ovl
@@ -304,8 +300,7 @@ Connection to service-a 8080 port [tcp/http-alt] succeeded!
304300
305301
```
306302
## 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.
309304

310305
`netgen <host> <ip>` will create a `netcat` server and client listening and sending to the same port.
311306

@@ -350,7 +345,6 @@ srvc.2.vu47gf0sdmje@moby | Listener started on port 5000
350345
...
351346
```
352347

353-
354348
## iproute2
355349

356350
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)
383377

384378
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.
385379

386-
387380
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.
388381

389382
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
452445
453446
# Listing all docker-created network namespaces
454447
455-
/ # cd /var/run/docker/netns/
448+
/ # cd /var/run/docker/netns/
456449
/var/run/docker/netns # ls
457450
0b1b36d33313 1-9tp0f348do 14d1428c3962 645eb414b538 816b96054426 916dbaa7ea76 db9fd2d68a9b e79049ce9994 f857b5c01ced
458451
1-9r17dodsxt 1159c401b8d8 1a508036acc8 7ca29d89293c 83b743f2f087 aeed676a57a5 default f22ffa5115a0
459452
460-
461453
# 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:
462454
463455
/ # nsenter --net=/var/run/docker/netns/1-9tp0f348do sh
@@ -564,7 +556,6 @@ br0 8000.0215b8e7deb3 no vxlan1
564556
veth2
565557
veth3
566558
veth4
567-
568559
```
569560

570561
## CTOP
@@ -573,9 +564,7 @@ ctop is a free open source, simple and cross-platform top-like command-line tool
573564

574565
To get data into ctop, you'll need to bind docker.sock into the netshoot container.
575566

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`
579568

580569
![ctop.png](img/ctop.png)
581570

@@ -585,7 +574,6 @@ It will display running and existed containers with useful metrics to help troub
585574

586575
Termshark is a terminal user-interface for tshark. It allows user to read pcap files or sniff live interfaces with Wireshark's display filters.
587576

588-
589577
```
590578
# Launching netshoot with NET_ADMIN and CAP_NET_RAW capabilities. Capturing packets on eth0 with icmp
591579
/ # docker run --rm --cap-add=NET_ADMIN --cap-add=CAP_NET_RAW -it nicolaka/netshoot termshark -i eth0 icmp
@@ -598,8 +586,6 @@ Termshark is a terminal user-interface for tshark. It allows user to read pcap f
598586
```
599587
More info on `termshark` [here](https://github.com/gcla/termshark)
600588

601-
602-
## Feedback + Contribution
589+
## Feedback & Contribution
603590

604591
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!
605-

0 commit comments

Comments
 (0)