Netband Project - Goodies

From Teknologisk videncenter
Jump to: navigation, search

IOS and Linux Goodies

This page is part of the Netband Project

IOS Goodies

  • send messages to other adminsitrative users through the cli
B1rt1#send *
Enter message, end with CTRL/Z; abort with CTRL/C:
hej hej
^Z
Send message? [confirm]
B1rt1#
***
***
*** Message from tty194 to all terminals:
***
hej hej
B1rt1#
***
***
*** Message from tty194 to all terminals:
***
hej hej
  • disable password check on telnet sessions
line vty 0 4
 no login
line vty 5 15
 no login
  • log straight into privilege mode
aaa new-model
username admin privilige 15 password cisco 
!
aaa authentication login default group local
aaa authorization console
aaa authorization exec default local
  • tells the router to hold messages until it detects no input from the keyboard and no other output from the router.
line con 0
 logging synchronous
line aux 0
line vty 0 4
 logging synchronous
line vty 5
 logging synchronous
  • Show the configuration from a user specified point
Switch#sh run | begin router ospf
router ospf 1
 router-id 192.168.1.2
 log-adjacency-changes
 passive-interface FastEthernet0/5
 network 192.168.1.2 0.0.0.0 area 0
 network 192.168.1.6 0.0.0.0 area 0
  • Or type / at --more-- and the string you are searching for
Switch#sh run
Building configuration...
<output omitted>
/router ospf
filtering...
router ospf 1
 router-id 192.168.1.2
 log-adjacency-changes
 passive-interface FastEthernet0/5
 network 192.168.1.2 0.0.0.0 area 0
 network 192.168.1.6 0.0.0.0 area 0
  • Macros can be used to execute multiple commands at once (only on switches)
Switch(config)# interface range fa0/1 - 24
Switch(config-if-range)# switchport host

switchport mode will be set to access
spanning-tree portfast will be enabled
channel group will be disabled
  • User definded macro
Switch(config)#macro name test
Enter macro commands one per line. End with the character '@'.

switchport access vlan $VLANID
@
Switch(config-if)#do sh run interface fa0/15
Building configuration...

Current configuration : 132 bytes
!
interface FastEthernet0/15
 switchport access vlan 3
 switchport mode access
 spanning-tree portfast
end

Switch(config-if)#macro apply test 5
Switch(config-if)#do sh run interface fa0/15
Building configuration...

Current configuration : 139 bytes
!
interface FastEthernet0/15
 switchport access vlan 5
 switchport mode access
 macro description test
 spanning-tree portfast
end
  • View the contents of a file in filesystem
fiber01#dir
Directory of flash:/

    1  -rw-    22245164  Nov 10 2008 21:42:56 +00:00  c180x-adventerprisek9-mz.124-15.XY4.bin
    2  -rw-         780  Nov 11 2008 15:40:14 +00:00  vlan.dat
    3  -rw-       12421  Jun 17 2009 10:25:24 +02:00  config.txt

31932416 bytes total (9359360 bytes free)
fiber01#more flash:config.txt
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime localtime
service password-encryption
!
hostname fiber01
!
boot-start-marker
boot-end-marker
<output omitted>

Linux Godies

  • When you look at logs and need realtime monitoring use the -f argument on tail. If you've changed something in the MRTG config file and want to know if it is correct use "tail -f /var/log/mrtg/mrtg.log" to monitor the log.
root@UbuntuBox:~# tail -f /var/log/mrtg/mrtg.log
2009-04-20 08:30:05: ERROR: Target[Router][_IN_] 'Di $target->[14]{$mode} ' (kill): Can't call method "Di" on unblessed reference at (eval 42) line 1.
2009-04-20 08:30:05: ERROR: Target[Router][_OUT_] 'Di $target->[14]{$mode} ' (kill): Can't call method "Di" on unblessed reference at (eval 43) line 1.
2009-04-20 08:35:03: ERROR: Target[Router][_IN_] 'Di $target->[14]{$mode} ' (kill): Can't call method "Di" on unblessed reference at (eval 42) line 1.
2009-04-20 08:35:03: ERROR: Target[Router][_OUT_] 'Di $target->[14]{$mode} ' (kill): Can't call method "Di" on unblessed reference at (eval 43) line 1.
  • Linux network emulater
  • Can be used to emulate slow wan links with packet drops, delay and jitter

http://www.linuxfoundation.org/en/Net:Netem

  • Network Connection Bridge
  • This can be used to bridge two ethernet connections under ubuntu

https://help.ubuntu.com/community/NetworkConnectionBridge