==== IP FORWARDING ==== sysctl net.ipv4.ip_forward # check if enabled sysctl -w net.ipv4.ip_forward=1 # turning on echo "net.ipv4.ip_forward = 1" >> /etc/sysctl.conf ==== SCP ==== $ scp username@remotehost:file_name.txt /local/directory # from remote to local $ scp file_name.txt username@remotehost:/remote/directory # from local to remote $ scp -r dir_name username@remotehost:/remote/directory # copy the local directory "dir_name" to # remote host $ scp -6 username@\[2001:db8:0:1\]:/home/username/test.file ./test.file # going via ipv6 ==== CURL ==== Uploading data to http server using PUT: curl -u username -T file.conf http://192.168.0.1 ==== NC ==== Basic TCP test: nc -vz 10.10.0.1 80 # v - verbose; z - just scan for listening daemon, # without sending any data to them ==== PROXY ==== Set proxy and show current config: export http_proxy=http://proxyusername:proxypassword@proxyaddress:proxyport echo $http_proxy To make it permanent, add to //**/etc/environment**// http_proxy=http://10.0.0.1:3128 Make it work with "sudo", add following to ///etc/sudoers// after //Defaults env_reset//: Defaults env_keep = "http_proxy ftp_proxy" ==== DIG ==== Sample usage: dig @10.0.0.1 ipv6.google.com AAAA +short ==== IPv4/6 DNS RESOLVER PRECEDENCE ==== * Check /etc/gai.conf ==== SSH PORT FORWARDING ==== Dynamic forwarding, **ssh** will act as a SOCKS server: ssh -D 1080 victor@172.16.0.1 ==== IPTABLES ==== Port forwarding: sudo iptables -A PREROUTING -t nat -i ens160 -p tcp --dport 1005 -j DNAT --to 192.168.0.5:22 sudo iptables -A FORWARD -p tcp -d 192.168.0.2 --dport 22 -j ACCEPT Install //iptables-services// for Centos7: sudo yum install -y iptables-services sudo systemctl enable iptables.service sudo /usr/libexec/iptables/iptables.init save ==== IP ROUTE ==== ip route get 10.0.0.1 ==== TCP OFFLOADING ==== * TCO - TCP checksum offloading * TSO - TCP segmentation offloading (requires TCO) Check current situation: $ sudo ethtool --show-offload eth0 $ sudo ethtool -k ens3 # same as the previous command Disabling TSO: $ sudo ethtool -K ens3 tso off ==== CONNECTIONS ==== Pinpoint the service that's using a port: $ lsof -i # "-i" option selects the listing of all network files $ lsof -i:22 # filter out only port 22 $ sudo ls -la /proc/58198/exe lrwxrwxrwx 1 user user 0 Aug 17 11:48 /proc/58198/exe -> /opt/python/3.6/bin/python3.6