Archive for the ‘Subversion’ Category

Dual NIC setup with CentOS – public and local interfaces

May 7th, 2008

I learned again the value of this configuration – rebooted and my public interface did not come up, but the local one was fine.  Simply telnet’d in from another local machine, fixed the issue and rebooted and now all is well.  My configs worked for a year – not nor more.. in /etc/sysconfig/networking/devices/ifcfg-eth1 – the issue was the BOOTPROTO – was either giving the mac as 00:00:00:00:00:00 or nothing at all.

GATEWAY=192.168.1.100
TYPE=Ethernet
DEVICE=eth0
HWADDR=00:11:f7:77:34:9e
BOOTPROTO=none     < -------- changed to static
NETMASK=255.255.255.0
IPADDR=192.168.1.12
ONBOOT=yes
USERCTL=no
IPV6INIT=no
PEERDNS=yes

changed BOOTPROTO=static:

GATEWAY=192.168.1.100
TYPE=Ethernet
DEVICE=eth0
HWADDR=00:11:f7:77:34:9e
BOOTPROTO=static
NETMASK=255.255.255.0
IPADDR=192.168.1.12
ONBOOT=yes
USERCTL=no
IPV6INIT=no
PEERDNS=yes

.. then rebooted and all is well again. It seems a good test is if something survives 2 reboots, its golden. After one reboot the kernel/kudzu/other/undo its still “new” to the system for that boot (hey look, a new card! Lets autoconfigure…), after the second its no longer “new”, then it breaks on the second reboot (say the card did not configure, might be skipped). If some change survives a reboot, great – I test, and if successful reboot right away. If something survives 2 reboots, I generally consider the the fix reliable and can relax.

So why do this?  If you have to servers, its easy, what about only one colocated server? What if do not have an IP KVM? Get a $69 Mikrotik router to use as a secondary local access device (LAD)- they use 5W of power and are the size of a small switch – just will need an extra power outlet – I am sure if you explain to your ISP how service calls will be avoided, they’ll let you use an extra outlet. ;) I use this as a backup to the backup LAD – works well. Set 2 ports in bridged mode and it will act like a switch, the assign an IP to the bridge (not the individual interfaces).

The config tool system-config-network is good for a single port system – for dual/triple NIC for local, DMZ and advanced networking, you need to do this by hand. The key entry is the GATEWAYDEV – this sets up the routing correctly – as seen in netstat -r

Here is a configuration for dual NIC with eth0 local and eth1 private – your names may be different – tweak as necessary.
/etc/sysconfig/network

NETWORKING=yes
NETWORKING_IPV6=yes
HOSTNAME=host.example.com
GATEWAYDEV=eth1
MOUNTD_PORT=4002

/etc/sysconfig/networking/devices/eth0 - local network card

# Please read /usr/share/doc/initscripts-*/sysconfig.txt
# for the documentation of these parameters.
GATEWAY=192.168.10.1
TYPE=Ethernet
DEVICE=eth0
HWADDR=00:98:c7:16:77:43
BOOTPROTO=none
NETMASK=255.255.255.0
IPADDR=192.168.10.2
ONBOOT=yes
USERCTL=no
IPV6INIT=no
PEERDNS=yes

/etc/sysconfig/networking/devices/eth1 - public network card

# nVidia Corporation MCP51 Ethernet Controller
DEVICE=eth1
BROADCAST=1.1.1.15
HWADDR=00:47:e1:6f:3e:27
IPADDR=1.1.1.4
NETMASK=255.255.255.240
NETWORK=1.1.1.0
ONBOOT=yes
TYPE=Ethernet
GATEWAY=1.1.1.1
USERCTL=no
IPV6INIT=no
PEERDNS=yes

Reboot your system – though a restart is nice service networking restart; service [firewall software] restart, if your changes survive a couple reboots you can be sure its correct. If this is for a live system in a far away datacenter, test it at home first, then one more time, get some coffee, then test again.

[root@host devices]# netstat -r
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
1.1.1.0    *               255.255.255.240 U         0 0          0 eth1
192.168.10.0    *               255.255.255.0   U         0 0          0 eth0
169.254.0.0     *               255.255.0.0     U         0 0          0 eth1
default         1.1.1.1    0.0.0.0         UG        0 0          0 eth1
  • del.icio.us
  • Digg
  • Slashdot
  • Technorati
  • MisterWong
  • Reddit

Diff and Patch Notes

February 28th, 2007

Useful diff and patch commands:

Create a patch with 3 lines of context and amount of blank lines. I want to see other whitespace difference – it might expose a typo.

diff -u 3 oldfile newfile > patchfile

Use CVS diff to create a patch comparing the local file (newer) with the repository version.

cvs diff -up file > patchfile


Patch a file and create an orig copy (from http://gentoo-wiki.com/MAN_patch_1 ). The -B option allows the prefix for a file – in this case I’ll save it somewhere else as a patched file.

patch -b < patchfile
patch -B /home/user/patched < patchfile

Patch a file you specify

patch file_to_be_patched patchfile

Diff notes
<

# diff -h
usage: man [-c|-f|-k|-w|-tZT device] [-i|-I] [-adlhu7V] [-Mpath] [-Ppager]
           [-Cfile] [-Slist] [-msystem] [-pstring] [-Llocale] [-eextension]
           [section] page ...
-a, --all                   find all matching manual pages.
-d, --debug                 emit debugging messages.
-e, --extension             limit search to extension type `extension'.
-f, --whatis                equivalent to whatis.
-k, --apropos               equivalent to apropos.
-w, --where, --location     print physical location of man page(s).
-W, --where-cat,
    --location-cat          print physical location of cat file(s).
-l, --local-file            interpret `page' argument(s) as local filename(s).
-u, --update                force a cache consistency check.
-i, --ignore-case           look for pages case-insensitively (default).
-I, --match-case            look for pages case-sensitively.
-r, --prompt string         provide the `less' pager with a prompt
-c, --catman                used by catman to reformat out of date cat pages.
-7, --ascii                 display ASCII translation of certain latin1 chars.
-E, --encoding encoding     use the selected nroff device and display in pager.
-t, --troff                 use groff to format pages.
-T, --troff-device device   use groff with selected device.
-H, --html                  use lynx or argument to display html output.
-Z, --ditroff               use groff and force it to produce ditroff.
-X, --gxditview             use groff and display through gditview (X11):
                            -X = -TX75, -X100 = -TX100, -X100-12 = -TX100-12.
-D, --default               reset all options to their default values.
-C, --config-file file      use this user configuration file.
-M, --manpath path          set search path for manual pages to `path'.
-P, --pager pager           use program 'pager' to display output.
-S, --sections list         use colon separated section list.
-m, --systems system        search for man pages from other unix system(s).
-L, --locale locale         define the locale for this particular man search.
-p, --preprocessor string   string indicates which preprocessors to run.
                             e - [n]eqn   p - pic    t - tbl
                             g - grap     r - refer  v - vgrind
-V, --version               show version.
-h, --help                  show this usage message.
  • del.icio.us
  • Digg
  • Slashdot
  • Technorati
  • MisterWong
  • Reddit

Trac install notes

December 31st, 2006

0. Follow the directions in various places – they work well, thus I’ll not be rewriting them.

1. Run the right version of apache 2.0.54 to 2.0.59

2. Follow the installer at http://trac.edgewall.org/wiki/Trac0.9/TracOnWindows *** Caveat – see #4

3. The URL for making the directory – because I am using Cygwin was trac/project (not trac\project) – the backslash was breaking things.

4. Mod python: http://trac.edgewall.org/wiki/TracModPython

4. Have your svn repository permissions set right. I had the error in the pic. On my system apache runs as “SYSTEM” so I had to add “SYSTEM” as a user with some rights to my repository. I used taskmgr to see what the user was.
Trac error - could not access the project/format directory
5. My viewing of php docs was not working. Google’d and see this ticket: http://trac.edgewall.org/ticket/3886
My trac.ini entry was: `php_path = “C:/Program Files/php-5.1.4-Win32/php.exe”`
6. Added some security – in the apache config, instead of `trac/project/login` I used `trac/project` so the project is not visible to the world.

  • del.icio.us
  • Digg
  • Slashdot
  • Technorati
  • MisterWong
  • Reddit

Installing subversion

December 15th, 2006

1. If you want to use Apache 2.2.x with Trac + Subversion get 1.3.2, you’ll need this binary: http://www.tomdonovan.net/download/mod_dav_svn-1.3.2.x-w32.zip

2. http://trac.edgewall.org/wiki/TracOnWindows#Method2:UsingInstallers – follow it verbatim – does not explicitly say the obvious – get subversion command line tools – http://subversion.tigris.org/files/documents/15/35379/svn-1.4.2-setup.exe3. Python info here – http://www.imladris.com/Scripts/PythonForWindows.html

3. I did not set up Trac + Apache yet because I chose to install Subverion 1.4.2 (many bug fixes compared to 1.3.2) was used. Its some work to get Apache and TRac working am using Trac standalone – set up here

4. Until I get the Apache Trac working, I’ll use the tracd web daemon – here’s the script I use to start it -

#!/bin/bash
#
# the below command should be on one line
#
C:/Python24/python.exe c:/Python24/Scripts/tracd.py -p8000 \
c:/Python24/Scripts/trac/projects

5. Commands that work:

# mkidr c:\svn
# svn create c:\SVN\repos
# /cygdrive/c/Python24/Scripts/trac.sh
# svn import vtiger file:///c:/SVN/projects -m "Initial import"

* Note: / and \ and how they are used. the svn import wants forward slashes…

6. Security – secure a repository by editing the /conf/svnserve.conf file. Mine looks like this:

[general]
### These options control access to the repository for unauthenticated
### and authenticated users.  Valid values are "write", "read",
### and "none".  The sample settings below are the defaults.
anon-access = none
auth-access = write
### The password-db option controls the location of the password
### database file.  Unless you specify a path starting with a /,
### the file's location is relative to the conf directory.
### Uncomment the line below to use the default password file.
password-db = ../../Another-repo-dir/conf/accounts
### The authz-db option controls the location of the authorization

Then entries in the accounts file look like:

name = password
johnny = PaSSWerde
geri = MillWaukEE
  • del.icio.us
  • Digg
  • Slashdot
  • Technorati
  • MisterWong
  • Reddit

Mochabomb is Digg proof thanks to caching by WP Super Cache