@@ -169,7 +169,7 @@ Once the development environment is running:
169169 ` ` ` bash
170170 curl http://127.0.0.1:8080
171171 ` ` `
172- This should return "Hello, World!" , confirming that the NAT is working correctly and the job's HTTP server is accessible.
172+ This should return the content of the queries gainst google dns , confirming that the NAT is working correctly and the job's HTTP server is accessible.
173173
1741744. Check the job logs in the Nomad UI. You should see :
175175 - Successful DNS queries to 8.8.8.8 (Google's primary DNS server)
@@ -181,11 +181,51 @@ This behavior demonstrates that the CNI Outbound Plugin is correctly applying th
181181
182182# # The cni-outbound-job
183183
184- The `cni-outbound-job.hcl` file defines a Nomad job that :
185- - Sets up a simple HTTP server on port 8080
184+ The `cni-outbound-job.hcl` file defines a Nomad job named "dig-outbound-job" that :
185+
186+ - Sets up a simple HTTP server using busybox httpd on port 8080
186187- Performs periodic DNS lookups to 8.8.8.8 and 8.8.4.4
188+ - Writes the output of these DNS lookups to an HTML file served by the HTTP server
189+
190+ Here are the key components of the job :
191+
192+ 1. **Network Configuration** :
193+ - Uses the CNI network mode with "my-network" configuration
194+ - Sets up a static port 8080
195+
196+ 2. **Task Configuration** :
197+ - Uses the `exec` driver to run a bash script
198+ - The script is defined inline using a template
199+
200+ 3. **Script Functionality** :
201+ - Sets up a busybox httpd server on port 8080
202+ - Creates a web root directory and an initial index.html file
203+ - Performs DNS lookups in a loop :
204+ - Queries google.com using 8.8.8.8 (Google's primary DNS)
205+ - Queries google.com using 8.8.4.4 (Google's secondary DNS)
206+ - Writes the output of these queries to the index.html file
207+ - Sleeps for 60 seconds between lookups
208+
209+ This job helps verify the CNI Outbound Plugin's functionality by demonstrating allowed and blocked outbound traffic. You can observe the results by :
210+
211+ 1. Accessing the HTTP server at `http://127.0.0.1:8080`
212+ 2. Checking the job logs in the Nomad UI
213+
214+ You should see :
215+ - Successful DNS queries to 8.8.8.8
216+ - Failed DNS queries to 8.8.4.4
217+
218+ This behavior confirms that the CNI Outbound Plugin is correctly applying the outbound rules :
219+ - Allowing traffic to 8.8.8.8
220+ - Blocking traffic to 8.8.4.4
221+
222+ To run this job :
223+
224+ ` ` ` bash
225+ NOMAD_ADDR=http://127.0.0.1:4646 nomad job run cni-outbound-job.hcl
226+ ` ` `
187227
188- This job helps verify the CNI Outbound Plugin's functionality by demonstrating allowed and blocked outbound traffic .
228+ After running the job, you can monitor its progress and results through the Nomad UI or by accessing the HTTP server it sets up .
189229
190230# # Network Troubleshooting
191231
0 commit comments