Difference between revisions of "Ethernet"

From Alessandro's Wiki
(Reverted edits by Ypebezimyx (Talk) to last version by 127.0.0.1)
 
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
  +
== general Linux commands ==
* Avere informazioni su tutte le interfaccie di rete:
 
== Ethernet in Linux ==
 
 
ifconfig -a
 
ifconfig -a
 
* attivare la scheda di rete eth0 (senza script di ifup/ifdown)
 
* attivare la scheda di rete eth0 (senza script di ifup/ifdown)
 
ifconfig eth0 up
 
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 (!!!)
 
* Chiedere in broadcast un indirizzo ip su eth0 (!!!)
 
dhclient eth0
 
dhclient eth0
Line 9: Line 10:
 
# tail -50 /var/log/messages |grep -A4 eth0
 
# tail -50 /var/log/messages |grep -A4 eth0
 
NETDEV WATCHDOG: eth0: transmit timed out
 
NETDEV WATCHDOG: eth0: transmit timed out
Mar 26 14:21:39 porcellino kernel: eth0: transmit timed out, tx_status 00 status e000.
+
Mar 26 14:21:39 kernel: eth0: transmit timed out, tx_status 00 status e000.
Mar 26 14:21:39 porcellino kernel: diagnostics: net 0cf2 media 8880 dma 000000a0 fifo 0000
+
Mar 26 14:21:39 kernel: diagnostics: net 0cf2 media 8880 dma 000000a0 fifo 0000
Mar 26 14:21:39 porcellino kernel: Flags; bus-master 1, dirty 1048374(6) current 1048390(6)
+
Mar 26 14:21:39 kernel: Flags; bus-master 1, dirty 1048374(6) current 1048390(6)
Mar 26 14:21:39 porcellino kernel: Transmit list 16c7f5c0 vs. d6c7f5c0.
+
Mar 26 14:21:39 kernel: Transmit list 16c7f5c0 vs. d6c7f5c0.
 
* scanneriz1zare una rete privata:
 
* 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
 
for a in `seq 1 254`; do echo -n -e "\r $a ";ping -c1 192.168.1.$a|grep "bytes from "; done
   
== Network ==
+
== host scanning ==
  +
* '''nmap''' is the master tool, then everything follows.
  +
nmap <host>
  +
* a more specific scan, suggested from [[http://www.gavinpearce.com/blog/check-for-valid-server-name-using-url-rewrite-else-redirect-182| Gavin Pearce]]
  +
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 10.10.10.0/24 subnet
  +
nmap -sP 10.10.10.0-254
  +
nmap -sP 192.168.82.0/24
  +
== Cisco ==
 
* para conectar un host directo a un puerto de un router (Cisco)
 
* para conectar un host directo a un puerto de un router (Cisco)
 
cisco-6500#
 
cisco-6500#

Revision as of 15:18, 6 April 2014

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 10.10.10.0/24 subnet
nmap -sP 10.10.10.0-254
nmap -sP 192.168.82.0/24

Cisco

  • para conectar un host directo a un puerto de un router (Cisco)
cisco-6500#
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
 <cr>
cisco-6500(config-if)#spanning-tree portfast