Pages

June 22, 2011

Set outgoing IP address in Solaris 10

root@sol3 # route get default
   route to: default
destination: default
       mask: default
    gateway: 192.168.168.2
  interface: e1000g0:1
      flags:
 recvpipe  sendpipe  ssthresh    rtt,ms rttvar,ms  hopcount      mtu     expire
       0         0         0         0         0         0      1500         0



root@sol3 # ifconfig -a
lo0: flags=2001000849 mtu 8232 index 1
        inet 127.0.0.1 netmask ff000000
e1000g0: flags=9040843 mtu 1500 index 2
        inet 192.168.168.31 netmask ffffff00 broadcast 192.168.168.255
        groupname prodgr
        ether 0:c:29:20:e6:9
e1000g0:1: flags=1000843 mtu 1500 index 2
        inet 192.168.168.41 netmask ffffff00 broadcast 192.168.168.255
e1000g0:2: flags=1000843 mtu 1500 index 2
        inet 192.168.168.51 netmask ffffff00 broadcast 192.168.168.255
e1000g1: flags=69040843 mtu 1500 index 3
        inet 192.168.168.32 netmask ffffff00 broadcast 192.168.168.255
        groupname prodgr
        ether 0:c:29:20:e6:13



root@sol3 # route delete default 192.168.168.2
delete net default: gateway 192.168.168.2
root@sol3 #
root@sol3 # route add default 192.168.168.2 -setsrc 192.168.168.51
add net default: gateway 192.168.168.2


root@sol3 # route get default
   route to: default
destination: default
       mask: default
    gateway: 192.168.168.2
     setsrc: 192.168.168.51
  interface: e1000g0:1
      flags:
 recvpipe  sendpipe  ssthresh    rtt,ms rttvar,ms  hopcount      mtu     expire
       0         0         0         0         0         0      1500         0

February 10, 2010

rTorrent patch - almost linear downloading

Are you rTorrent user? Want to play .avi files as soon as possible, while downloading? Then maybe this patch will you find handy. Info: tested on rtorrent/libtorrent 0.8.5/0.12.5  All changes are affecting only one file: libtorrent-0.12.5/src/download/chunk_selector.cc

Update, May 2010: Patch applicable to rtorrent 0.8.6/0.12.6

November 23, 2009

IP multipathing with RHEL 5

In this page you can find sample working configs, which do following:

- setup two bond interfaces (bond0, bond1) with 802.3ad support
- setup two aliases for bond0
- setup two VLANs on bond1
- setup custom routes for these VLANs
- setup default gw trought bond0

All this we make on RedHat Linux 5.4, server is SunFire x4150 with 4x onboard ethernet devices.

IO multipathing with RHEL 5

In this post, we describe working IO multipathing configuration. Used technologies: RedHat Linux 5.4 64bit, 2x SunFire x4150, Sun StorageTek 2540, 2x Qlogic FC HBA.

November 22, 2009

Turn on word wrapping in "pre" tag

On Blogger, you need to edit template to turn on wrapping of tag "pre", otherwise long lines are not showing correctly. So paste this to your template:
pre {
white-space: -moz-pre-wrap; /* Mozilla, supported since 1999 */
white-space: -pre-wrap; /* Opera 4 - 6 */
white-space: -o-pre-wrap; /* Opera 7 */
white-space: pre-wrap; /* CSS3 */
word-wrap: break-word; /* IE 5.5+ */
 background: #dddddd;
 display: block;
 padding: 0.5em 1em;
 border: 1px solid #bebab0;
}

November 4, 2009

Redhat 5 + serial console setup

Here is quick setup of serial console for RedHat 5. It works for other linux distros too.
# grep agetty /etc/inittab
S0:12345:respawn:/sbin/agetty ttyS0 9600 vt100-nav

# grep SAFE /etc/sysconfig/kudzu
SAFE=yes

# grep ttyS0 /etc/securetty
ttyS0

# cat /boot/grub/menu.lst
default=0
timeout=5
hiddenmenu
serial --unit=0 --speed=9600 --word=8 --parity=no --stop=1
terminal --timeout=10 serial console
title Red Hat Enterprise Linux Server (2.6.18-164.2.1.el5)
 root (hd0,0)
 kernel /vmlinuz-2.6.18-164.2.1.el5 ro root=/dev/VolGroup00/rootvol console=tty0 console=ttyS0,9600n8 quiet
 initrd /initrd-2.6.18-164.2.1.el5.img

August 22, 2008

Installing geoip netfilter module under fedora 9

Just few tips, after you have patched current kernel sources and iptables, you want now compile geoip module (not whole kernel).

So in kernel sources dir, where is also Makefile, execute this commands:
make modules_prepare
make -C $(pwd) M=net/netfilter/ modules
cp net/netfilter/xt_geoip.ko /lib/modules/`uname -r`/extra/
depmod -a
modprobe xt_geoip

April 29, 2008

Using .htaccess files easy way

If you have configured .htaccess file in your public_html like this...
cat ~/public_html/private/.htaccess
AuthType Basic
AuthUserFile /path/to/homedir/public_html/private/.htpasswd
AuthGroupFile /dev/null
AuthName AnyNameYouLike
require valid-user

... you will have problem to allow guest to read subdir without entering password. Thats why this .htaccess file will help you:
cat ~/public_html/private/guestok/.htaccess
AuthName AnyNameYouLike
Allow from all
Satisfy any

April 6, 2008

Setup Debian Etch on NSLU2 for torrent downloading

Hi, if you don't already have cheap, small, power efficient and silent file server at home, meet NSLU2. This is way of setting up Debian after its installing for more or less torrent downloading.

March 6, 2008

Shape application easy way

Want to limit bandwidth for some specific program in userspace? Use trickle!

Example for shaping scp download to 100KB/s:
trickle -d 100 scp remote.host.ip:big_file.iso .

February 15, 2008

Make kernel module 2.6

To make kernel module under kernel 2.6, just rename module and execute make.
# cat Makefile 
obj-m := ptpatch2008.o

KDIR := /lib/modules/`uname -r`/build
PWD := `pwd`

default:
$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules

February 7, 2008

January 20, 2008

Simple config for rTorrent

This is basic config file for rTorrent (0.7.8/0.11.8) I use. Just first make sure referenced dirs exist. Note: rates are in KB/s.

December 10, 2007

Fast remote dir copy using netcat

Hey, this tip I used so many times! For situations, where network is not a bottleneck, I like using netcat for remote dir copy. For example, I want to fast copy dir /opt/sybase (which has 50GB) from one machine to another. I will tell netcat to listen on port 2000 on destination host and wait for data. Then from source host I will connect to destination host and pump data in.

On destination host type:
cd /opt
nc -l -p 2000 | tar -xf -
edit: Newer netcat, command will looks like "nc -l 2000 | tar -xf -"
Next on source host type:
cd /opt
tar -cf - sybase | nc destination.host.ip 2000

Enjoy!

November 1, 2007

Simple linux firewall for dedicated company network

Hi, we will setup basic firewall for small dedicated company network. Situation: all services for LAN users (email, proxy, dns, ntp) are situated in main company network, to which we connect using OpenVPN. So router acts as OpenVPN client, enabling tunneled incoming connections to this LAN from main company network. Created for Slackware. Take all this as fun example.