Get all the networking related commands for your distro

apropos network | more

assegnare IP statico e DNS: se il server non usa DHCP e va assegnato un indirizzo di rete fisso

vi /etc/network/interfaces
auto lo
iface lo inet loopback
 
auto eth0
# questa per abilitare DHCP come da default
# iface eth0 inet dhcp
iface eth0 inet static
address 192.168.1.39
gateway 192.168.1.255
netmask 255.255.255.0
dns-nameservers 8.8.8.8  8.8.4.4

Performs a reverse DNS lookup, variants include:

# reverse dns
nslookup 74.125.45.100
# reverse dns
host 74.125.45.100
# reverse dns
dig -x 74.125.45.100
# reverse dns
dig +noall +answer -x 199.232.41.10
>10.41.232.199.in-addr.arpa. 36000 IN    CNAME   rev-c41-10.gnu.org.
>rev-c41-10.gnu.org.       300     IN      PTR     www.gnu.org.

scanning a range of hosts

for i in {21..29}; do nc -v -n -z -w 1 192.168.0.$i 443; done
 
nmap -sP 192.168.2.*

porte udp aperte

lsof -i tcp -i udp

Find out your IP-address

ip a

Find out your gateway

ip route

il nome e' risolto correttamente ?

ping google.com

la porta e' aperta?

telnet 192.168.1.1 3306

la risoluzione dei nomi, in particolare il record A e MX? linux_nslookup

nslookup

Find out your DNS servers

cat /etc/resolv.conf

Network Usage

pannello web tcpdump dump traffic on a network. For.e.g to display traffic info about DNS, enter:

# tcpdump -i eth1 'udp port 53'

To display all IPv4 HTTP packets to and from port 80, i.e. print only packets that contain data, not, for example, SYN and FIN packets and ACK-only packets, enter:

# tcpdump 'tcp port 80 and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)'

To display all FTP session to 202.54.1.5, enter:

# tcpdump -i eth1 'dst 202.54.1.5 and (port 21 or 20'

To display all HTTP session to 192.168.1.5:

# tcpdump -ni eth0 'dst 192.168.1.5 and tcp and port http'

Use wireshark to view detailed information about files, enter:

# tcpdump -n -i eth1 -s 0 -w output.txt src or dst port 80

nethogs + iptraf

net top, raggruppa i consumi di banda per processo

sudo nethogs wlan0
nmap -O 192.168.1.100
# zenmap gui

travere i pc in rete

nmap -sP 192.168.2.*
# usa zenmap quick scan

usare /etc/hosts per bannare siti non desiderati: