Monday, January 30, 2012

DHCP Server (Vista Compatible)

ref: http://www.russellconsultants.com/information/how-to-mainmenu-15/21-networking/43-dhcp-and-windows-vista.html

this is my own version. this setting like normal wireless router and works on my windows vistaa.


option domain-name "server.domain.com";
option domain-name-servers 8.8.8.8;
option netbios-name-servers 8.8.8.8;
option subnet-mask 255.255.255.0;
default-lease-time 600;
max-lease-time 7200;
ddns-update-style ad-hoc; ## Centos needs this
subnet 192.168.1.0 netmask 255.255.255.0 {
    range 192.168.1.150 192.168.1.252;
    option broadcast-address 192.168.1.255;
    option routers 192.168.1.1;
}

Other reading:
http://www.mail-archive.com/gnhlug-discuss@mail.gnhlug.org/msg27563.html
and: http://www.bravecobra.com/2008/6/18/windows-vista-not-accepting-ip-address-from-a-linux-dhcpd/

PXE setup centos

http://wiki.centos.org/HowTos/PXE/PXE_Setup

Guide: Install Debian using PXE

Simple Menu


/tftpboot/pxelinux.cfg/default
default menu.c32
prompt 0
timeout 300
ONTIMEOUT local

MENU TITLE PXE Menu

LABEL Pmajic
        MENU LABEL Pmajic
        kernel images/pmagic/bzImage
        append noapic initrd=images/pmagic/initrd.gz root=/dev/ram0 init=/linuxrc ramdisk_size=100000

label Dos Bootdisk
        MENU LABEL ^Dos bootdisk
        kernel memdisk
        append initrd=images/622c.img

LABEL CentOS 5 x86 NO KS eth0
        MENU LABEL CentOS 5 x86 NO KS eth0
        KERNEL images/centos/5/x86/vmlinuz
        APPEND ks initrd=images/centos/5/x86_64/initrd.img ramdisk_size=100000 ksdevice=eth1 ip=dhcp url --url http://xxx.xxx.xxx.xxx/mirrors/CentOS-5-i386/

LABEL CentOS 5 x86_64 NO KS eth0
        MENU LABEL CentOS 5 x86_64 NO KS eth0
        KERNEL images/centos/5/x86_64/vmlinuz
        APPEND ks initrd=images/centos/5/x86_64/initrd.img ramdisk_size=100000 ksdevice=eth1 ip=dhcp url --url http://xxx.xxx.xxx.xxx/mirrors/CentOS-5-x86_64/

windows vista DHCP fix

http://www.reviewingit.com/index.php/content/view/29/2/


WARNING: Only apply this patch if you are having problems do not apply it to all your network interfaces. 
Registry Tweaks for Vista DHCP Problems
HKLM\SYSTEM\CURRENTCONTROLSET\SERVICES\TCPIP\PARAMETERS\INTERFACES\{GUID}
Change
DhcpConnForceBroadcastFlag = 0
ADD DWORD
DhcpConnDisableBcastFlagToggle = 1
Also to disable IP V6

HKLM\SYSTEM\CURRENTCONTROLSET\SERVICES\TCPIP6\PARAMETERS\
ADD DWORD
DisabledComponents = FF (hex)

OR Download it HERE

monitor dhcp request

#tcpdump portrange 67-68

ref: http://danielmiessler.com/study/tcpdump/

Sunday, January 29, 2012

FTP on squid

i have a problem listing files on remote server
using squid

firstly make sure to load ip_nat_ftp on squid kernel !important!


# Module required for active an FTP server using NAT
modprobe ip_nat_ftp


then
# iptables -A FORWARD -j ACCEPT

if this failed: enable ftp bypass on squid
http://labtestproject.com/linux_network/step_by_step_enable_ftp_on_squid_proxy_in_linux_fedora_10.html


acl FTP proto FTP
always_direct allow FTP


reload squid server and you're done

make sure to uncheck PASV transfer on your ftp client (see ref 1)

good reources to read more:
1. http://enterprisedt.com/products/edtftpjssl/doc/manual/html/howtoftpthroughafilewall.html
2. http://www.linuxhomenetworking.com/wiki/index.php/Quick_HOWTO_:_Ch14_:_Linux_Firewalls_Using_iptables

Thursday, January 26, 2012

configuring DHCP server

http://www.linuxhomenetworking.com/wiki/index.php/Quick_HOWTO_:_Ch08_:_Configuring_the_DHCP_Server


dhcpd.conf File

You can define your server configuration parameters in the dhcpd.conf file which may be located in the /etc the /etc/dhcpd or /etc/dhcp3 directories depending on your version of Linux.
Note: The skeleton dhcp.conf file that is created when you install the package may vary in its completeness. In Ubuntu / Debian, the skeleton dhcpd.conf file is extensive with most of the commands deactivated with a # sign at the beginning. In Fedora / RedHat / CentOS an extensive sample is also created with activated commands. It is found in the following location which you can always use as a guide.
/usr/share/doc/dhcp*/dhcpd.conf.sample
Note: The dhcpd.conf configuration file formats in Debian / Ubuntu and Redhat / Fedora are identical.
Here is a quick explanation of the dhcpd.conf file: Most importantly, there must be a subnet section for each interface on your Linux box.
ddns-update-style interim
ignore client-updates
 
subnet 192.168.1.0 netmask 255.255.255.0 {
 
   # The range of IP addresses the server
   # will issue to DHCP enabled PC clients
   # booting up on the network
 
   range 192.168.1.201 192.168.1.220;
 
   # Set the amount of time in seconds that
   # a client may keep the IP address

  default-lease-time 86400;
  max-lease-time 86400;
 
   # Set the default gateway to be used by
   # the PC clients
 
   option routers 192.168.1.1;
   # Don't forward DHCP requests from this
   # NIC interface to any other NIC
   # interfaces
 
   option ip-forwarding off;
 
   # Set the broadcast address and subnet mask
   # to be used by the DHCP clients
 
  option broadcast-address 192.168.1.255;
  option subnet-mask 255.255.255.0;
  
   # Set the NTP server to be used by the
   # DHCP clients

  option ntp-servers 192.168.1.100;

   # Set the DNS server to be used by the
   # DHCP clients

  option domain-name-servers 192.168.1.100;
 
   # If you specify a WINS server for your Windows clients,
   # you need to include the following option in the dhcpd.conf file:

  option netbios-name-servers 192.168.1.100;
 
   # You can also assign specific IP addresses based on the clients'
   # ethernet MAC address as follows (Host's name is "laser-printer":

  host laser-printer {
      hardware ethernet 08:00:2b:4c:59:23;
     fixed-address 192.168.1.222;
   }
}
#
# List an unused interface here
#
subnet 192.168.2.0 netmask 255.255.255.0 {
}

squid redirection [setting]


#!/bin/sh
# chkconfig: 2345 99 00

case "$1" in
'start')
#---------------------------------------------------------------
# Load the NAT module
#
# Note: It is best to use the /etc/rc.local example in this
#       chapter. This value will not be retained in the
#       /etc/sysconfig/iptables file. Included only as a reminder.
#---------------------------------------------------------------

modprobe iptable_nat

#---------------------------------------------------------------
# Enable routing by modifying the ip_forward /proc filesystem file
#
# Note: It is best to use the /etc/sysctl.conf example in this
#       chapter. This value will not be retained in the
#       /etc/sysconfig/iptables file. Included only as a reminder.
#---------------------------------------------------------------

echo 1 > /proc/sys/net/ipv4/ip_forward

#---------------------------------------------------------------
# Allow masquerading
# - Interface eth0 is the internet interface
# - Interface eth1 is the private network interface
#---------------------------------------------------------------

#iptables -A POSTROUTING -t nat -o eth0 -s 192.168.1.0/24 -d 0/0 \
    #    -j MASQUERADE

#---------------------------------------------------------------
# Prior to masquerading, the packets are routed via the filter
# table's FORWARD chain.
# Allowed outbound: New, established and related connections
# Allowed inbound : Established and related connections
#---------------------------------------------------------------

iptables -A FORWARD -j ACCEPT
#Only port 80
#iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 8080

iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 0:442 -j REDIRECT --to-port 8080
# bypass SSL website
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 444:9999 -j REDIRECT --to-port 8080
#webmin port at 10000
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 10001:65535 -j REDIRECT --to-port 8080

#iptables -A FORWARD -t filter -o eth0 -m state -p tcp \
      #  --state NEW,ESTABLISHED,RELATED -j ACCEPT

#iptables -A FORWARD -t filter -i eth0 -m state -p tcp \
       # --state ESTABLISHED,RELATED -j ACCEPT    
#--state ESTABLISHED,RELATED -j ACCEPT

echo "Router started success!"
touch /var/lock/subsys/router
;;
'stop')
rm -f /var/lock/subsys/router
;;
*)
echo "Usage: $0 { start | stop }"
;;
esac
exit 0

GomezPeer Activation in Malaysia

this week (25/1 - 1/2 2012) i receive a letter from gomezpeerzone

http://carigold.com/portal/forums/showthread.php?p=12023681#post12013027

Action requested: Activations in your area‏

Dear PEER:

This week the Gomez PEER Zone will be activating new PEERs in your area . . . making it the perfect time for you to rack up the referral bonuses.

You will earn a $1 referral bonus for each new PEER we activate who enters your username in the "I Was Referred By" field on the application page; and right now we are aggressively activating in your area.

Simply click below to log-in to your account and fill out the referral form:

http://gomez.apis17.info

To stay up to date on all the latest Gomez PEER Zone promotions and incentives connect with us on our Twitter, Facebook and PEER News pages.

Thank you for your participation in the Gomez PEER program.

Cheers,

The Gomez PEER Team

Register your free account now & get cash when you online. :)
http://gomez.apis17.info

Wednesday, January 25, 2012

reduce LVM size

http://www.azhowto.com/2009/02/07/how-to-resize-lvm-running-xen-part-2-decrease-disk-size/

reducing LVM size takes more step than expanding. i already tried and it's works :)


I want to reduce the size of the XenWeb logical volume to 9G. First of all, let me shut it down.
[root@bpehhome2 mapper]# xm shutdown web
[root@bpehhome2 mapper]# pwd
/dev/mapper
[root@bpehhome2 mapper]# kpartx -a /dev/xenvg/XenWeb
[root@bpehhome2 mapper]# ls
control     xenvg-XenAuth           xenvg-XenWeb    xenvg-XenWebp2  XenWeb2
xenvg-root  xenvg-XenCentOSInstall  xenvg-XenWeb1   xenvg-XenWebp3  XenWeb3
xenvg-swap  xenvg-XenDebianDefault  xenvg-XenWebp1  XenWeb1
OK, let’s reduce the partition XenWeb2 size. I want XenWeb2 to be 9000M, but when I do the resize, I need to bring it abit lower, say 8500M. You will see why later.
[root@bpehhome2 mapper]# resize2fs XenWeb2 8500M
resize2fs 1.39 (29-May-2006)
Please run 'e2fsck -f XenWeb2' first.

[root@bpehhome2 mapper]# e2fsck -f XenWeb2
e2fsck 1.39 (29-May-2006)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/: 246385/2395520 files (1.0% non-contiguous), 1044750/2469993 blocks

[root@bpehhome2 mapper]# resize2fs XenWeb2 8500M
resize2fs 1.39 (29-May-2006)
Resizing the filesystem on XenWeb2 to 2176000 (4k) blocks.
The filesystem on XenWeb2 is now 2176000 blocks long.
Its time to resize the logical volumn
[root@bpehhome2 mapper]# lvresize -L 9000M /dev/xenvg/XenWeb
  Rounding up size to full physical extent 8.81 GB
  WARNING: Reducing active and open logical volume to 8.81 GB
  THIS MAY DESTROY YOUR DATA (filesystem etc.)
Do you really want to reduce XenWeb? [y/n]: y
  Reducing logical volume XenWeb to 8.81 GB
  Logical volume XenWeb successfully resized

additional information:
http://www.azhowto.com/2009/02/06/how-to-resize-lvm-running-xen-explained-part-1-increase-disk-size/
extending LVM size.

Saturday, January 21, 2012

[tips & trick] reboot on panic


# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE:  You do not have a /boot partition.  This means that
#          all kernel and initrd paths are relative to /, eg.
#          root (hd0,0)
#          kernel /boot/vmlinuz-version ro root=/dev/sda1
#          initrd /boot/initrd-version.img
#boot=/dev/sda
default 0
timeout 5
splashimage=(hd0,0)/boot/grub/splash.xpm.gz
hiddenmenu
fallback 1
title CentOS (2.6.18-274.7.1.el5.028stab095.1xen)
root (hd0,0)
kernel /boot/xen.gz-2.6.18-274.7.1.el5.028stab095.1 panic=10
module /boot/vmlinuz-2.6.18-274.7.1.el5.028stab095.1xen ro root=LABEL=/
module /boot/initrd-2.6.18-274.7.1.el5.028stab095.1xen.img
title CentOS (2.6.18-274.17.1.el5xen)
root (hd0,0)
kernel /boot/xen.gz-2.6.18-274.17.1.el5 panic=10
module /boot/vmlinuz-2.6.18-274.17.1.el5xen ro root=LABEL=/
module /boot/initrd-2.6.18-274.17.1.el5xen.img
title CentOS (2.6.18-238.el5xen)
root (hd0,0)
kernel /boot/xen.gz-2.6.18-238.el5 panic=10
module /boot/vmlinuz-2.6.18-238.el5xen ro root=LABEL=/
module /boot/initrd-2.6.18-238.el5xen.img

you can use webmin. put Kernel options : panic=10

kernel panic! boot on AHCI [solved]

http://serverfault.com/questions/68793/enabling-ahci-in-rhel5-post-install

[root@m02 ~]# vi /etc/modprobe.conf


#alias scsi_hostadapter ata_piix
alias scsi_hostadapter ahci
alias scsi_hostadapter1 usb-storage
alias net-pf-10 off
alias ipv6 off
options ipv6 disable=1
alias eth0 e1000
alias eth1 e1000e

http://forums.fedoraforum.org/showthread.php?t=202286

mkinitrd --allow-missing --preload=ahci --force-scsi-probe /boot/initrd-`uname -r`-custom `uname -r`

Thursday, January 19, 2012

Core 2 Duo vs. Dual Core

i'm wondering what is the different between core2duo and Dual Core (cheaper) processor.
see it yourself

# cat /proc/cpuinfo


processor       : 0 & 2
vendor_id       : GenuineIntel
cpu family      : 6
model           : 23
model name      : Intel(R) Core(TM)2 Duo CPU     E7500  @ 2.93GHz
stepping        : 10
cpu MHz         : 2926.042
cache size      : 3072 KB
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 13
wp              : yes
flags           : fpu tsc msr pae cx8 apic mtrr cmov pat clflush acpi mmx fxsr sse sse2 ss ht nx constant_tsc pni vmx est ssse3 sse4_1
bogomips        : 7317.47

i'm happy to get 3.00GHz (cheap Dual Core) processor but and..

# cat /proc/cpuinfo
processor       : 0
vendor_id       : GenuineIntel
cpu family      : 6
model           : 23
model name      : Pentium(R) Dual-Core  CPU      E5700  @ 3.00GHz
stepping        : 10
cpu MHz         : 1203.000
cpu MHz         : 2992.550 (previously read as 1.2GHz because of speed step technology)
cache size      : 2048 KB
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 13
wp              : yes
flags           : fpu tsc msr pae cx8 apic mtrr cmov pat clflush acpi mmx fxsr sse sse2 ss ht nx constant_tsc pni vmx est ssse3
bogomips        : 7484.01

Wednesday, January 18, 2012

virtualization wiki [xen]

storing url for my reference:
http://wiki.xen.org/xenwiki/HowTos


ubuntu fastest mirror

http://www.ubuntu9.com

downloading updates at 10MB/s :)


#This file was generated automatically at 2012-01-17 10:04:12.
#Please visit http://ubuntu9.com for more infomation.

deb http://www.mirror.upm.edu.my/ubuntu oneiric main restricted universe multiverse
deb-src http://www.mirror.upm.edu.my/ubuntu oneiric main restricted universe multiverse
deb http://www.mirror.upm.edu.my/ubuntu oneiric-security main restricted universe multiverse
deb-src http://www.mirror.upm.edu.my/ubuntu oneiric-security main restricted universe multiverse
deb http://www.mirror.upm.edu.my/ubuntu oneiric-updates main restricted universe multiverse
deb-src http://www.mirror.upm.edu.my/ubuntu oneiric-updates main restricted universe multiverse
deb http://www.mirror.upm.edu.my/ubuntu oneiric-proposed main restricted universe multiverse
deb-src http://www.mirror.upm.edu.my/ubuntu oneiric-proposed main restricted universe multiverse
deb http://www.mirror.upm.edu.my/ubuntu oneiric-backports main restricted universe multiverse
deb-src http://www.mirror.upm.edu.my/ubuntu oneiric-backports main restricted universe multiverse


ref: http://ubuntuforums.org/showthread.php?t=1472425

openvz memory limit error

use cat /proc/user_beancounters


http://forum.proxmox.com/threads/1495-Proxmox-OpenVZ-memory-Java-VMs-and-Zimbra


root@server:~# cat /proc/user_beancounters
Version: 2.5
       uid  resource           held    maxheld    barrier      limit    failcnt
       10:  kmemsize        3959248   14834766   49152000   52428800       1152
            lockedpages           0         16       2048       2048          0
            privvmpages       81230     135913     256000     256000        128
            shmpages            783       1560      21504      21504          0



check failcnt value. if 0 thats allright. above 0 you can adjust  that affected resources unit and apply.
use Openvz Web Panel: http://code.google.com/p/ovz-web-panel/ to modify openvz easily & free :)

Thursday, January 12, 2012

how to install CAcert on windows vista [solved]

Do you want FREE ssl certificate to test? use CAcert .here i show how to import CAcert root certificate into internet explorer and trusted by google chrome after successfully complete the process.

1. download root certificate:
https://www.cacert.org/index.php?id=3

2. click on PEM format: https://www.cacert.org/certs/root.crt

3. open downloaded file:

4. Click details > Copy to file


5. Save as cacert.crt on desktop

Now its time to install into internet explorer. google chrome will recognize trusted certificate from internet explorer after import process.

1. Click Internet Explorer.
2. click gear icon -> internet options


3. contents -> Certfificates



4. Click on Trusted Root Certification Authoriries tabs

5. Click Import and select previously created file (cacert.crt) saved on desktop.

6. Click next and OK for confirmation.

Done!

Finally open google chrome and you get green certificate icon for your own testing porpose SSL website or other application. is it cool? i think yes.



CAcert offers FREE certificate for testing purpose or internal use only.

CAcert does not offer EV certificate due to some ev requirement and security.

Other free certificate and already trusted on major browser is StartCom SSL. this is Israel based company and you can get free SSL for non-profit purpose such as educational website, fundrising etc. they will reject comercial request but you can buy there with lowest price. EV green certificate also offered.




Sendmail user unknown [solved]

today i have a problem sending email to my sendmail server.

sendmail returns User Unknown. the solution is:


i'm using webmin. click Local Domains (Cw) and enter your domain here. default value:

localhost
localhost.localdomain
>add domain.com here

manual setting:

Sunday, January 08, 2012

[solved] xm shutdown won't shutdown

need to post into xen mailing list but the archive was too old.

http://old-list-archives.xen.org/archives/html/xen-users/2005-09/msg00361.html

i have simple solution to shutdown frozen vm.

1. enter vm

#xm console 10

2. power off machine

#poweroff

this will shutdown frozen machine successfully and you will be able to reboot your server.
if your server won't reboot waiting for frozen vm, this will continue reboot process.

thank you.
Related Posts Plugin for WordPress, Blogger...