Skip to content

network tips

use a different ip address on a curl command

to use instead the real ip address of

curl --resolve

download ssl certificate

echo quit | openssl s_client -showcerts -servername -connect > site-cert.pem

to use this cert on curl

curl --cacert site-cert.pem

to use this cert on wget

wget --ca-certificate=site-cert.pem

verify network throughput between two servers

on server 01

iperf3 -s

on server 02

upload speed, Mbits/sec
iperf3 -f m -c <IP_SERVER_01> | grep sender | awk -F " " '{print $7}'
download speed, Mbits/sec
iperf3 -f m -c <IP_SERVER_01> -R | grep sender | awk -F " " '{print $7}'

running iperf3 as a service

Description=iperf3 server

ExecStart=/usr/bin/iperf3 -s

sudo adduser --system --no-create-home -s /sbin/nologin iperf
sudo systemctl daemon-reload
sudo systemctl start iperf3

list all ipv4 address of a network

nmap -sn | grep -B 1 'Host is up' | grep -oE '[[:digit:]]{1,}\.[[:digit:]]{1,}\.[[:digit:]]{1,}\.[[:digit:]]{1,}'

telnet with timeout

# echo quit | timeout --signal=9 3 telnet [HOST] [PORT]
$ echo quit | timeout --signal=9 3 telnet 6969

using curl to calculate website load time

curl -o /dev/null -s -w %{time_total}\\n
0,536215 # Resposta (em segundos)

you can get some other infos too.

curl -o /dev/null -s -w {time_connect}:%{time_starttransfer}:%{time_total}\\n
# connection time : transfer start : total time in seconds

port redirect on windows 10

use powershell as admin:

netsh interface portproxy add v4tov4 listenport=80 listenaddress= connectport=80 connectaddress=

to test if the rule was applied:

netsh interface portproxy show all

to remove the rule:

netsh interface portproxy delete v4tov4 listenport=80 listenaddress=

resume a curl download

curl -C - -o partial-file.bin ''

limit syncthing to only use local network

  • ActionsSettingsConnections: uncheck Enable NAT traversal, Global Discovery, Enable Relaying and Local Discovery
  • ActionsAdvancedDevices: limit the allowed networks to your network only., for example
  • Remote DeviceseditAdvancedAddresses: set tcp://192.168.178.xx:22000, for example
  • ActionsAdvancedOptions: uncheck Announce LAN Addresses and Crash Reporting Enabled