Set the telnet source IP address for a Cisco router

The default source IP address when telnetting from a Cisco router is that of the interface closest to the destination. Because some access lists may block traffic from the default IP address, or to help test access lists, it may be useful to temporarily or permanently set the telnet source IP address.


To temporarily set the telnet source IP address for a single telnet session, use the/source-interface extension to the telnet command. For example, to telnet to 192.168.1.4 using the source IP address of the interface FastEthernet0

telnet 192.168.1.4 /source-interface FastEthernet0

To set this interface as the source IP address for all telnet sesions, use this command in configuration mode (conf t):

ip source-interface fastethernet0


Set the time on a Cisco router manually

To set the time, use this command in enable mode (not configuration mode):

Router# clock set 22:55:05 June 19 2006

The time is in 24 hour mode. To see the information about the clock settings, use:

Router# show clock detail
22:56:07.136 PDT Mon Jun 19 2006
Time source is user configuration

This will show the current date and time and the source of the time configuration (in this case showing that the time was manually set).


Configure Cisco router to set time from NTP server

Using NTP to synchronize the date and time of multiple devices makes sense even in a small network. When performing forensic analyses or troubleshooting connection problems, having consistent logging timestamps from multiple devices can save your life. Well, at least help keep your hair attached to your head.


To configure a router to use the NTP server 192.168.1.15, issue these commands from enable mode:

Router# conf t
Router# ntp server 192.168.1.15

Multiple ntp server lines can be used for redundancy. By default, the router will use UTC as the time zone. To set the time zone to PST and add a second ntp server at 172.32.10.55, use these commands instead:

Router# conf t
Router# ntp server 192.168.1.15
Router# ntp server 172.32.10.55
Router# clock timezone PST -8


Configure Cisco router as an NTP server

An NTP server can provide synchronized date and times for devices in a network. Since a router cannot be a Stratum 1 device (cannot connect to a Stratum 0 device such as a GPS clock), a router is not an accurate source of time information. If this is not important to you, then using a router as an NTP server may be acceptable.


To configure the router to work as an NTP server, use the following command in configuration mode (following a conf t):

ntp master 8

The 8 specifies the stratum of this NTP server, essentially the number of hops away from a Stratum 0 device. The default value is 8.


Cisco Switch 2900/2950: Display VLAN information

Knowing the commands to display configuration information about Virtual LANs (VLANs) is as important as knowing the commands to configure them. The commands here display information about all VLANs or a single VLAN by number or name.


All of these commands must be run from privileged mode. To view detailed information about all VLANs on the local switch, use:

# show vlan

To shorten the output and just display the highlights about all of the VLANs:

# show vlan brief

To display information about VLAN 3, use:

# show vlan id 3

This version of the command can be extended to look at multiple VLANs. For example, to view information about VLANs 1, 2, 3 and 10, use:

# show vlan id 1-3,10

For increased administratability, VLANs can be named. To view information about a VLAN by name, for instance the VLAN named ‘engineering’ use this command:

# show vlan name engineering


Cisco 2950 switch password recovery

This documents the procedure for performing a password recovery on a Cisco 2950 switch (and probably other models, as well).

1. Unplug the power cable

2. Hold down the mode button while replugging the power cable

3. Type flash_init over the console

4. Type load_helper

5. Type Dir flash :
//make sure to type the semi-colons

6. Type rename flash:config.txt flash:config.old
//the password is contained in the config.txt file

7. Type boot
//this reboots the system

8. Type n to skip the initial setup configuration

9. Type enable
//this takes you to the enable mode

10. Type rename flash:config.old flash:config.txt

11. Save config.txt to system
#copy flash:config.txt system:running-config

12. Enter config mode and change the password
# config t
# no enable secret
//this applies only if the enable secret password was created

13. Finally, write the changes to memory
# write memory


How to convert VMware virtual disks from thin to thick with the vSphere client

Have you ever provisioned a new virtual machine in vSphere, put it in production, and discovered belatedly that you mistakenly used “thin provisioned” virtual disks? This can often happen when deploying from a template which was thin provisioned since the default option is to use the same disk format as the source. Good news! It is quite easy to convert these to thick with the vSphere client and your mouse.

No command line required, as was the case with previous versions of VMware Infrastructure. The only downside is that the virtual machine must be shut down prior to inflating its disk(s).

1. Launch your vSphere client and log in to your vCenter server.

2. Select the virtual machine which has mistakenly been thin provisioned.

3. Select the option to “Shut Down Guest” under Commands. This is a necessary step. If your virtual machine is in production, you will have to schedule some downtime.

4. Right-click the virtual machine and select the Snapshot menu. If you see the option to “Revert to snapshot”, it means that you have at least one snapshot of this virtual machine. I highly recommend that you remove all snapshots by opening Snapshot Manager and selecting Delete All. Please keep in mind that this has its own implications so please understand them before continuing.

4. Look at the Datastore list on the right to see what Datastores your virtual machine is using. Note the free space listed – you must have enough free space to allow the disks to expand to their “provisioned” size or you will cause yourself quite a headache!

5. Now right-click the Datastore and select “Browse Datastore…”

6. Select the folder for your virtual machine on the left, and the contents will show on the right.

7. Look for the file(s) ending in the “.vmdk” extension. These will be labeled “Virtual Disk” under the “Type” header. Note the “Provisioned Size” header and make sure that you have enough free space in this datastore to support your virtual disk(s) growing to consume this space.

8. Finally, to inflate your virtual machine’s disk you simply right-click the .vmdk and select “Inflate”. Depending on the size of the disk and your underlying storage architecture, this may take quite some time.

9. If the virtual machine has more than one virtual disk that needs to be inflated simply repeat step 8.

10. When complete, the inflated virtual disk will be “eager zeroed thick”, which is the highest performing type of virtual disk in vSphere land.




VOIP / Mobile Data : How to make incoming and outgoing VOIP calls for free w/Google Voice and an internet connection (USA tested only)

This recipe will explain how to utilize several free services to get free incoming and outgoing calls (2000 minutes limit/month) in the USA. We will be utilizing a VOIP standard called SIP (Session Initiation Protocol) to allow us to use our mobile data only device or pc internet connection to make up to 2000 minutes of free VOIP calls w/o the complexities of creating one’s own PBX (SIP client required on device of course, Android and iOS4 have several clients, most are retail though).


We will be using these free services: Google Voice, Sipgate, Sip Sorcery and PBXes

NOTE: This guide does work around the one way audio problem on incoming calls too (PBXes part resolves this)

SIP GATE
1. First things we will need to do is to sign-up for a free Sipgate account over atSipgate.com Also be sure to get a phone number; the free account allows you to get one landline number and 60 minutes of free call time (this call time won’t matter since we’ll be bypassing it).

2. After you get your number and account setup, click on the Settings link in the upper right corner of the screen. Then click on the Phone you just created (ie Phone of Jimmy). You will get a list of options.

sipgate settings

3. Click on the SIP Credentials link. Write down the SIP-ID and SIP-Password (we will need this for sip sorcery).

sip creds

4. We are now done w/the Sip Gate section and really should not need to change any of the accounts default settings.

Google Voice
1. Like it or not, you will need a Google Voice account. Go over tohttp://google.com/voice and sign up for a free voice account. Pick out a local number; this will be our VOIP call number when all things are said and done.

2. Next we will need to add our Sip Gate phone number as a phone to your Google Voice account. We will mark it as a Mobile phone. Now here’s the tricky part; we will now need to either install the Sipgate Phone widget via the sipgate.com site or use the sipgate iphone/ipad client. To verify your sip gate number from google voice, it calls the number and has you enter in the 4 digit pin to verify. I use the sipgate client since we don’t need a mic to talk, just the keypad to enter in the digits to verify.

http://lh4.ggpht.com/_DZ9GBB8HCss/TDvmCj5ivzI/AAAAAAAACqk/53zEaHFRUTw/s400/googlevoice-sipphone.png

3. Once you have the sip gate number verified and added to your Google Voice account, you can setup the ring schedules under the advanced settings if you want. I turn off caller presentation initially to verify my setup works w/o that added level of complexity.

4. Once your settings are as you want them and the Sip Gate number is verified and added, we should be done w/Google Voice for now.

Sip Sorcery
1. Next, head on over to sipsorcery.com and sign up for a new account. I personally try to use the same accounts usernames for each provider to simplify things (be warned, not the most secure method though).

NOTE: you will need the Microsoft Silverlight browser plug-in installed to use the portal.Get it here.

2. After your signed up and verified, login to the Sip Sorcery Portal.

3. Go to the SIP Providers menu and click on the Add button.
Enter in the following:

Provider Name: sipgate
Username: your sipgate SIP-ID, that we wrote down ;)
Password: your sipgate SIP-Password
Server: sipgate.com
Register: check it

Then click on Update. You should now see a SIP Provider Registrations listed at the bottom.

4. At the top, click on Dial Plans. We only need to make an outbound dial plan. Here is the code i have used from the google code page found here.

Give the dial plan a name of: Simple and set Script Type as Ruby. Next, copy the following below or use the link above and paste the code into the bottom box.

You will need to update the first four boxes with our information (AREA_CODE, GV_User, GV_Pass and CB_Number). Click Update to save the changes.


# Copyright(c) 2010 Mike Telis
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.
# Click "View raw file" in the lower right for the best copy/paste view
AREA_CODE = 'xxx' # my area code
GV_USER = 'username@gmail.com' # my GV e-mail address (user@gmail.com)
GV_PASS = 'gmail password' # my GV password
CB_NUMBER = '415xxxyyyy' # my 10-digit SIP Gate number (only one)
#
SPEED_DIAL = { # my speed dial numbers
'411' => '8004664411', # Google 411
}
#
begin
sys.Log "** Call from #{req.Header.From} to #{req.URI.User} **"
#
if sys.Out # if outbound call
num = req.URI.User.to_s # Get a string copy of the number to dial
#
num = SPEED_DIAL[num] || num # Substitute with speed dial entry, if any
#
case num
when /@/ then sys.Dial num # URI dialing
when /^[2-9]\d{6}$/ # Local call, 7-digit number
num = '1'+ AREA_CODE + num # prefix it with country and area code
when /^[01]?([2-9]\d{9})/ # US number with or without country code
num = '1' + $1 # add country code and truncate number to 10-digit
when /^(011|00|\+)(\d{10,})/ # international number
num = '+' + $2 # GoogleVoiceCall works with '+' prefix only
#
else sys.Respond 603, 'Wrong number, check & dial again'
end
#
sys.Log "Calling #{num} via Google Voice"
sys.GoogleVoiceCall GV_USER, GV_PASS, CB_NUMBER, num, '.*', CB_NUMBER =~ /^1747/ ? 7 : 1, 30
#
else # sys.Out
sys.Dial "#{sys.Username}@local"
end
#
rescue
sys.Log("** Error: " + $!) unless $!.to_s =~ /Thread was being aborted./
end

5. Finally, click on the SIP Accounts and then the Add button.

Enter in your sipsorcery user name and password.

Choose our outbound dial plan called: Simple
Leave the inbound dial plan blank and then click Add.

We should now be done with our Sip Sorcery Part. Lastly….

PBXes
Most people that are in the know are wondering why we need PBXes for what we want to do. A few of us have had problems with one way audio/calls and using PBXes as our first entry point seems to resolves this issue. I know it has solved mine that I was having w/incoming calls not able to hear me but i could hear them and outgoing calls doing the same.

1. Again, sign up for another account over at pbxes.com

The free account will get us a nice ole 2000 minutes of free call time.

2. Once we are signed up, verified and logged in. We will get our Setup PBXes menu on the left pane of our browser. Click on Extensions and then click Add Extension.

Choose SIP Extension.

Fill in just these fields:

Extension Number: 100
Display Name: My Phone

Then click on Submit. You will see a red box at the top to save all changes; we will do this once we are all finished.

3. Next, we will need to create a Trunk. Click on Trunks and then Add Trunk and SIP Trunk.

Fill in the follow fields and once done, click on Submit Changes (again, note red banner at top).

Trunk Name: sipphone
username: sipsorcery username
password: sipsorcery password
SIP Server: sipsorcery.com
register: yes (inbound and outbound calls)

Outbound Caller ID: Your google voice number

4. Next, we need an inbound route, go to Inbound Routing and Add Incoming Route.

Fill in the following and click Submit once your done.

Extension (both regular and after hours): My Phone
Regular Hours: *
Days: *
Regular Hours: *
Days: *
Regular Hours: *
Days: *
No Override: Checked

5. Next, the outbound route, go to Outbound Routing and Add Outbound Route.

Fill in these fields and click Submit Changes when done:

Route Name: sipgate
Trunk Sequence: SIP/sipphone (click on it and then click add)
Valid for all number: Checked

That should complete the PBXes part. The last part will be configuring our SIP Client. Below is an example on how to setup Softphone, a SIP Client for the iPhone/iPod/iPad (retail) by Acrobits.

1. Tap on Settings > SIP Accounts > + sign to add.

2. Choose Generic SIP Account

Fill in the following and then click Save:

Title: name of account (ie PBXes)
Username: username-100 (your pbxes.com username w/the -100 extension we created)
Password (the password we created for the -100 extension in pbxes)
Domain: pbxes.com
Leave rest at default values.

Once your account is created, click on it and go to Advanced Settings. Fill in the proxy with: pbxes.com (i leave the transport protocol at tcp).

Listening port: 5060
Rest at the default values

Finally, time to test! I’ve noticed that reliability of incoming calls are not the greatest so this is NOT a replacement for a main phone line but more an alternative to having a second line or a way to utilize calling on a voice only plan (ie the iPad’s unlimited data).

NOTES/HINTS/TIPS:

-this worked on my macbook pro and win7 pc using the Softphone SIP Client and also on my iPad and iPhone 3GS (both using the iPads microsim data plan and Acrobits Softphone client).

-for a few days, i had problems with calls not making it to my devices. this appeared to be a problem on pbxes.com’s end. sometimes you will have times when things don’t work.

-if your behind a firewall, you will need to open up traffic to the 5060 port for devices on your local network making SIP/VOIP calls

-911 DOES NOT WORK, you can pay to get E911 service but it does require a monthly subscription fee. More info .

-Lastly, YMMV or so it seems. There are a lot of factors that can come into play when trying to do what we are doing: getting voice calls via a data only connection without a dedicated pbx.