Saturday, October 5, 2013

Expand Android Internal Memory with link2SD

In most of the Android phones internal memory remains low which is between 200-400MB. And in most of the cases generally the apps get installed in the internal memory so it take spaces and finally when internal memory becomes full your phone get slow or hanged. Though there is chance to install the apps in SD card but in most of the cases they get installed in the internal memory in default. So to get release from this problem the best solution is to use link2SD which let you install the apps in a separate partition of your SD card.

clip_image002

Let me show the way to expand internal memory with link2SD.

Requirements:

1. Your phone must be rooted. Rooting of your phone varies on your phone model.

2. There should have two partitions and you should backup files from the SD card.

3. Remove your micro SD card from the phone and using a SD card adapter, connect it to you computer, either directly our using an SD card reader (normaly USB)

Step 1: Create partition on SD card:

There are two ways to create partition. I recommend you to use Mini Partition Wizard Home Edition, it’s free. Linux fans use GParted.

I’m going to use Mini Partition Wizard Home Edition, but if you ruin your SD card and windows / Mini Partition, does not recognize it, use the GParted Live CD (miracle worker), if you don’t have linux installed.

Using the Mini Partition Wizard create the following partitions:

  • Primary Fat32 Partition – Your normal SD card partition (with most of the sd cards space)

  • Primary Ext2 Partition – The partition that will hold the Apps that you move from the phone’s internal memory. Mine was 1.5 GB, but it all depends on you needs and you sd card size.

  • Primary Linux Swap – Used by linux for ram extension (something like windows pagefile), it should be at least as big as you phone’s RAM, mine is 512 MB.

Note: I used primary partitions but it’s possible that extended partitions migth work (didn’t test).

image

Now that we have completed creating partition now its time to configure link2SD.

Step 2 - Configuring link2SD:

· At first download link2SD

clip_image009

· Now install the app and launch it.

clip_image011

· When you launch the app it will ask to get superuser access.

· Allow the request

clip_image012

· Now it will as you to select the file system of your SD card’s second partition, select ext2 and tap OK.

clip_image013

· Now it will ask you to restart the phone, just tap OK to restart.

· After restarting your phone launch the link2SD app again.

clip_image014

· It will show you a dialogue, tap OK

clip_image015

· Now tap on the icon which you see in the screenshot and choose multi-select to select all.

clip_image016

· In this step go to Actions menu and select Create link then tick all the 3 options and tap OK

clip_image017

clip_image018

clip_image019

· Now configure the settings to create auto link in future.

clip_image020

clip_image021

· To do this go to Menu>Setting and Auto link and tick all the 3 options.

· Now exit the apps and forget about internal memory.

clip_image022

· To check memory status, launch link2SD and go to Storage Info.

Read more: http://www.androidever.com/expand-android-internal-memory-with-link2sd/#ixzz2gtFe3TfL

 

Based On: http://www.androidever.com/expand-android-internal-memory-with-link2sd/

Friday, September 27, 2013

Arduino PIR Motion Sensor / Detector

Make your own Arduino motion sensor / detector.  Maybe you want something to happen when you walk into a room, like have the lights turn on, or have your theme song play whenever you enter.

This tutorial will show you how to get your to Arduino sense motion around it.

Hardware used in this tutorial:

· Motion Sensor for Arduino, with wire jumpers

· Arduino board (Uno, Mega, Duemilanove, etc.)

Instructions:

If this is your first Arduino project, first go through our “Arduino: Getting Started” tutorial.

Connections:

Use the supplied male to female jumpers to make these connections:

Motion Detector

Pin

Arduino Pin

"-"

GND

"Out"

Arduino Pin 2

"+"

+5v

Like this:

clip_image001

Here is the front view of the module:

clip_image002

Software:

Download the example motion sensor for Arduino software here, and unzip the file

/* 
    Motion sensor for Arduino, example code
    Tutorial: 
http://www.hacktronics.com/Tutorials/arduino-motion-sensor.html
    Copyright: Mark McComb, hacktronics LLC
    License:
http://www.opensource.org/licenses/mit-license.php (Go crazy)
*/

const byte ledPin =  13;    // LED pin
const byte motionPin = 2;   // motion detector input pin
byte senseMotion = 0;       // variable to hold current state of motion detector

void setup() {
  // set the digital pin directions
  pinMode(ledPin, OUTPUT);     
  pinMode(motionPin, INPUT);
}

void loop()
{
    // Now watch for burglers
    senseMotion = digitalRead(motionPin);
    if (senseMotion == HIGH) {    // burgler found!
      digitalWrite(ledPin, HIGH);
    } else {                      // no burgler, yet...
      digitalWrite(ledPin, LOW);
    }
}

or copy the blue text above to motion_sensor_for_arduino.pde file.

You will now have a folder called “motion_sensor_for_arduino”

Start the Arduino software and load the Arduino Motion Sensor example program by clicking File->Sketchbook->Open

Navigate to the motion_sensor_for_arduino folder and select the “motion_sensor_for_arduino.pde” file.

Transfer the Arduino Motion Sensor program to your Arduino board by clicking the “Upload to I/O board” button. After uploading, you should see the LED on the Arduino board light up whenever there is motion detected.

It is that simple to add motion detection to your Arduino project.

Remember, it takes about 60 seconds after you first power up the motion sensor before it stars to detect motion.

You can adjust the amount of time that the motion detector lights the Arduino LED by adjusting the potentiometer screw on the back of the motion sensor module:

clip_image003

Happy Hacking!

Based On: http://www.hacktronics.com/Tutorials/arduino-motion-sensor.html

Saturday, September 21, 2013

Cisco to Huawei – Essential Command Mapping

CISCO

HUAWEI

ping

ping

traceroute

tracert

show

display

show interfaces

display interface

Show ip route

display routing-table

Show ip interface

Display ip interface

Show version

Display version

Show ip bgp

Display bgp routing-table

Show clock

Display clock

Show port

Display port-mapping

Show flash

dir flash: (on user view mode)

Show logging

Display logbuffer

Show snmp

Display snmp-agent statistics

Show frame-relay pvc

Display fr pvc-info

Show users

Display users

Show terminal length

screen-length disable

 

undo screen-length disable

enable

Super

disable

Super 0 (number is privilege level from 0 to 3, where 3 is default and equivalent to “enable” on Cisco)

Conf t

System-view

exit

quit

end

return

Show policy-map interface

Display qos policy interface

send

send (on user view mode)

write terminal (sh run)

display current-configuration

Sh startup

Display saved-configuration

[no equivalent: shows the files  used for startup]

Display startup

Write erase

Reset saved-configuration

Write mem (or wr or copy run  start)

save

clear counters

reset (on user view mode)

 

Reset counters interface

?

?

telnet

telnet

Enable secret (conf mode)

Super pass cipher (system mode)

Term mon

term debu

clock

clock

no

undo

debug / no debug

debugging / undo debugging

copy running-config

Save safely

terminal monitor

terminal monitor

terminal length

screen-length disable

 

undo screen-length disable

terminal no monitor

undo terminal monitor

clear counters

reset counters interface

clear interface

reset counters interface

clear crypto

ipsec sa

 

ike sa

clear access-list counters

reset acl counter all

reload

reboot

shutdown

shutdown

boot

boot bootrom

Aaa

hwtacacs scheme

terminal no monitor

undo terminal monitor

tacacs-server

hwtacacs scheme (in conf  command)

snmp-server

tftp-server (in conf command)

router bgp

bgp

Router rip

rip

ip tacacs

hwtacacs nas-ip (this  command doesn’t exist !!!)

mtu

Mtu (this command doesn’t exist !!!)

clear ip cef

reset ip fast-forwarding

clear ip route *

reset ip routing-table statistics protocol all

Clear ip bgp

Reset bgp all

Show tech

display diagnostic-information

Sh ip nat translation

Display nat session

Show Controller

display controller (but not relevant for non-modular chassis)

show dsl int atm 0

display dsl status interface Atm 2/0

sho atm pvc

Display atm pvc-info

debug pvc nego

Debug atm all (very dangerous – might crash router)

sho crypto isakmp sa

Display ike sa

sho crypto isakmp key

Display ike peer

sho crypto isakmp police

Display ike proposal

Taken From : http://lifeoflogs.blogspot.pt/2011/04/cisco-vs-huawei-essential-command.html

Monday, September 9, 2013

Step 2 - Sony Xperia Arc S - Howto Install Clockworkmod

clip_image001[1]

So you have rooted your Sony Xperia Arc S and now want to flash a custom ROM? It’s definitely possible. But in order to do that, you’re gonna need a custom recovery, preferably ClockworkMod Recovery to allow installation of such ROMs and Mods. While the recovery provides options to flash new ROMs, it also lets you make backups of your current ROM to share with your friends or maybe use it to restore your device to the working condition if you’ve messed up with it. This guide shows how you can install ClockworkMod Recovery on your Xperia Arc S device and enjoy a whole new world of custom ROMs!

I. Before You Begin:

1. You must have rooetd your device before doing this procedure. Check out our procedure on Step 1 - Sony Xperia Arc S - Howto Root to root your device.

2. This works on Windows based PCs only.

II. Downloading Required Files:

1. RecoverX (Download link’s given in the first post)

RecoverX Mirror

III. Installing ClockworkMod Recovery on the Sony Xperia Arc S:

1. Place the RecoverX Tool archive onto your Desktop.

2. Unzip files from the archive over to your Desktop.

3. Enable USB debugging on your device by going to Menu>>Settings>>Developer options>>USB debugging.

4. Connect your device to your PC using the USB cable.

5. Double-click on the RecoverX’s executable file and it’ll launch.

6. Select Sony Ericsson from Brand dropdown menu in the tool.

7. Select Xperia Arc S from the Device dropdown menu.

clip_image003

8. Now hit the Next button and it’ll start flashing the recovery on your device.

clip_image005

clip_image007

clip_image009

clip_image011

clip_image013

9. Follow any prompts you see on your screen.

10. Once it’s done, reboot your device.

11. You’re all set! Excellent! Your Xperia Arc S has been successfully equipped with CWM Recovery and you now have endless possibilities to customize your device!

12. To access the clockworkmod menu, reboot you phone and while it’s booting, press “volume down” many times until you get the clockworkmod menu.

image

Based On: http://theunlockr.com/2013/03/31/how-to-install-clockworkmod-recovery-on-the-sony-xperia-arc-s/

 

Alternative Method (On Your Phone)

  1. 1.Enable “USB Debugging” (Menu>>Settings>>Developer options>>USB debugging)
  2. On you phone go to “Google Play
  3. 2. Search for “X-parts
  4. 3. Install “X-Parts
  5. 4. Run “X-Parts
  6. 5. On “X-Parts” go to tab “Installs”
  7. 6. “X-Parts” will check te internet for a clockworkmod for your, if it finds the option “Install CWM” will appear
  8. 7. Select the option “Install CWM”
  9. 8. Wait, and it should be done
  10. 9. To access the clockworkmod menu, reboot you phone and while it’s booting, press “volume down” many times until you get the clockworkmod menu.

 

How Root and Install Custom Roms on Xperia Arc S

Step 1 - Sony Xperia Arc S - Howto Root

Root the Sony Ericsson Arc S (LT18i) with Android 4.0.4 ICS (Official Firmware)

clip_image002

This tutorial is intended for Sony Ericsson Arc S smartphones with Locked Bootloader .

Follow the steps that are on this page to check if the Bootloader is locked or not .

http://unlockbootloader.sonymobile.com/instructions

First check if you have the the Sony PC Companion (USB Drivers) installed so that you can the smartphone the PC , if they are not download here

Now let´s begin the process :

1 - The USB debugging option must be Enabled ( Settings / Developer Options / USB debugging ).

2 - The smartphone battery should be at least 80 % -85 % .

3 - Backup the data you have on your smartphone, just in case something goes wrong .

4 - Download FlashTool for Xperia Arc S and install on your PC here

5 - Download DooMLoRD_v1_Xperia-2011-ICS-ROOT-emu-busybox-su to your PC and extract with Winrar for example here

6 - Now download the kernel Android 4.0.3 (LT18i_4.0.3_kernel.ftf) here and Android 4.0.4 (Lt18i_4.1.b.0.587_kernel) here

7 - Connect your smartphone to your computer

8 - Drag the Android kernel 4.0.3 into the folder " firmware " which is located inside the Flashtool folder (C :/ Flashtool / firmwares ), open the FlashTool and follow the steps as in the images below:

clip_image004

clip_image006

clip_image008

clip_image010

In the image below is the list of firmwares that are in the Flashtool , select LT18i_4.0.3_kernel what it says and then just push “Flash” and wait for it to be installed on the smartphone .

clip_image012

clip_image014

clip_image016

clip_image018

The smartphone will restarting during this process .

9 - The USB debugging option must be Enabled ( Settings / Developer Options / USB debugging ).

After the smartphone to be powered back on, do the following:

  • Enable the “USB Debugging” (Settings / Developer Options / USB debugging)
  • Enable the "Unknown Sources" (Menu\Settings\Security),
  • Run the file " runme.bat " we extracted in step 5 . The smartphone will restart 2 or 3 times, as part of the process .

clip_image020

clip_image022

Full procedure output:

clip_image024

10 - Now this process is similar to the step 8 , we drag the Android 4.0.4 (Lt18i_4.1.b.0.587_kernel) to C:/Flashtool/firmwares and do the same thing that was done in step 8.

clip_image026

clip_image028

clip_image030

In the image below selects what it says Lt18i_4.1.b.0.587_kernel and then just push “Flash” and expect it to be installed on the smartphone.

The smartphone will restarting during this process .

clip_image032

clip_image034

clip_image036

11 - If all has gone well , you now have your Sony Ericsson Arc S with Root

If PC Companion asks you to update just ignore.

If you update your phone will go back to the original stock rom (no root, no clockwork mod)

clip_image038

Based On: http://crimo-blog.blogspot.pt/2013/02/como-fazer-root-no-sony-ericsson-arc.html#.Ui5FyPJdZzM

How Root and Install Custom Roms on Xperia Arc S

Tuesday, September 3, 2013

RAM Disks - Explained

Your computer’s RAM is still faster than even modern solid-state drives. RAM disks take advantage of this, using your computer’s RAM as a lightning-fast virtual drive. But you probably don’t want to use a RAM disk, anyway.

RAM disks are easy to sell — all you have to do is hold up performance benchmarks showing how much faster it is to read data from RAM than it is from even a fast SSD. But this isn’t the full picture.

What’s a RAM Disk?

To create a RAM disk, you would install a third-party program that creates a virtual drive in Windows. This program would reserve a section of your RAM — so if you had 4 GB of files in your RAM disk, the disk would take up 4 GB of RAM. All the files on your disk would be stored in your RAM. When you wrote to the disk, you’d just be writing to a different section of your RAM.

Initially, this seems like it could help optimize performance. If you installed programs in a RAM disk, you’d have near-instant load times because their data would already be stored in the fastest memory possible. When you save a file, it would happen almost instantly as it would just be copied to another portion of RAM. This would mean faster application load times and faster file read/write times for files saved in the RAM disk.

clip_image004

Why You Probably Shouldn’t Use One

However, there’s a big problem here. RAM is volatile memory. When your computer loses power, the contents of your RAM will be erased. This means that you can’t store anything important on a RAM disk — if your computer crashed because of lost power, you’d lose all the data in your RAM disk. So saving files to the RAM disk is pointless unless you don’t care that you’d lose the files — but if you didn’t care about the files, why save them in the first place?

Because RAM isn’t persistent, you’d also have to save the contents of your RAM disk to disk when you shut down your computer and load them when you turn it on. For example, let’s say you installed Photoshop to your RAM disk. You’d have to save an copy of your RAM disk to your computer’s hard drive to ensure you wouldn’t lose your Photoshop installation. You may want to do this automatically every few minutes or just at shut down.

When you turn on your computer, the RAM disk program would have to read the RAM disk image from your hard drive and load it back into RAM. In other words, you’re simply getting faster program-load times at the expense of longer boot-up times. Once your computer loads an application or other files form its hard drive, it caches them in RAM anyway — so it’s a bit silly to install an application or game in a RAM disk rather than on your hard drive. Either way, once you load the application, it will stay present in your memory for quick loading later.

clip_image006

RAM disks also reserve a good chunk of your memory, ensuring you can’t use it for anything else. Windows uses unused memory to cache files anyway, and it does it all automatically and in the background. If you need the memory for something, Windows will instantly discard the cached data. With a RAM disk, you’d have to shut it down manually to free up memory.

How You Would Make a RAM Disk

Making a RAM disk is pretty simple. Install a program like DataRAM’s RAMDisk Personal — the free version allows you to create RAM disks up to 4 GB in size — and use it to create a new RAM disk.

You can then install programs to it or move files to it. You’ll want to save a copy of the RAM disk so you won’t lose the data if your computer ever goes down. Of course you’ll have to save a new image every time you update the files on the RAM disk.

clip_image009

There Must Be Some Uses For a RAM Disk, But…

RAM disks aren’t a complete scam like PC cleaning programs and many other “system-optimization” tools are. It’s definitely faster to read and write from RAM rather than to use even a fast SSD. There are likely some good uses for RAM disks if you really know what you’re doing.

However, both of the following would have to be true:

· You’d have to be using a program doesn’t normally use RAM as a cache and instead insists on reading and writing small files to your hard drive.

· You’d have to not care about any of these files and have no problem if you lose them.

This is a high bar to clear — most programs that have a cache you don’t necessarily care about will use RAM, anyway. For example, there’s no point in placing Photoshop’s scratch file on a RAM disk because Photoshop uses RAM as a cache if it’s available. Your web browser will store its cache files in RAM if there’s space, too.

For programs that do write and read data from the hard drive, this data is likely something you don’t want to lose. Using a RAM disk with an important database would be a mistake because you’d lose the database if a crash or power loss occurred.

RAM-Based Solid-State Drives

If you do want to benefit from the speed of RAM, you may want to try investing in a RAM-based solid-state drive. These are solid-state drives that contain RAM instead of typical Flash memory. They’re much faster to read and write to, but also much more expensive because RAM is more expensive than Flash memory.

Such drives contain a battery, so they can maintain the contents of the RAM if the computer loses power. They  have enough battery power to write the data to offline memory, ensuring you won’t lose whatever you stored in their RAM.

Such drives aren’t for the average user — they’re extremely expensive options intended for data centers and other business uses where you want the speed of RAM with the stability of SSDs. But these drives make much more sense than software RAM disks if you really need RAM-like speeds for mission critical purposes.

In summary, RAM disks do work as advertised. But you probably don’t want to use them, anyway. They’re not ideal for running an important database or speeding up game load times.

If you do have a smart use for a RAM disk, leave a comment — we’d like to know what people are actually using them for.

Taken From: http://www.howtogeek.com/171432/ram-disks-explained-what-they-are-and-why-you-probably-shouldnt-use-one/

Friday, August 23, 2013

Cisco BGP - Prevent Transit AS

By default BGP will advertise all prefixes to EBGP (External BGP) neighbors. This means that if you are multi-homed (connected to two or more ISPs) that you might become a transit AS. Let me show you an example:

R1-two-ISPs-3-loopback

R1 is connected to ISP1 and ISP2 and each router is in a different AS (Autonomous System). Since R1 is multi-homed it’s possible that the ISPs will use R1 to reach each other. In order to prevent this we’ll have to ensure that R1 only advertises prefixes from its own autonomous system.

As far as I know there are 4 methods how you can prevent becoming a transit AS:
- Filter-list with AS PATH access-list.
- No-Export Community.
- Prefix-list Filtering
- Distribute-list Filtering

Prefix-lists or distribute-lists will work but it’s not a very scalable solution if  you have thousands of prefixes in your BGP table. The filter-list and no-export community work very well since you only have to configure them once and it will not matter if new prefixes show up. First we’ll configure BGP on each router:

R1(config)#router bgp 1
R1(config-router)#
neighbor 192.168.12.2 remote-as 2
R1(config-router)#neighbor 192.168.13.3 remote-as 3

ISP1(config)#router bgp 2
ISP1(config-router)#neighbor 192.168.12.1 remote-as 1

ISP2(config)#router bgp 3
ISP2(config-router)#neighbor 192.168.13.1 remote-as 1

The commands above will configure EBGP (External BGP) between R1 – ISP1 and R1 – ISP2. To make sure we have something to look at, I’ll advertise the loopback interfaces in BGP on each router:

R1(config)#router bgp 1
R1(config-router)#network 1.1.1.0 mask 255.255.255.0

ISP1(config)#router bgp 2
ISP1(config-router)#network 2.2.2.0 mask 255.255.255.0

ISP2(config)#router bgp 3
ISP2(config-router)#network 3.3.3.0 mask 255.255.255.0

With the networks advertised, let’s take a look at the BGP table of ISP1 and ISP2 to see what they have learned:

ISP1#show ip bgp
BGP table version is 4, local router ID is 11.11.11.11
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, r RIB-failure, S Stale

Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*> 1.1.1.0/24       192.168.12.1          0             0         1 i
*> 2.2.2.0/24       0.0.0.0                  0         32768       i
*> 3.3.3.0/24       192.168.12.1                                   0 1 3 i

ISP2#show ip bgp
BGP table version is 4, local router ID is 33.33.33.33
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight  Path
*> 1.1.1.0/24       192.168.13.1          0               0       1 i
*> 2.2.2.0/24       192.168.13.1                           0       1 2 i

*> 3.3.3.0/24       0.0.0.0                  0             32768   i

The ISP routers have learned about each other networks and they will use R1 as the next hop. We now have everything in place to play with the different filtering techniques.

 

Filter-list with AS PATH access-list

Using an filter-list with the AS PATH access-list is probably the most convenient solution. It will ensure that you will always only advertise prefixes from your own autonomous system.

Here’s how to do it:
R1(config)#ip as-path access-list 1 permit ^$

R1(config-router)#neighbor 192.168.12.2 filter-list 1 out
R1(config-router)#neighbor 192.168.13.3 filter-list 1 out

The ^$ regular expression ensures that we will only advertise locally originated prefixes. We’ll have to apply this filter to both ISPs.

Keep in mind that BGP is slow…if you are doing labs, it’s best to speed things up with clear ip bgp *

Let’s verify our configuration:

R1#show ip bgp
BGP table version is 4, local router ID is 22.22.22.22
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*> 1.1.1.0/24       0.0.0.0                  0         32768 i
*> 2.2.2.0/24       192.168.12.2             0             0 2 i
*> 3.3.3.0/24       192.168.13.3             0             0 3 i

R1 still knows about the prefixes from the ISP routers. What about ISP1 and ISP2?

ISP1#show ip bgp
BGP table version is 7, local router ID is 11.11.11.11
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*> 1.1.1.0/24       192.168.12.1          0                0      1 i
*> 2.2.2.0/24       0.0.0.0                  0         32768         i

ISP2#show ip bgp
BGP table version is 7, local router ID is 33.33.33.33
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*> 1.1.1.0/24       192.168.13.1                 0         0      1 i
*> 3.3.3.0/24       0.0.0.0                         0      32768     i

ISP1 and ISP2 only know about the 1.1.1.0 /24 network. Excellent, we are no longer a transit AS! On to the next method…

 

No-Export Community

Using the no-export community will also work pretty well. We will configure R1 so that prefixes from the ISP routers will be tagged with the no-export community. This ensures that the prefixes from those routers will be known within AS 1 but won’t be advertised to other routers.

R1(config)#route-map NO-EXPORT
R1(config-route-map)#set community no-export

R1(config)#router bgp 1
R1(config-router)#neighbor 192.168.12.2 route-map NO-EXPORT in
R1(config-router)#neighbor 192.168.13.3 route-map NO-EXPORT in

I’m only using one router in AS 1, if you have other routers and are running IBGP (Internal BGP) then don’t forget to send communities to those routers with the neighbor <ip> send-community command.

Let’s see what ISP1 and ISP2 think about our configuration:

ISP1#show ip bgp
BGP table version is 11, local router ID is 11.11.11.11
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*> 1.1.1.0/24       192.168.12.1          0               0      1  i
*> 2.2.2.0/24       0.0.0.0                  0             32768     i

ISP2#show ip bgp
BGP table version is 11, local router ID is 33.33.33.33
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*> 1.1.1.0/24       192.168.13.1          0             0         1 i
*> 3.3.3.0/24       0.0.0.0                  0         32768         i

They only know about network 1.1.1.0 /24. Onto the next method!

 

Prefix-List Filtering

Using a prefix-list we can determine what prefixes are advertised to our BGP neighbors. This works fine but it’s not a good solution to prevent becoming a transit AS. Each time you add new prefixes you’ll have to reconfigure the prefix-list. Anyway let me show you how it works:

R1(config)#ip prefix-list NO-TRANSIT permit 1.1.1.0/24

R1(config-router)#neighbor 192.168.12.2 prefix-list NO-TRANSIT out

R1(config-router)#neighbor 192.168.13.3 prefix-list NO-TRANSIT out

The prefix-list above will only advertise 1.1.1.0 /24 to the ISP routers. Let’s verify the configuration:

ISP1#show ip bgp
BGP table version is 17, local router ID is 11.11.11.11
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*> 1.1.1.0/24       192.168.12.1             0             0 1 i
*> 2.2.2.0/24       0.0.0.0                  0         32768 i

ISP2#show ip bgp
BGP table version is 17, local router ID is 33.33.33.33
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*> 1.1.1.0/24       192.168.13.1          0               0       1 i
*> 3.3.3.0/24       0.0.0.0                  0         32768         i

The prefix-list is working as it should, onto the last exercise!

 

Distribute-list Filtering

This method is similar to using the prefix-list but this time we’ll use an access-list.

R1(config)#ip access-list standard NO-TRANSIT
R1(config-std-nacl)#permit 1.1.1.0 0.0.0.255

R1(config-router)#neighbor 192.168.12.2 distribute-list NO-TRANSIT out
R1(config-router)#neighbor 192.168.13.3 distribute-list NO-TRANSIT out

Time to check the ISPs:

ISP1#show ip bgp
BGP table version is 23, local router ID is 11.11.11.11
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, r RIB-failure, S Stale

Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*> 1.1.1.0/24       192.168.12.1          0               0       1 i
*> 2.2.2.0/24       0.0.0.0                  0          32768        i

ISP2#show ip bgp
BGP table version is 23, local router ID is 33.33.33.33
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*> 1.1.1.0/24       192.168.13.1          0             0        1 i
*> 3.3.3.0/24       0.0.0.0                  0         32768        i

That’s all there is to it. I hope this has been helpful for you, if you know of any other methods to prevent becoming a BGP transit AS please leave a comment!

Taken From: http://networklessons.com/bgp/bgp-prevent-transit-as/