From Alessandro's Wiki
Jump to navigation Jump to search

general Linux commands

ifconfig -a
  • attivare la scheda di rete eth0 (senza script di ifup/ifdown)
ifconfig eth0 up
  • disattivare la scheda di rete eth0 (senza script di ifup/ifdown)
ifconfig eth0 down
  • Chiedere in broadcast un indirizzo ip su eth0 (!!!)
dhclient eth0
  • Sapere se hai problemi con la scheda (il NIC)
# tail -50 /var/log/messages |grep -A4 eth0
NETDEV WATCHDOG: eth0: transmit timed out
Mar 26 14:21:39  kernel: eth0: transmit timed out, tx_status 00 status e000.
Mar 26 14:21:39 kernel:   diagnostics: net 0cf2 media 8880 dma 000000a0 fifo 0000
Mar 26 14:21:39 kernel:   Flags; bus-master 1, dirty 1048374(6) current 1048390(6)
Mar 26 14:21:39 kernel:   Transmit list 16c7f5c0 vs. d6c7f5c0.
  • scanneriz1zare una rete privata:
for a in `seq 1 254`; do echo -n -e "\r   $a   ";ping -c1 192.168.1.$a|grep "bytes from "; done

host scanning

  • nmap is the master tool, then everything follows.
nmap <host>
nmap -sS -p0-65535 -P0 -T4 --osscan_limit --osscan_guess --host_timeout 15m --max-retries 0 --min_parallelism 100 --max_parallelism 500 -O -oX -V <host>

subnet scan

  • this command will scan all host in the subnet
nmap -sP
nmap -sP


  • para conectar un host directo a un puerto de un router (Cisco)
cisco-6500#conf t
cisco-6500(config)#int gi3/44
cisco-6500(config-if)#spanning-tree port ?
 port-priority  portfast
cisco-6500(config-if)#spanning-tree portfast ?
 disable  Disable portfast for this interface
 trunk    Enable portfast on the interface even in trunk mode
cisco-6500(config-if)#spanning-tree portfast

Linux Routing Table

  • example data

  • show main table (and save)
ip route show table main
  • create the new table for uplink2
echo 202 uplink2 >> /etc/iproute2/rt_tables
ip route add dev ens32 src table uplink2
ip route add default via table uplink2
ip rule add from table uplink2