Tips for working with networks
Change system hostname
No system reboot is required
shell
hostnamectl set-hostname new-hostnameAddition: Hard reset for netip component network
shell
systemctl restart systemd-hostnamed && \
docker rm -f netip.networkand run reinstall components
Monitor network resource usage
For the interface eth0
shell
apt install tcptrack && \
tcptrack -i eth0For port 443 only
shell
tcptrack -i eth0 port 443Across all interfaces
shell
apt install nethogs && \
nethogsMonitor UDP connections
shell
apt install conntrack -y && \
conntrack -L -p udpChange DNS
Change DNS when using dhcpcd
shell
nano /etc/dhcpcd.conf
# add
interface ens160
static domain_name_servers=1.1.1.1 8.8.8.8
# or add for all interfaces
static domain_name_servers=1.1.1.1 8.8.8.8
# restart
systemctl restart networking.serviceChange DNS when using dhclient
shell
nano /etc/dhcp/dhclient.conf
# add the following line
supersede domain-name-servers 1.1.1.1, 8.8.8.8;
# restart
systemctl restart networking.serviceHard Change DNS
If the above doesn't work, manually change it and lock the file
Change or Add
nameserverto/etc/resolv.conf
To lock the file and restart
shell
chattr +i $(readlink -f /etc/resolv.conf) && \
systemctl restart networking.serviceRollback: To unlock the file
shell
chattr -i $(readlink -f /etc/resolv.conf) && \
systemctl restart networking.service && resolvconf -uWorking with UDP
Checking a port with nmap
If the port is closed, the state will be closed
shell
nmap -sU -p 53Checking a port on the host
shell
ss -lunp | grep 53
# or
lsof -iUDP:53