Skip to main content

Posts

Showing posts with the label linux

Force an application to use VPN, using iptables in Linux

Enforcing an application, for example a torrent client like Transmission , to always use the VPN interface or any particular network interface for that matter, is trivially simple using iptables on Debian, Ubuntu or any other GNU/Linux distro. Personally, I am running Debian Sid on the Raspberry Pi . Occasionally I use it for downloading files ( legal stuff, seriously, believe me :D  ) using Transmission Bittorrent client over a VPN connection. Sometimes it happens that the VPN connection fails and doesn't reconnect for whatever reason and Transmission continues pulling stuff directly over my internet connection, which I would like to avoid. Fortunately it is very straightforward to enforce rules based on application owner UID. Transmission runs under the owner debian-transmission in Debian (use htop to check this) and the following two lines of iptables ensures that any process with owner having UID, debian-transmission , will not use any other network interface apart from the...

Raspberry Pi -- Installing Samba (Windows Share) File server

Having successfully run Debian Wheezy on my Raspberry Pi, I went forward with my initial idea of setting up a low cost power efficient file server for accessing my external hard disks from my Windows7 desktop, HP-Mini running Ubuntu and Mac Mini running OS X Lion (yeah I do like bragging about my machines :D ). This turned out to be pretty straight forward. As expected, the external Seagate USB disk immediately got recognized and appeared as /dev/sda [ 579.948350] usb 1-1.2: New USB device found, idVendor=0bc2, idProduct=3001 [ 579.948384] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [ 579.948405] usb 1-1.2: Product: FreeAgent [ 579.948421] usb 1-1.2: Manufacturer: Seagate [ 579.948447] usb 1-1.2: SerialNumber: 2GEX323R [ 579.967638] scsi0 : usb-storage 1-1.2:1.0 [ 580.970520] scsi 0:0:0:0: Direct-Access Seagate FreeAgent 102D PQ: 0 ANSI: 4 [ 589.142942] sd 0:0:0:0: [sda] 1953525168 512-byte logical blocks: (1.00 TB/931 GiB) [ 589.1446...

Running Debian on Raspberry Pi (and SD card woes)

After waiting for nearly 3months, I finally got my Raspberry Pi last week from Element14. Plan was to set it up as a file server for network enabling my external hard disks. Debugging setup Attempts to use a SandDisk 8GB Class 10 Extreme SD card and Debian Squeeze image, following the instructions here , were completely futile. Tales of my woes and subsequent hardware level debug attempts can be found in this thread . Plugging in the card and attempting to boot the RasPi failed miserably initially. Damn ugly pull up resistors on the SD IO lines Implementing the pull-up resistor hack suggested by jhasler , resulted in a fugly looking but partially working RasPi. It was atleast attempting to boot now, although it was throwing up a kernel panic immediately after loading the kernel. After loading kernel card drivers SD DAT0 line, before kernel is loaded. Probing the SD card IO lines with a high BW scope, revealed some glaring anomalies. The SD Clk speeds up a...

BSNL Self Care Portal on Chrome/Firefox in Linux

BSNL has recently (not sure how recent, since I returned to India after quite a few months) made some changes to their accounting system and the old intranet site (10.240.43.216) for checking unbilled usage no longer seems to be working. It has been replaced with an ultra crappy, barely functional, CRM portal from Siebel and it manages to suck better than the most powerful vacuum cleaner ever made. To make matters worse, it is labelled as " Internet Exploder only", so any other standards compliant browser, which doesn't cause the internet to explode doesn't seem to work. Having nothing better to do, I delved a bit deeper to find out why non-IE browsers fail to render this piece of shit. A little bit of Googling made me stumble upon this - link . Apparently the login window seems to be some kind of popup with some applet inside. Whichever brain-dead retard designed it, something seems to be horrendously wrong with the way the login window captures the mouse focus. C...

Experiences with new Mac Mini

Earlier this month I bought a Core i5 Mac Mini. It was quite an impulsive decision, partly influenced by the fact that it was a bit annoying frequently rebooting my office Dell desktop to switch back and forth between Windows and Linux. I have been using Linux for everything (like browsing, programming, creating Tex documents as well as for music and movies) since the last 4+ years. However, when I joined as a Grad student in CQT , earlier this year, my requirements changed a bit, which made be quite a bit dependent on Windows. I got involved in some device driver development in Windows, creating/maintaining several VIs in Labview and working in AutoDesk occasionally to coordinate with workshop technicians. Moreover the lab-notebooks were traditionally being maintained in MS OneNote. Since I am heavily reluctant to completely move away from *nix for my computing needs, I tried dual-booting my Core i7 desktop with Windows 7 and Ubuntu 11.10. Primarily I was using Ubuntu, but had to freq...

Making inactve USB Hard Disk spin down automatically in Linux.

I have a 400GB Seagate IDE HDD connected to Mars, our hostel's file-server using an USB enclosure. The USB enclosure is a cheap "Made in China" product. Consequently it has some special "features". One such notable "feature" is that the disk is kept spinning by the controller even if there has been no disk I/O for a long time. I have three other USB disks connected to the same machine, a 1TB Seagate FreeAgent Desk External Drive, a 500GB Maxtor Basics External Drive and a 2.5" 60GB Fujitsu SATA Disk inside a Transcend USB enclosure. All of these spin down themselves if there has been no I/O for sometime. Keeping the hard disk spinning unnecessarily for ever, not only wastes power but also overheats the drive, thereby reducing its life. I tried noflushd, which is supposed to force idle hard disks to spin down, but found it to be of no help. USB enclosure generally work by performing an SCSI emulation over USB. sdparm is an utility which can be use...

Adventures with IPv6

I spent the past couple of days, tinkering with an old Linux box, trying to set up a fully functional IPv6 network, complete with an IPv6 webserver, nameserver, mailserver, network router and firewall. The job is partly done. The nameserver, webserver, network router and firewall are working quite well. The website can be accessed here http://oak.ipv6.iiserk.net (Provided you have IPv6 connectivity). It runs on a rickety PIII running Ubuntu 8.04.1 and connected to my friend's home ADSL connection. Power failure are quite a common affair in our region (in almost the whole country, to be honest!) and there is no power backup for the server, so if it appears to be down, kindly check back sometime later. The nameserver ns1.ipv6.iiserk.net manages the DNS records for the subdomain ipv6.iiserk.net . I hope to get the mailserver up and running quite soon. I'll also come up with a detailed documentation on how I got the things running, sometime in the near future. Anyway for this half...

Linux Hard Disk Issue - Excessive Load_Cycle_Count

Prologue: My 2 year old laptop's harddisk had died a few weeks ago, and I replaced it with a Seagate Momentus 5400.3 160GB SATA Drive. I have been running only Linux for a long time on my laptop. (Running Ubuntu Intrepid at present) While trying to ascertain the cause of this premature death, I came to notice the abnormally high Load_Cycle_Count. This can be checked using smartmontools by issuing the command sudo smartctl -n standby -a /dev/sda where /dev/sda has to be replaced with the appropriate disk name. The option -n ensures that if the disk is already in standby, smartctl doesn't wake it up. A little bit of Googling returned quite a lot of stuffs about this issue. Laptop Harddisks, in order to improve power efficiency while on battery, have quite aggressive power management features by default. Now this is not really bad. When the disk is not accessed for sometime it spins down itself. So far so good, the disk stops spinning unnecessarily thereby cutting down power con...

Evolution Of A Linux User

A message taken from Kulua mailing list. From - Tue Dec 14 13:22:38 1999 Received: from kuhub.cc.ku.edu by lark.cc.ku.edu (8.8.7/1.1.8.2/12Jan95-0207PM) id PAA0000031643; Mon, 13 Dec 1999 15:07:29 -0600 (CST) Received: from DIRECTORY-DAEMON by KUHUB.CC.KU.EDU (PMDF V5.2-32 #39821) id ; Mon, 13 Dec 1999 15:07:27 CST (UTC -06:00) Received: from violet.jayhawks.net ("port 1826"@violet.jayhawks.net [24.124.24.226]) by KUHUB.CC.KU.EDU (PMDF V5.2-32 #39821) with ESMTP id ; Mon, 13 Dec 1999 15:07:23 -0600 (UTC -06:00) Received: (from listserv@localhost) by violet.jayhawks.net (8.9.3/8.9.3) id PAA19912; Mon, 13 Dec 1999 15:06:33 -0600 Resent-date: Mon, 13 Dec 1999 15:06:33 -0600 Date: Mon, 13 Dec 1999 15:06:20 -0600 (CST) Resent-from: kulua-l@kulua.org From: Jeffrey Watts Subject: Evolution Of A Linux User [LONG] Resent-sender: kulua-l-request@kulua.org To: KULUA List Reply-to: kulua-l@kulua.org Resent-message-id: Message-id: MIME-version: 1.0 Content-type: TEXT/PLAIN; charset=...

Setting up local Ubuntu & Debian mirror using apt-mirror

Prologue: Our institute was moving to it's new campus. For a central Govt. run research institute, the huge land requirements forced it to be located quite far off from the city. It is a remote place around 50km from Kolkata, WB, India. Leased line internet connectivity is there in the Institute, but there was a "rumour" that internet connectivity will not be provided in the student's hostel. There is a large number of Ubuntu and Debian GNU/Linux users among the students. Whether the rumour was true or not, I could not have taken any chance. I had a spare 60GB Seagate USB HDD. It was big enough to hold the main, universe, multiverse and restricted packages for Intrepid and the main, contrib and non-free packages for Lenny. In addition to that I also mirrored a few other extra stuffs. We had a about a month to go, before we left for the new campus, so I set out for finishing the job before that. Ofcourse the biggest hurdle was bandwidth. We had a 2Mbit/s ADSL link in ...

Some more fun with SSH port forwarding and socks proxy

Few days ago I made the following post: Prologue: Our Institute has several nice Dual Core Machines deployed for the students. Unfortunately the machines are behind a NAT with no port forwarded for external SSH access. Student's hostel is a bit far off from the computational centre. As such if someone felt the need of accessing the machines during non-office hours, it was a wee bit difficult. The sysadmin would not have agreed to forward any ports. Something had to be done.... SSH has a very useful feature - Remote and Local Port Forwarding. We have an old rickety PIII running Ubuntu 8.04.1 in the Hostel, it is connected to the net and is accessible via SSH from the internet. Using a tiny little shell script running on one of the machines in the Institute, I managed to make the old PIII an intermediate gateway for gaining SSH access to the Institute's machines from anywhere in the internet. The script is of few lines, but nevertheless powerful enough to serve our purpose. #!/bi...

Fun with SSH Remote Port Forwarding

Prologue: Our Institute has several nice Dual Core Machines deployed for the students. Unfortunately the machines are behind a NAT with no port forwarded for external SSH access. Student's hostel is a bit far off from the computational centre. As such if someone felt the need of accessing the machines during non-office hours, it was a wee bit difficult. The sysadmin would not have agreed to forward any ports. Something had to be done.... SSH has a very useful feature - Remote and Local Port Forwarding. We have an old rickety PIII running Ubuntu 8.04.1 in the Hostel, it is connected to the net and is accessible via SSH from the internet. Using a tiny little shell script running on one of the machines in the Institute, I managed to make the old PIII an intermediate gateway for gaining SSH access to the Institute's machines from anywhere in the internet. The script is of few lines, but nevertheless powerful enough to serve our purpose. #!/bin/bash while [ 1 ]; do ssh -C -o Server...