c3560 Cheat

Hostname:
hostname test

Image Upgrade:
del /r /f flash:c3560-ipbase-mz.122-35.SE5
copy tftp://192.168.2.1/images/c3560-ipbasek9-mz.122-46.SE.bin flash:

del - File
rm - Folder

Boot with other Image:
boot system c3560-advipservicesk9-mz.122-46.SE.bin

Portfast (on dhcpd Problems):
spanning-tree portfast

Switchport with Vlan 10:
interface FastEthernet0/1
switchport access vlan 10
switchport mode access
description nativ
macro description NATIV
spanning-tree portfast

Description Vlan 10:
vlan 10 name testvlan

Trunkport:
interface GigabitEthernet0/1
switchport trunk encapsulation dot1q
switchport mode trunk
ip dhcp snooping trust

DHCP Snooping:
Global Activate:
ip dhcp snooping vlan 1-4094
no ip dhcp snooping information option
ip dhcp snooping

Allow DHCP on Port:
ip dhcp snooping trust

ESXi Trunking:
ip dhcp snooping vlan 1-4094
no ip dhcp snooping information option
ip dhcp snooping

these are the vlans, one main, one “test” for the vm
vlan 1
name main
vlan 999
name test

normal client port
interface FastEthernet0/1
switchport access vlan 1
spanning-tree portfast

vm client port which does access vlan 999
interface FastEthernet0/3
switchport access vlan 999
spanning-tree portfast

vm server port, which does access normal vlan 1, and does trunk the rest
” ip dhcp snooping trust” means, that this port is allowed to answer dhcp requests
interface FastEthernet0/7
switchport trunk encapsulation dot1q
switchport trunk native vlan 1
switchport trunk allowed vlan 1,999
switchport mode trunk
ip dhcp snooping trust
end

Routing with c3560-advipservicesk9-mz.122-46.SE.bin:
( Every Net needs a own Vlan! )
( The Vlan Ip is the Gateway )

ip routing

interface FastEthernet0/1
switchport access vlan 2
switchport mode access

interface FastEthernet0/8
switchport access vlan 3
switchport mode access

interface Vlan2
ip address 134.96.10.1 255.255.255.0

interface Vlan3
ip address 192.168.2.1 255.255.255.0

c3560 Routing with Advanced IP Services

Problem: You got serval networks, you got an c3560 but no Router.
Solution: Get an c65e VSS
Following Problem: Insufficient Money, Power, Space,....
Solution: Get your c3560 to route these Networks with an Advanced IP Services Firmware
YOU DO NEED AN "advipservices" FIRMWARE ON YOUR c3560!

Assumption:
On f0/1 PC with 134.96.10.2 -> We want the Gateway to be 134.96.10.1
On f0/8 PC with 192.168.2.2 -> We want the Gateway to be 192.168.2.1

How to:
Easy Idea - for an normal routing process you need an Interface in the "to be routed" net.
And there for the Solution lies in the usage of vlans.
Every port that uses one net is bound to the vlan of that net.
Every net get its own vlan.
Every vlan gets an ip (the gateway ip thats entered into the pcs of this net).
Activate routing.
Done.

Configuration:

interface FastEthernet0/1
switchport access vlan 2
switchport mode access

interface FastEthernet0/8
switchport access vlan 3
switchport mode access

interface Vlan2
ip address 134.96.10.1 255.255.255.0

interface Vlan3
ip address 192.168.2.1 255.255.255.0

ip routing

SCP with Plain Password

My altered Version:

Call it with ./scp_bkp.sh User Password BKPPath ServerIP

#!/usr/bin/expect -f

set USER [lrange $argv 0 0]
set PW [lrange $argv 1 1]
set BKPPath [lrange $argv 2 2]
set IP [lrange $argv 3 3]

# 1 User, 2 PW, 3 BkpPath, 4 IP

# trick to pass in command-line args to spawn
#eval spawn scp $argv
eval spawn scp $USER@$IP:/bootbank/state.tgz $BKPPath

expect "password: $"
send "$PW\n"

# wait for regular shell prompt before quitting
# probably a better way using 'wait'
expect "$ $"

Orginally taken from: http://tiebing.blogspot.com/2009/01/scp-with-automatic-password-input.html

[VMWare] How to shrink Virtual Harddrives?

You want to shrink an too big harddrive on your VM?
Ok, lets go:

1.) Create an Harddrive in your VM which does have the desired size as second Drive
2.) Boot the VM with an Parted Magic ISO (http://partedmagic.com)
3.) Choose GParted and size your existing Harddrive down so that it will fit into the new Drive
4.) Choose Clonezilla, start for Local Disk, Local Disk to Local Disk, choose your old Disk as Source and the new as Destitination and Expert Modus.
4b.) Don't change anything in Expert, just klick through and accept the new MBR and Co.
5.) After thats done, you're done! Shut down, remove the first Harddrive (just remove from VM, NOT ERASE FROM ESXi!) and select the "new" Drive and set it to the SCSI Path the old one was (0:0:0) or so - fire it up! It should boot.

If it doesn't, get the new drive again to second with the second scsi path, insert the old drive as first again, and try again. Mostly works on second trial.

PS: If you got an Windows VM, try to use Acronis True Image Home 11 and its harddrive clone function. Works better on MS Products.

[ESXi 3.5] Output Bootup / Working Logs to Serial Connections

Very cool feature which you can enable by using the Viclient.

Go to
Configuration,
Advanced Settings,
VMKernel,
Boot,
VMkernel.Boot.serialPort

There you can set your wanted Serial Port.
0 means "no Output", 1 "Com1", 2 "Com2", etc...

Just enter you wanted Serial Port, Ok, Close, Shutdown the Server, hook up to the Serial Port with an Console Cable, get your Console open (115200er Speed, you can change that aswell!) and boot up the Server... Tada! Ok, thats only the log for Bootup!

If you want an Output for "Working ESXi", you need to go to
Configuration,
Advanced Settings,
Misc,
Misc.SerialPort

Settings are the same as above.

Enjoy

[ESXi 3.5] PXE Boot to working ESXi 3.5 Hypervisor

Need:
- ESXi 3.5 Iso File
- http://www.accessdata.com/downloads/current_releases/imager/Imager%20Lite%202.6.1.zip to open Iso and extract Files
- 7zip, WinRar, or whatever to unzip Files (7zip Recommended)
- http://syslinux.zytor.com/wiki/index.php/PXELINUX

ESXi 3.5 Extract:
1.) Extract the install.tgz from \CDROM\Sessions 1\Track 01\CDROM.
Its the Rock Ridge (RR in Isobuster) Session. Do NOT choose the one from the ISO / Boot part!

2.) Unzip the install.tgz.

3.) Extract the VMware-VMvisor-big-3.5.0_Update_4-153875.i386.dd.bz2 from the path install\usr\lib\vmware\installer to an directory of your choice.

4.) Unzip the VMware-VMvisor-big-3.5.0_Update_4-153875.i386.dd.bz2

5.) Open the File with FTK Imager.

6.) Extract the files of in Partition4\root (4 Files ldlinux.sys, mbootc32, safeboot.c32, syslinux.cfg - which are the bootloaders)

7.) Extract the files of in Partition5\root (7 Files bindmod.tgz, boot.cfg, cim.tgz, environ.tgz, license.tgz, oem.tgz, vmkernel.tgz - which are the ESXi Program Files)

PXELinux Extract:
- com32/mboot/mboot.c32
- com32/menu/menu.c32
- core/pxelinux.0

TFTP
- Create root Folder
- Copy all files from partition5\root Section within that Folder
- Copy all files from PXELinux Extract Section within that Folder
- Create Folder "pxelinux.cfg" within the root Folder
- Create an text file "default" (with NO File Ending or such) in that folder, with following text:

default menu.c32
menu title PXE Boot VMware ESXi
timeout 100

label ESXi
menu label Boot VMware ESXi
kernel mboot.c32
append vmkernel.gz --- binmod.tgz --- environ.tgz --- cim.tgz
ipappend 2

label Hard
menu label Boot from local drive
localboot 0

- Setup your tftp Server as you normally would and PXE Boot!
(For example see my PXE Boot Bart PE Post for setting up Tftpd32 for Windows)

Taken from: http://docs.google.com/View?docid=ddcwgcd6_4fs6s7jcf

[ESXi 3.5] oem.tgz and the power behind it

So, I'm going to write a quick info about ESXis most famous oem.tgz.
The oem.tgz is an file supplied by two sources:
a) the "install" oem.tgz which does sit in the root of your install medium (like pxe tftpboot, or cdrom root)
this is ONLY used DURING the installation
b) the "installed" oem.tgz which does sit in the file install.tgz
this file gets copied during the installation and is therefore active AFTER the installation.
detailed path is in
usr\lib\vmware\installer\Core\VMware-VMvisor-big-3.5.0_Update_4-153875.i386.dd.bz2
unziped to VMware-VMvisor-big-3.5.0_Update_4-153875.i386.dd
and there in Partition 5 the oem.tgz
(AccessData FTK Imager Lite to access)

Do you want to change the oem.tgz of an running ESXi System?
Just enable SSH, use Winscp and copy your oem.tgz to the folder /bootbank and replace the old, empty oem.tgz

The oem.tgz enables you to change the way the installation works.
You can for example add drivers, or add Vendor/Device Codes to the driver table

Mostly used:
- add Vendor / Device code:
/etc/vmware/simple.map

- driver
/mod

Look up driver in ESXi:
lspci -v

Watch which device does load which driver:
lspci -p

Is an HDD recognized?
fdisk -l

Just some quick infos

[ESXi 3.5] PXE Boot to Install

Easy as Cake:
Copy these files from the install CD:
BINMOD.TGZ, CIM.TGZ, IENVIRON.TGZ, LICENSE.TGZ, MBOOT.C32, MENU.C32, OEM.TGZ and VMKERNEL.GZ into your tftpboot Directory.

Insert the normal needed pxelinux.0 File, as well as the pxelinux.cfg Folder which contains following File called "default":

default menu.c32
menu title PXE Boot VMware ESXi
timeout 100

label ESXi3.5U4 Install
kernel mboot.c32
append vmkernel.gz --- binmod.tgz --- ienviron.tgz --- cim.tgz --- oem.tgz --- license.tgz --- install.tgz
ipappend 2

label Hard
menu label Boot from local drive
localboot 0

Have fun!

Taken from: http://www.vm-help.com/esx/esx3i/ESXi_PXE_install.html