Network

Watch network connections

$ watch ss -tp

Established connections

$ netstat lsof -i

Tcp connections

$ netstat -ant   # -anu=udp

Connections with PIDs

$ netstat -tulpn

List of listening ports

$ netstat -uanp

Capture packets

$ sudo apt-get install tcpdump
$ sudo tcpdump -i wlan0  src port 80 or dst port 80
$ sudo apt-get install tshark
$ tshark -i any

http://jvns.ca/blog/2016/03/16/tcpdump-is-amazing/

Change the default gateway

$ sudo route del default
$ sudo route add default gw 192.168.1.115

Or:

$ vim /etc/network/interfaces

auto eth0
iface eth0 inet static
address 192.168.1.119
netmask 255.255.255.0
broadcast 192.168.1.255
gateway 192.168.1.115

How do I install dig?

$ sudo apt-get istall dnsutils

Monitor bandwidth usage per process

$ sudo apt-get install nethogs
$ nethogs -a
$ sudo apt-get install iptraf
$ sudo iptraf-ng
$ watch -n1 netstat -tunap

https://askubuntu.com/questions/532424/how-to-monitor-bandwidth-usage-per-process

Show your gateway

$ route -ne

Disable IP6

$ sudo vim /etc/sysctl.conf
    net.ipv6.conf.all.disable_ipv6 = 1
    net.ipv6.conf.default.disable_ipv6 = 1
    net.ipv6.conf.lo.disable_ipv6 = 1
$ sudo sysctl -p