Cheatsheet Packet Tracer/Cisco
IOS
Mode Navigation Show commands //sets the priority <value> of the switch
for the STP by vlan
#MANAGEMENT VLAN (configuration Subnetting 101
on switch)
R> enable show running-config
//enters the Privileged EXEC mode //view the router’s/switch’s entire
VLAN Configuration interface vlan <vlan-number>
A
VLAN10
active configuration (only on Switch) //enters the VLAN interface R1 Sw1 126H
R# configure terminal ip address <IP> <MASK>
//enters the global config mode //assigns the IP address and mask
show ip interface brief #MODE ACCESS (interfaces connected
R(config)# interface //view the available interfaces and their PC> telnet <IP> VLAN20
to end-devices) //connects to the switch’s IP C B
<type>/<number> brief parameters (IP, active, etc.) R2 29H
//enters the interface type/number 200H
config mode show ip route vlan <vlan-number> Example: int vlan 99
//view the routing table //creates the VLAN ip add 10.10.10.99 255.255.255.0
192.168.0.0/22
Example: interface fa0/1 interface <type>/<number> R1R2 – one network – 2H
show mac-address-table PC> telnet 10.10.10.99
//enters the interface that needs to be VLAN10 – one network – 126H
//view the CAM table
configured
Tips and Tricks VLAN20 – one network – 29H
show spanning-tree switchport mode access CAM Table R2C – one network – 200H
//view spanning-tree (STP) parameters //sets the access mode
? switchport access vlan <vlan-
mac-address-table static <MAC • add default gateway and extra 2
//displays all the possible commands show VLAN brief number>
address> vlan <vlan-number> • write them in descending order
in the current mode //view VLAN parameters //sets the access vlan
interface <type>/<number> • find closest power of 2
<tab> //the MAC address will be stored as
//autocompletes the rest of the show interface VLAN brief o 200+1+2 <= 28
Example: vlan 10 static in the CAM table
//view VLAN’s brief parameters on o 126+1+2 <= 28
command int fa0/2 clear mac-address-table
interfaces //flush the contents of the CAM table
o 29+1+2 <= 25
do <command> sw mo acc
o 2+2 <= 22
//executes the command in the sw acc vlan 10
Privileged Exec mode, regardless of the Basic commands Example: en • the power of 2 represents the
current shell mode #MODE TRUNK (interfaces connected
conf t mask
mac-address-tabel static o 32-power -> /mask
<shortcut> #ADD IPs (on router’s interfaces) to other switches or routers) 0001.6458.8b1a vlan 10 int fa0/1
//you can execute a command by
typing just the first letters of it and press interface <type>/<number> Example:
R(config)# interface o power is 6
enter <type>/<number> enters the interface that needs to be Routing Configuration o then mask is /26
<click Fast Forward Time> //enters the interface config mode configured
//increases the time of booting the R(config-if)# ip address <IP> switchport mode trunk
sets the trunk mode ip route <destination network> • R2C
devices <decimal-MASK>
<destination network’s mask> o 192.168.0.0/24 ->
exit //sets the IP and the mask to the swithcport trunk allowed vlan
<vlan-number>/all <next-hop> 192.168.0.255/24
//exits the current mode interface
end sets the vlans that are allowed on that
//sets the route to the destination • VLAN10
R(config-if)# no shutdown network through the next-hop o 192.168.1.0/24 ->
//exits the current mode and enters the //enables the interfaces (brings it up) link (some vlans or a range or vlans or
Privileged EXEC mode all vlans) 192.168.1.255/24
Example: en
<CTRL+SHIFT+6> conf t • VLAN20
Example: int fa0/3
//interrupts the execution of the Example: vlan 10 ip route 10.10.10.0 255.255.255.0 o 192.168.2.0/27 ->
ip add 10.10.10.1 255.255.255.248 192.168.2.31/27
current command int fa0/1 192.168.0.1
no shut
no <command> sw mo tr • R1R2
//cancels the command/ deletes the sw tr allowed vlan 10 o 192.168.2.32/30 ->
configuration of that command
Spanning Tree Protocol or
ip route 0.0.0.0 0.0.0.0 <next- 192.168.2.35/30
hop>
sw tr allowed vlan all //sets the default route: all the packets
spanning-tree vlan <vlan-number> with unknown destinations will be sent
Example: en
priority <value> or
conf t through that next-hop
sw tr allowed vlan range 10-20
int fa0/0
Cheatsheet Linux - Networking
VM Setup Basic commands Network Services dsniff -I <interface> -d <IP/hostname> destination
//captures network traffic and lists option
credentials when connections end -s <IP/hostname> source option
http://bit.ly/openstack_rl_tutorial #ADD IPs #REMOTE CONNECTION -p [tcp|udp|icmp|all|<number>]
protocol option
Example: -i <input-interface> input interface
ssh -o ServerAliveInterval=100 ip address add <IP>/<MASK> dev ssh <username>@<IP/hostname> -p
netcat -l 1234 option
<ldap_user>@fep.grid.pub.ro <interface> <port-number>
//server that listens on TCP port -o <output-interface> output
//connect to your fep account //sets the IP and the mask to the //connects to <username> at remote
1234 interface option
ssh -i ~/.ssh/openstack.key interface <IP/hostname> via ssh on port <port-
netstat -tlnp --dport <protocol/number>
student@<IP_masina_virtuala> ip address flush dev number> destination port
//lists the TCP services that listen
//connect to the virtual machine you just <interface> ssh -l <username> <IP/hostname> --sport <protocol/number>
on port 2024
created in Openstack //resets the interface at the initial //connects to <username> at remote source port
<IP/hostname> via ssh
dsniff -I eth0
configuration
Example: ssh -o ssh-keygen -t rsa #actions:
ip link set dev <interface> up
ServerAliveInterval=100 //enables the interface //generates public/private rsa key pair IPTABLES -j ACCEPT let through
the packet that matched the options
adi.minune@fep.grid.pub.ro ip route add default via <IP- ssh-copy-id -j REJECT rejects the
default-gateway> <username>@<IP/hostname> iptables -t [table] [-A|-D|- packet that matched the options
ssh -i ~/.ssh/openstack.key //sets the default gateway //copy public key in the remote file for I|-R|-L|-F] [chain] [options] -j DROP drops the packet,
student@10.9.24.226 authentication on <username> at [action] without sending a notification error
sysctl -w net.ipv4.ip_forward=1
//activates routing/packet <IP/hostname> -j DNAT available only in the nat
-t filter filtering table (the
table, it specifies that the destination
Tips and Tricks forwarding telnet <IP/hostname> default table)
address of the packet should be modified
//connects to <IP/hostname> via telnet -t nat altering table
Example: ip add add ftp <IP/hostname> -t mangle special altering table
go [red|green|blue] Example:
192.168.0.1/24 dev veth-red //connects to <IP/hostname> via ftp iptables -L FORWARD -n -v
//connect to one of the 3 containers -A append rule to
ip l s dev veth-red up scp -r //view (list) rules and information on the
lxc-list <username>@<hostname>:<folder> chain
ip r a default via 10.0.0.1 filter table – FORWARD chain
//view the list of containers and their -D delete rule
//downloads <file> from <username> at
state -I <no> insert as the
iptables -A INPUT -p tcp -d
<hostname> on your local host
rr [red|green|blue] Show commands scp -r <file>
given rule <no> 10.10.0.1 –dport 21 -s 20.20.0.1 -j
//reboot one of the 3 containers -R replace rule DROP
<username>@<hostname>: -L list all rules from //add a rule to block FTP (port 21) from
<shortcut> ip address show dev <interface> //uploads <file> from local host to given chain
//you can execute a command by typing 20.20.0.1 to 10.10.0.1
//view the layer 3 (network) <username> at <hostname> -F flush the
just the first letters of it and press enter configuration of the interface selected chain iptables -t nat -A PREROUTING -p
<CTRL+a> -> <press q> #TRAFFIC CAPTURE tcp –dport 22022 -j DNAT –to-
//exit the console of the container ip link show dev <interface> #filter chains:
//view the layer 2 (data link) destination 10.0.0.1:22
ping -c <value> <IP> INPUT packets //add a rule where connections to port
configuration of the interface netcat destined to local host
//test the conectivity between host and 22022 will be redirected to ssh (port 22) of
//arbitrary TCP and UDP connections OUTPUT packets locally- 10.0.0.1
<IP> by sending <value> packets ip route show and listens generated
//view the routing table
-l listens (server) to connections FORWARD packets being
Example: ping -c 2 10.10.0.1 routed through the local host
ip neighbor show -u use UDP instead of the default
//view the ARP table option of TCP
#nat chains:
netstat PREROUTING altering packets
Example: ip a s dev eth0 //prints network connections as soon as they come in
ip l s dev veth-red -t lists TCP connections POSTROUTING altering packets
ip r s -l lists services that listen on as they are about to go out
connections OUTPUT altering locally-
-u lists UDP connections generated packets before routing