Saturday, July 2, 2016

how to boot Cisco IOS from USB

Cisco 2811 with USB boot and v15 IOS

:: Prerequisites ::

So assume you are having Cisco 2811 router with USB port(s). Also realized that you don't have enough space on Flash Memory? So let's boot from USB Flash then :)
You need CSO account to download a bootstrap with USBBoot support from https://www.cisco.com
Bootstrap Filename:
C2800NM_RM2.srec.124-13r.T or newest C2800NM_RM2.srec.124-13r.T11


 
:: HOW-TO Boot Cisco IOS from USB flash disk ::

Insert USB (formatted as FAT32!) to your C2811 and check logs if router read yours USB flashdisk. If yes, great!
You can format your USB and when done stick it into your PC slot.

router#format usbflash0:

Copy the boostrap and Eject / Disconnect the USB flashdisk - no need to set-up boot flag.
Connect your freshly formatted USB with new bootstrap to Cisco router again.


:: CMDS ::

Commands needed: type enable to get router# privileged mode
sh file system
!
cd usbflash0:
!
pwd
!
dir
!
copy usbflash0:C2800NM_RM2.srec.124-13r.T11 flash:
!
dir flash:
! --verify if bootstrap is there
upgrade rom-monitor file C2800NM_RM2.srec.124-13r.T11
!           --router will reload here!

en
!
conf t
!
boot system usbflash0:c2800nm-adventerprisek9_ivs-mz.151-4.M10.bin
!
do wr
!
end
!
reload

And we are booting v. 15 Cisco IOS from USB flash now! :) 

Edit 7th July '16 12:11 GMT:
And if the booting is failing ... but you can read from the USB stick - boot it up from ROMMON.
Cisco router 2811 can work with 16GBs USB 3.0 stick.

In privileged enable mode issue commands:

sh file system
dir usbflash0:
verify usbflash0:c2800nm-adventerprisek9_ivs-mz.151-4.M10.bin


if all is ok

conf t
config-reg 0x2100
do wr
^Z

reload

-- router is reloading (config-register is set!)

dev
dir usbflash0:
boot usbflash0:c2800nm-adventerprisek9_ivs-mz.151-4.M10.bin 


Booted up finally?? :s :) 

:: Note 1 ::
Having two identical 2811 - just one missing PVDM module -- one was working like a charm, second one i couldn't get to boot the right IOS from USB.

:: Note 2
::


 Also tried few different USB sticks
-- Prolific 512MB -- doesn't work (USB Hub)


-- FlashTM 512 -- not working 
-- Samsung USB-DVD - not enough power



-- USB-SD-Reader - working! 


-- Kingston Datatraveler 3.0 16GB - working ok









 

Thursday, June 9, 2016

CISCO2811

CISCO2811 ISR - Integrated Services Router


So, 2x 2811 delivered together with 2x PIX/ASA 525.

Modular routers with HWIC slots, AIM slots, PVDM slots and NM slots

CISCO2811 01:
Having one PVDM module, 768MB RAM, 64MB CompactFlash, AIM-VPN/EPII-PLUS module, NM-CEM-4TE1 module, VWIC2-2MFT-T1/E1 & G703. Altogether with 2 USB ports and 2 FastEthernet interfaces.

CISCO2811 02:
The same just without the PVDM module.

So playing around with it.
###############################################

payozon-lab-rtr-e001>
 (C2800NM-ADVIPSERVICESK9-M), Version 12.4(9)T6
 
%VPN_HW-6-INFO_LOC: Crypto engine: aim 0  State changed to: Initialized 
%VPN_HW-6-INFO_LOC: Crypto engine: aim 0  State changed to: Enabled

%LINEPROTO-5-UPDOWN: Line protocol on Interface ceipnm10, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface VoIP-Null0, changed state to up

%LINK-3-UPDOWN: Interface Serial0/2/0:0, changed state to down
%CRYPTO-6-ISAKMP_ON_OFF: ISAKMP is OFF
%SSH-5-ENABLED: SSH 1.99 has been enabled
 

%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/2/0:0, changed state to down
 

%DSPRM-5-UPDOWN: DSP 1 in slot 0, changed state to up

payozon-lab-rtr-e002>

(C2800NM-ADVIPSERVICESK9-M), Version 12.4(3i)

...so now upgrading to adventerprisek9-ivs and mz 12.4(12T)

----- will continue with CISCO2811 Home Lab series




Sunday, June 5, 2016

GNS3 + VMWare + IOU

GNS3 + VMWare + Docker + IOU switching


I heard many people complaining that they prefer to use Packet Tracer over GNS, because it is easier. Respectively that it is difficult to install GNS3. So here we go with a howto Install GNS3 and VMWare virtual GNS3 see

So first things first > 

2. Install VMWare Player
--
chmod a+x VMware-Player-12.1.1-3770994.x86_64.bundle
sudo ./VMware-Player-12.1.1-3770994.x86_64.bundle
 
This makes the .bundle file executable (permission change) 
Start the installation.

3. Install GNS3

sudo add-apt-repository ppa:gns3/ppa
sudo apt-get update
sudo apt-get install gns3-gui
 
-- In case you want to use GNS3 in cloud (i.e. on Wedos VPS) install only gns3server and connect to it from local GUI app 
(connection via VPN recommended)
 
4. L2 switching

-- To be able to use L2 switch properly - I advise to use IOU images.
You can also practice Spanning Tree, Etherchannels, etc. 
-- You can also use L2 switch in VMWare or openvswitch

5. VDI and GNS3
-- Use Docker to see if networking between apps is running. Also good for quick light-weight virtualization of Linux Apps. Also use Virtual PC images via VMWare or VirtualBox (Win7, XP, full weight machines)
-- For full Linux OS virtualization use LXD / LXC - incredibly fast  & lightweight

-- In a case you are having 2 graphic cards install just in case:
sudo add-apt-repository ppa:yannubuntu/boot-repair
sudo apt-get update
sudo apt-get install -y boot-repair
boot-repair 

6. see Virtualization blog postto continue further ;)

GNS3 + VMWare + IOU

GNS3 + VMWare + Docker + IOU switching


I heard many people complaining that they prefer to use Packet Tracer over GNS, because it is easier. Respectively that it is difficult to install GNS3. So here we go with a howto Install GNS3 and VMWare virtual GNS3 see

So first things first > 

2. Install it
--
chmod a+x VMware-Player-12.1.1-3770994.x86_64.bundle
sudo ./VMware-Player-12.1.1-3770994.x86_64.bundle
 
This makes the .bundle file executable (permission change) 
Start the installation.

3. Install GNS3

sudo apt-get install software-properties-common
 sudo add-apt-repository ppa:gns3/ppa
sudo apt-get update
sudo apt-get install gns3-gui


4. L2 switching

-- To be able to use L2 switch properly - I advise to use IOU images.
You can practice than Spanning Tree, Etherchannels, etc. 
-- Use L2 switch in VMWare - working better from experience

5. VDI and GNS3
-- Use Docker to see if networking between apps is running. Also good for quick light-weight virtualization of Lniux. Also use Virtual PC images via VMWare, KVM, VirtualBox or LXD/LXC (Win7, XP, full weight machines)

-- In a case you are having 2 graphic cards install just in case:
sudo add-apt-repository ppa:yannubuntu/boot-repair
sudo apt-get update
sudo apt-get install -y boot-repair
boot-repair 

6. see Virtualization blog post

Tuesday, May 24, 2016

IOS Recovery via XMODEM / ws-c2960G-48L

Cisco IOS Recovery via XMODEM / ws-c2960G-48TC-L
ICND2 - CCNA Preparations


When refurbishsing 2010 Cisco Catalyst WS-C2960G with new IOS and fan, after reload i get memory allocation error and stayed in Switch rommon.

Access:
- via console Serial-to-RJ45 only
- just few commands working
- image corrupted on flash:

Switch :

during IOS update one of the switches stayed down


















sudo apt-get install lrzsz screen
sudo screen /dev/ttyUSB0 9600

dir
dir flash:
set
set BAUD 115200

Ctrl+C

sudo screen /dev/ttyUSB0 115200

copy xmodem: flash:c2960-lanbasek9-mz.122-55.SE10.bin

Ctrl + A
:
exec !! sx /cesta_k_bin-file/c2960-lanbasek9-mz.122-55.SE10.bin

...and IOS image was there OK ;)

So i enabled routing with commands below:
sdm prefer lanbase-routing
ip routing

and L3 switch is working good





Sunday, May 1, 2016

iPhone 4 (GSM) - 7.1.2 iCloud bypass tethered

(Baseband 04.12.09) activated with iTunes (from Win+Linux)

 Appz needed: 

iphone3.1 ... restore.IPSW (restore image)
SSH RAM Disk Tool
WINScp + Putty (or similar)
Newlibmobiledevice - (Win + Linux as well )
-- see the link .RAR5 on the end - no ads w/ complete tools

-- all was done from ThinClient Ubuntu which runs VM with Win7 ;)

How to bypass iCloud Activation on iPhone 4 7.1.2

- take out simCard!
- if not working - i forget something :D
- first restore to IPSW restore (iREB + itunes with shift)
- then from DFU - restore newest iOS (yes, 2nd restore works:)
- check the pictures below for some explanatory details








1. Device into DFU from iREB (only first time - limera1n)
2. Start SSH RAM Disk Tool and let it run (restart w/new DFU wrks better)
3. if going to Recovery - return back to DFU normally (power+home ...)
4. root + pass with port 2022 in green seen in Java console

5. edit /bin/mount.sh - mount_hfs rw /dev/disk0s1s1 1 0 (change ro to rw)
6. ./mount.sh
6. cd mnt1/Applications/ and rename setup.app to setup.app.old

7.  reboot

8. kick out from recovery -- > back to DFU
9. copy files from zip into directories:
-- cd mnt2/root/Library -- copy Caches + Lockdown folders from zip
-- in Lockdown place .pem files
-- cd mnt1/usr/libexec -- copy lockdownd file

10. reboot

11. ideviceinfo.exe (drag to cmd) - if FactoryActivated -- DONE!

12. go into iTunes and voila! >> NEW iPhone :)

12.5 -- if still not, activate FindMyIphone, activate Lost state, Erase and restore device -- than you will get lucky finally :F
-- really sorry lads, was playing with more iOSes and get lost in it / just don't put in the sim card until it shows up New iPhone in iTunes..


13. use Pangu 1.2 jailbrake - you have activated device now - but not needed, already having root write access to mnt1 and mnt2 ;) 

edit: Dunno if you need to restore twice - i had to...

** link:  http://uloz.to/xQiSuhkd/iphone4icloud-bypass-all-rar **


Sunday, January 31, 2016

Secure VoIP - traffic encrypted properly

Secure VoIP SRTP/ZRTP as per the RFC


Recently today i installed few new SRTP/ZRTP VoIP apps for testing. Until now was sure only about HW encryptions on routers, mainly Cisco.

Had some issues to get everything running properly.
There were a small changes to my laptop configs lately, but normal VoIP traffic and clients are running the whole time. So I wasn’t convinced it effected anything since all my clients continued to work properly, except ZRTP Jitsi.

 Obviously something had changed but no one around knew what it was :D

After some testing I discovered the problem!
It was related to insecure port connections from Jitsi, on port UDP 5060 to ostel .co servers. Secured connections runs on port TCP 5061 - and these were working as expected.

To make matters more confusing, I could register and make calls with two different softphones (CSipSimple and Linphone) on the same network, using the same ports for insecure connection to ostel.co on UDP port 5060.

WTF?


Probably the Jitsi is buggy ... but something just wasn't seem right -- do you know that feeling? 
So, I went back to my configs and pulled the SWARM backups.
(Thanks to Notepad++ for Compare Plugin)
What could the "server" be doing to this poor bastard?

With a WireShark running, tracerouting and pinging with crafted packets to OSTN servers, Jitsi running as well with extra tcpdump filtered packets only for UDP port 5060.

When I opened Jitsi and  (i) nfo  --  things got much more interesting.

For the curious, here’s the utility and options I used.
In case you are new to operating a SIP network, ngrep is an excellent tool for debugging ;)


[code]ngrep -d eth0 -t -p -W byline foo port 5060[/code]


I’ll include just an excerpts (only relevant headers) of the initial request from Jitsi.




So, on Jitsi app i can see below:

[code]
Audio info :
Media stream transport protocol : UDP / SRTP
(Key exchange protocol: ZRTP TWO-CM-256/EC25)
Codec / Frequency : SILK / 24000 Hz
Local IP / Port : 10.168.10.35 / 5020   <<<<
Remote IP / Port : 66.151.32.200 / 38944
Bandwidth : ↓ 14 Kbps ↑ 30 Kbps
Loss rate : ↓0% ↑ 0%
Packets decoded with FEC : 0
Packets currently being discarded : 51%
Number of discarded packets : 1392
(0 late, 1384 full, 8 shrink, 0 reset)
Adaptive jitter buffer : enabled
Jitter buffer : ~160ms; currently in queue: 8/16 packets
Jitter : ↓ 5 ms ↑ 2 ms
[/code] 

** IP addresses and usernames have been changed to protect the innocent **

[code]
U 2017/03/09 13:17:34.920749 0.0.0.0:5060 -> 66.151.32.200:5060
REGISTER sip:ostel.co SIP/2.0.
CSeq: 1 REGISTER.
From: "foo" ;tag=1eb3467e.
To: "foo" .
Via: SIP/2.0/UDP 0.0.0.0:49152;branch=z9hG4bK-393535-2269e43afef0b312554eb419a8d0540e.
User-Agent: Jitsi2.3.4752Linux.
Contact: "foo" ;expires=600.

[/code]

#
[code]
U 2017/03/09 12:17:34.921155 66.151.32.200:5060 -> 0.0.0.0:5060
SIP/2.0 401 Unauthorized.
CSeq: 1 REGISTER.
From: “foo” ;tag=1eb3467e.
To: “foo”
;tag=e01f0de2cdfebbeefc5ff0c8eabbb8b3.2f1f.
Via: SIP/2.0/UDP 0.0.0.0:49152;branch=z9hG4bK-393535-2269e43afef0b312554eb419a8d0540e;rport=5060.
WWW-Authenticate: Digest realm=”ostel.co”, nonce=”Uen0alHp8z4d6ePDl83RtMwARltAxzQu”, qop=”auth”.
Server: kamailio (4.0.2 (x86_64/linux)).
[/code]


If you read the response, you’ll see Kamailio sent 401 Unauthorized. This is normal for SIP authentication. A second client request should follow it, which should contain an Authorization header with an md5 and a nonce. When Kamailio receives this request, checks the auth database and sends a 200 OK response, the client is authenticated.
The SIP dialog looks good but Jitsi continues not to register. The dialog flow is cut off after the 408 Unauthorized response. It’s almost like something has blocked the response to the client.

Since I could register Linphone using the same account, I did the same trace for that client.
Here’s the excerpt.

[code]
U 2017/03/09 12:33:18.372770 0.0.0.0:42680 -> 66.151.32.200:5060
REGISTER sip:ostel.co SIP/2.0.
Via: SIP/2.0/UDP 0.0.0.0:49153;rport;branch=z9hG4bK359459505.
From: ;tag=142131416.
To: .
CSeq: 3 REGISTER.
Contact: .
User-Agent: LinphoneAndroid/2.1.2-1-g23b7fc0 (eXosip2/3.6.0).
.

[/code]
#

[code]
U 2017/03/09 12:33:18.373112 66.151.32.200:5060 -> 0.0.0.0:42680
SIP/2.0 401 Unauthorized.
Via: SIP/2.0/UDP 0.0.0.0:49153;rport=42680;branch=z9hG4bK359459505.
From: ;tag=142131416.
To: ;tag=e01f0de2cdfebbeefc5ff0c8eabbb8b3.4065.
CSeq: 3 REGISTER.
WWW-Authenticate: Digest realm=”ostel.co”, nonce=”Uen4GlHp9u4FwHNY/uE1iQQNCfGHJiob”, qop=”auth”.
Server: kamailio (4.0.2 (x86_64/linux)).

[/code]

This 408 Unauthorized response was received by the client and the follow up request with the Authorization header was sent with the correct digest. Linphone registered. I made a call. Everything worked fine. So WTF is happening?

I stared at these traces for a while to get a clue.
Look again at the first line of the request from Jitsi.
You’ll see a timestamp followed by two IP:port pairs.

Notice the port on the first IP is 5060 and the port on the second IP is also 5060. This means that the source port used by Jitsi on my home network is UDP port 5060. In order for a response to come back to Jitsi, it must enter my network on the same port it exited. Now read the top line of the response from Kamailio. Indeed, the server sent the response to UDP port 5060.
Now look at the same flow for Linphone. There is a very different source port in that dialog. In this case, Kamailio sent the response to UDP port 42680 and Linphone received it. Also notice the IP address used by Kamailio as the destination of the response is the same one in the dialog from Jitsi.
The question remained, why can’t Jitsi get the same kind of SIP response on UDP port 5060? Why is Jitsi using a single source port for outgoing traffic anyway? That value can be dynamic. I configured Jitsi to use a different port for insecure SIP. It has an advanced configuration for SIP with the key “SIP client port”. I set this to 5062 (5061 is conventionally used for secure SIP traffic so I incremented by 2) and tried to register again.
SUCCESSSSSSSSSSSS!
To be thorough, I changed Jitsi’s SIP port again to a 5 digit number I randomly typed on my keyboard without looking.
SUCCESSSSSSSSSSSS!



So if Jitsi can register to Kamailio on any port other than UDP port 5060, WTF is going on? I had a suspicion. I tried one more test before I called it. I configured Jitsi to connect on TCP port 5060. It registered successfully. Now I know what’s going on. I had a sad 🙁
CONCLUSION

My ISP, has a firewall running somewhere upstream that blocks incoming UDP traffic to port 5060. This probably falls under their TOS section which forbids “running servers” since Verizon provides voice services for an additional fee on top of data service, despite both running over the same fiber connection to my house. It seems like Verizon doesn’t want their data-only customers to get in the way of that sweet cheddar delivery each month in exchange for “phone service”.
This sucks on two levels.
LEVEL 1
Why is my ISP censoring my incoming traffic when I have 5 mbps of incoming bandwidth? I assume the answer is “because they can.” *desolate frowny face*
LEVEL 2
Why doesn’t Jitsi use a dynamic source port for SIP requests? I assume the answer is “Jitsi is open source, why don’t I change this and send a patch upstream?”
Both levels are formidable challenges to overcome. Convincing Verizon to play nice on the Internet feels like a vanity project. I’m writing that off. To make a change to the SIP stack in Jitsi is well within the area of the GP team’s expertise, myself included but it’s not a trivial undertaking. Since this is a default configuration change there is probably a reason upstream devs made this choice so in addition to the programming work there’s the work to convince the developers this would be a change worth a new release.
Since this is specific to Jitsi, I’m going to follow up with the developers and see if I missed anything. Stay tuned for part two.
Thanks for listening. Stay safe!