UncleNUC Wiki

Second chance for NUCs

User Tools

Site Tools


network_testing_pc

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
network_testing_pc [2021/09/12 17:37] – updated usernetwork_testing_pc [2021/09/13 16:21] (current) – updated user
Line 16: Line 16:
     * iPerf server     * iPerf server
     * Web server with sample pages for testing using wrk, wget, etc.     * Web server with sample pages for testing using wrk, wget, etc.
 +
 +Ideas:
 +  * JTest to the server
 +  * Testing NUCs with 2.5Gb capable interfaces
  
 If you are looking for a serious packet generator to test firewalls (e.g. an IMIX benchmark), use  [[https://levelup.gitconnected.com/building-a-high-performance-linux-based-traffic-generator-with-dpdk-93bb9904416c|DPDK and Pktgen]]. A NUC isn't going to be able to drive traffic like a fully-featured packet generator. If you are looking for a serious packet generator to test firewalls (e.g. an IMIX benchmark), use  [[https://levelup.gitconnected.com/building-a-high-performance-linux-based-traffic-generator-with-dpdk-93bb9904416c|DPDK and Pktgen]]. A NUC isn't going to be able to drive traffic like a fully-featured packet generator.
  
-====== Server Setup ======+====== Setup ====== 
 +===== Server Setup =====
 Ubuntu 20.04 LTS is a solid server. The following is a "medium" difficult tutorial to configure it. We install our tools then turn it into a router. Ubuntu 20.04 LTS is a solid server. The following is a "medium" difficult tutorial to configure it. We install our tools then turn it into a router.
  
Line 37: Line 42:
     * sudo apt update && sudo apt upgrade -y     * sudo apt update && sudo apt upgrade -y
     * sudo apt install net-tools wireless-tools iftop wpasupplicant -y     * sudo apt install net-tools wireless-tools iftop wpasupplicant -y
-  - Limit the timeout to connect to the network to 15 seconds instead of some 2 minutes 
-    * ''sudo /usr/lib/systemd/systemd-networkd-wait-online --timeout=15'' 
-    * **NOT WORKING YET** 
   - Install iperf server as a service   - Install iperf server as a service
     * We are using iPerf (iPerf4) instead of iPerf3 (which does not support multithreading)     * We are using iPerf (iPerf4) instead of iPerf3 (which does not support multithreading)
Line 54: Line 56:
 </code> </code>
     * sudo chmod 644 /etc/systemd/system/iperf.service     * sudo chmod 644 /etc/systemd/system/iperf.service
 +    * sudo systemctl daemon-reload
     * sudo systemctl start iperf     * sudo systemctl start iperf
     * sudo systemctl status iperf     * sudo systemctl status iperf
Line 92: Line 95:
     * sudo chown -R www-data /var/www/html     * sudo chown -R www-data /var/www/html
   - Convert to static IP and DHCP server   - Convert to static IP and DHCP server
 +    * sudo vi /etc/netplan/00-installer-config.yaml
 +      * under the interface add
 +        * optional: yes
     * sudo cp /etc/netplan/00-installer-config.yaml /etc/netplan/99-config.yaml     * sudo cp /etc/netplan/00-installer-config.yaml /etc/netplan/99-config.yaml
     * sudo vi /etc/netplan/99-config.yaml     * sudo vi /etc/netplan/99-config.yaml
Line 101: Line 107:
   ethernets:   ethernets:
     <interfacename>:     <interfacename>:
-    dhcp4: no +      optional: yes 
-    addresses: +      dhcp4: no 
-      - 192.168.178.1/24 +      addresses: 
-    gateway4: 192.168.178.1 +        - 192.168.178.1/24 
-    nameservers: +      gateway4: 192.168.178.1 
-      search: [localdomain] +      nameservers: 
-      addresses: [192.168.178.1]+        search: [localdomain] 
 +        addresses: [192.168.178.1]
 </code> </code>
     * NOTE: the unusual subnet was chose so as not to collide with commonly used network addresses     * NOTE: the unusual subnet was chose so as not to collide with commonly used network addresses
 +    * NOTE: adding optional: yes will boot the server quickly even if there is no network link, but your DHCP server will not come up with the network being up. We add a crude watchdog later.
     * TIP: don't run "sudo netplan apply" yet. If you do, connectivity to your network will be lost.     * TIP: don't run "sudo netplan apply" yet. If you do, connectivity to your network will be lost.
   - Install dhcp server   - Install dhcp server
Line 147: Line 155:
       * ssh 192.168.178.1       * ssh 192.168.178.1
   - Auto restart DHCP server   - Auto restart DHCP server
-    * If the server boots with a link up on the interface, after about 2 minutes it will boot without the network. This means you DHCP server will not start+    * If the server boots without a link on the network interface, the DHCP server will not start. Adding a basic watchdog for the DHCP server to start or restart it.
     * Add script /usr/local/bin/service.sh     * Add script /usr/local/bin/service.sh
     * <code>     * <code>
Line 162: Line 170:
       * sudo chmod +x /usr/local/bin/service.sh       * sudo chmod +x /usr/local/bin/service.sh
     * Add the script to your root crontab to run every 2 minutes     * Add the script to your root crontab to run every 2 minutes
-      * ''*/2 * * * * /usr/local/bin/service.sh isc-dhcp-server//+      * ''*/2 * * * * /usr/local/bin/service.sh isc-dhcp-server'' 
 +    * Or every minute 
 +      * ''* * * * * /usr/local/bin/service.sh isc-dhcp-server'' 
 +    * Look up "Ubuntu watchdog service" for using a proper service watchdog
   - If you have more that one interface and want to enable routing across these interfaces   - If you have more that one interface and want to enable routing across these interfaces
     * temporary     * temporary
Line 171: Line 182:
       * sudo sysctl -p       * sudo sysctl -p
  
-====== Updating the Server ======+===== Setting Up the Workstation ===== 
 +I like to set up a laptop with a wired ethernet connection for this testing. A Windows workstation with WSL2 and Ubuntu is my preferred method. However, you don't need a virtual server to run the HTML5 speed test and iperf. 
 + 
 +==== HTML5 SpeedTest ==== 
 +Point your browser the to IP address of the server. Click Start. 
 + 
 +Results testing a high speed and low latency connection will likely vary wildly, even from test to test. 
 + 
 +{{::screenshot-librespeed.png?400|}} 
 + 
 +==== iperf ==== 
 +//See [[https://iperf.fr/]]// 
 + 
 +Linux and WSL2 on windows: sudo apt install iperf 
 + 
 +Or download the Windows binary. 
 + 
 +Tests to run: 
 +  * iperf -c <serverip> 
 +  * iperf -c <serverip> -P 4 
 +  * iperf -c <serverip> -e 
 + 
 +-P 4 selects 4 parallel threads 
 + 
 +-e selects enhanced reporting 
 + 
 +==== wrk ==== 
 +Instructions are for a Linux environment such as WSL2 on Windows. 
 + 
 +Prior to installation you will want to: 
 +  * sudo apt install build-essential unzip 
 + 
 +See [[https://github.com/wg/wrk]] 
 + 
 +Instructions: 
 +  - cd ~ 
 +  - git clone https://github.com/wg/wrk.git 
 +  - cd wrk 
 +  - make 
 +    * the usual ''sudo make install'' is apparently not needed 
 + 
 +Example commands: 
 +  * <code> 
 +./wrk -t2 -c50 -d30s http://<ip address>/wrk/index.html 
 +./wrk -t2 -c50 -d30s http://<ipaddress>/wrk/demo.borland.com/testsite/stadyn_largepagewithimages.html 
 +./wrk -t2 -c50 -d30s http://<ipaddress>/wrk/1kb.bin 
 +./wrk -t2 -c50 -d30s http://<ipaddress>/wrk/1mb.bin 
 +</code> 
 + 
 +-t 2 assigned 2 threads 
 + 
 +-c50 assigns 50 connections 
 + 
 +-d assigns 30 second duration 
 + 
 +==== wget ==== 
 +Pull one or more files from the web server. Note that the recursion flag (-r) cannot be used with a special file like /dev/null. 
 + 
 +Installation: 
 +  * Linux - apt install wget 
 +  * Windows - https://www.gnu.org/software/wget/ 
 + 
 +<code> 
 +wget http://127.0.0.1/wrk/demo.borland.com/testsite/stadyn_largepagewithimages.html -O /dev/null 
 +wget -r http://127.0.0.1/wrk/demo.borland.com/testsite/stadyn_largepagewithimages.html -O /tmp/blob.fil 
 +</code> 
 +====== How to Use ====== 
 +  - Test direct connection from test workstation to the server 
 +    * HTML5 bandwidth test: [[https://192.168.178.1]] 
 +    * iperf test 
 +      * iperf -c 192.168.178.1 -e 
 +      * iperf -c 192.168.178.1 -u -e 
 +      * iperf -c 192.168.178.1 -P 10 -e 
 +    * wrk 
 +      * ./wrk -t2 -c50 -d30s http://<ip address>/wrk/index.html 
 +      * ./wrk -t2 -c50 -d30s http://<ipaddress>/wrk/demo.borland.com/testsite/stadyn_largepagewithimages.html 
 +      * ./wrk -t2 -c50 -d30s http://<ipaddress>/wrk/1kb.bin 
 +      * ./wrk -t2 -c50 -d30s http://<ipaddress>/wrk/1mb.bin 
 +    * wget 
 +      * wget http://127.0.0.1/wrk/demo.borland.com/testsite/stadyn_largepagewithimages.html -O /dev/null 
 +      * wget -r http://127.0.0.1/wrk/demo.borland.com/testsite/stadyn_largepagewithimages.html -O /tmp/blob.fil 
 +    * Check workstation and server interfaces for errors 
 +      * Linux 
 +        * ifconfig 
 +        * ethtool -S <interfacename> 
 +      * Windows 
 +        * windows powershell: netsh interface ipv6 show ipstats | Select-String errors 
 +      * Note that rx overruns can occur with load testing even on a perfect link 
 +  - Test a link (fiber link, wireless link, wired trunk) 
 +    * HTML5 bandwidth test: [[https://192.168.178.1]] 
 +    * iperf test 
 +      * iperf -c 192.168.178.1 -e 
 +      * iperf -c 192.168.178.1 -u -e 
 +      * iperf -c 192.168.178.1 -P 10 -e 
 +    * wrk 
 +      * ./wrk -t2 -c50 -d30s http://<ip address>/wrk/index.html 
 +      * ./wrk -t2 -c50 -d30s http://<ipaddress>/wrk/demo.borland.com/testsite/stadyn_largepagewithimages.html 
 +      * ./wrk -t2 -c50 -d30s http://<ipaddress>/wrk/1kb.bin 
 +      * ./wrk -t2 -c50 -d30s http://<ipaddress>/wrk/1mb.bin 
 +    * wget 
 +      * wget http://127.0.0.1/wrk/demo.borland.com/testsite/stadyn_largepagewithimages.html -O /dev/null 
 +      * wget -r http://127.0.0.1/wrk/demo.borland.com/testsite/stadyn_largepagewithimages.html -O /tmp/blob.fil 
 +    * Check switch(es) for interface errors 
 +  - Test a firewall 
 +    * HTML5 bandwidth test: [[https://192.168.178.1]] 
 +    * iperf test 
 +      * iperf -c 192.168.178.1 -e 
 +      * iperf -c 192.168.178.1 -u -e 
 +      * iperf -c 192.168.178.1 -P 10 -e 
 +    * wrk 
 +      * ./wrk -t2 -c50 -d30s http://<ip address>/wrk/index.html 
 +      * ./wrk -t2 -c50 -d30s http://<ipaddress>/wrk/demo.borland.com/testsite/stadyn_largepagewithimages.html 
 +      * ./wrk -t2 -c50 -d30s http://<ipaddress>/wrk/1kb.bin 
 +      * ./wrk -t2 -c50 -d30s http://<ipaddress>/wrk/1mb.bin 
 +    * wget 
 +      * wget http://127.0.0.1/wrk/demo.borland.com/testsite/stadyn_largepagewithimages.html -O /dev/null 
 +      * wget -r http://127.0.0.1/wrk/demo.borland.com/testsite/stadyn_largepagewithimages.html -O /tmp/blob.fil 
 +====== Maintenance ====== 
 +===== Updating the Server =====
 Most NUCs have only 1 RJ45 interface. Since your NUC currently runs a DHCP server on that interface, plugging it into your network could take your network down. Most NUCs have only 1 RJ45 interface. Since your NUC currently runs a DHCP server on that interface, plugging it into your network could take your network down.
  
Line 227: Line 356:
   * sudo apt-get update && sudo apt-get upgrade -y   * sudo apt-get update && sudo apt-get upgrade -y
  
-====== Server Performance ======+===== Server Performance =====
 After building your server, you will want to test it from a directly connected workstation. See below on how to set up your workstation. After building your server, you will want to test it from a directly connected workstation. See below on how to set up your workstation.
  
Line 236: Line 365:
 From your testing you will find the maximum bandwidth you can drive to the server, which you can compare to your tests through a firewall or over a network link. From your testing you will find the maximum bandwidth you can drive to the server, which you can compare to your tests through a firewall or over a network link.
  
-====== Setting Up the Workstation ====== 
-I like to set up a laptop with a wired ethernet connection for this testing. A Windows workstation with WSL2 and Ubuntu is my preferred method. However, you don't need a virtual server to run the HTML5 speed test and iperf. 
- 
-===== HTML5 SpeedTest ===== 
-Point your browser the to IP address of the server. Click Start. 
- 
-Results testing a high speed and low latency connection will likely vary wildly, even from test to test. 
- 
-{{::screenshot-librespeed.png?400|}} 
- 
-===== iperf ===== 
-//See [[https://iperf.fr/]]// 
- 
-Linux and WSL2 on windows: sudo apt install iperf 
- 
-Or download the Windows binary. 
- 
-Tests to run: 
-  * iperf -c <serverip> 
-  * iperf -c <serverip> -P 4 
-  * iperf -c <serverip> -e 
- 
--P 4 selects 4 parallel threads 
- 
--e selects enhanced reporting 
- 
-===== wrk ===== 
-Instructions are for a Linux environment such as WSL2 on Windows. 
- 
-Prior to installation you will want to: 
-  * sudo apt install build-essential unzip 
- 
-See [[https://github.com/wg/wrk]] 
- 
-Instructions: 
-  - cd ~ 
-  - git clone https://github.com/wg/wrk.git 
-  - cd wrk 
-  - make 
-    * the usual ''sudo make install'' is apparently not needed 
- 
-Example commands: 
-  * <code> 
-./wrk -t2 -c50 -d30s http://<ip address>/wrk/index.html 
-./wrk -t2 -c50 -d30s http://<ipaddress>/wrk/demo.borland.com/testsite/stadyn_largepagewithimages.html 
-./wrk -t2 -c50 -d30s http://<ipaddress>/wrk/1kb.bin 
-./wrk -t2 -c50 -d30s http://<ipaddress>/wrk/1mp.bin 
-</code> 
- 
--t 2 assigned 2 threats 
- 
--c50 assigns 50 connections 
- 
--d assigns 30 second duration 
- 
-===== wget ===== 
-Pull one or more files from the web server. Note that the recursion flag (-r) cannot be used with a special file like /dev/null. 
- 
-<code> 
-wget http://127.0.0.1/wrk/demo.borland.com/testsite/stadyn_largepagewithimages.html -O /dev/null 
-wget -r http://127.0.0.1/wrk/demo.borland.com/testsite/stadyn_largepagewithimages.html -O /tmp/blob.fil 
-</code> 
network_testing_pc.1631468242.txt.gz · Last modified: 2021/09/12 17:37 by user