Network Tips
Disable IPv6
In Kernel Module (Requires Reboot)
Edit /etc/default/grub and add ipv6.disable=1 to the line GRUB_CMDLINE_LINUX
/etc/default/grub
GRUB_TIMEOUT=5
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="ipv6.disable=1 crashkernel=auto rhgb quiet"
GRUB_DISABLE_RECOVERY="true"Regenerate a GRUB configuration file and overwrite the existing one
grub2-mkconfig -o /boot/grub2/grub.cfgRestart the system and verify there is no inet6 line in the ip addr show command output
shutdown -r nowUsing sysctl Settings (No Reboot Required)
Append the lines below to /etc/sysctl.conf
/etc/sysctl.conf
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1To make the settings effective, execute
sysctl -pNote
Make sure the file
/etc/ssh/sshd_configcontains the lineAddressFamily inetTo avoid breaking SSH X forwarding if you are using the
sysctlmethod
Add the AddressFamily line to sshd_config:
/etc/ssh/sshd_config
AddressFamily inetRestart sshd for changes to get effect
systemctl restart sshdUse a Different IP Address on a curl Command
To use 127.0.0.1 instead of the real IP address of docs.rda.run
curl --resolve docs.rda.run:443:127.0.0.1 https://docs.rda.runDownload SSL Certificate
echo quit | openssl s_client -servername docs.rda.run -connect docs.rda.run:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > site-cert.pemTo use this cert
curl
curl --cacert site-cert.pem https://docs.rda.runwget
wget --ca-certificate=site-cert.pem https://docs.rda.runVerify Network Throughput Between Two Servers
On server 01
iperf3 -sOn 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
/etc/systemd/system/iperf3.service
[Unit]
Description=iperf3 server
After=syslog.target network.target
[Service]
ExecStart=/usr/bin/iperf3 -s
Restart=always
RuntimeMaxSec=3600
User=iperf
[Install]
WantedBy=multi-user.target
DefaultInstance=5201sudo adduser --system --no-create-home -s /sbin/nologin iperf
sudo systemctl daemon-reload
sudo systemctl start iperf3List All IPv4 Addresses of a Network
nmap -sn 172.17.3.0/24 | 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 rda.run 6969
Trying 172.217.28.14...
KilledUsing curl to Calculate Website Load Time
curl -o /dev/null -s -w %{time_total}\\n https://rda.run
0,536215 # Response (in seconds)You can get some other info too.
curl -o /dev/null -s -w {time_connect}:%{time_starttransfer}:%{time_total}\\n https://rda.run
# Connection time : transfer start : total time in seconds
0,035299:0,151648:0,157692Port Redirect on Windows 10
Use PowerShell as admin:
netsh interface portproxy add v4tov4 listenport=80 listenaddress=127.0.0.1 connectport=80 connectaddress=192.168.99.100To test if the rule was applied:
netsh interface portproxy show allTo remove the rule:
netsh interface portproxy delete v4tov4 listenport=80 listenaddress=127.0.0.1Resume a curl Download
curl -C - -o partial-file.bin 'www.example.com/caminho/do/partial-file.bin'Limit syncthing to Only Use Local Network
- Actions → Settings → Connections: uncheck Enable NAT traversal, Global Discovery, Enable Relaying and Local Discovery
- Actions → Advanced → Devices: limit the allowed networks to your network only.
192.168.178.0/24, for example - Remote Devices → device name → edit → Advanced → Addresses: set
tcp://192.168.178.xx:22000, for example - Actions → Advanced → Options: uncheck Announce LAN Addresses and Crash Reporting Enabled
Rodrigo de Avila