Wired LAN and UMTS together – simultaneously

Oct 14, 2011 in Howto

To start with, my network connection is normally like this, with two NICs:
1. eth0 for LAN, in a NAT port on the ADSL box, fixed IP, 192.168.x.x subnet.
2. eth1 for WAN, in a bridged port on the ADSL box, dynamic IP, provider’s DHCP..

This way the main machine has a direct external IP address
and all other machines can connect to its NFS and CIFS (Samba) directories in the 192.168.x.x subnet.

The other machines have their NICs connected via a switch to a NAT port on the ADSL box, 192.168.x.x subnet.

This way they all get their Internet connections via the ADSL box and they can use the same shared directories on the main machine, in subnet address 192.168.x.x.

Everything is configured using ifup.
Always works. Except that…

Now, my cable was cut out in the yard. An Excavator had bad maps or shaky hand or something.

So I thought I’ll set up an emergency network where I replace eth1 with a UMTS modem.

Since eth1 got useless, I first disabled it altogether using YaST.

I then changed first from ifup to network manager and nm-applet to run UMTS.
Plugged in the UMTS stick, it got recognized and was trivial to configure.

Problem:

It got up and it got an IP, but there was no internet connection.
Checked the nameservers, no joy.

Disconnected the LAN (eth0) in nm-applet
Now I got connected to the Internet, but no LAN, ofcourse, I just disconnected it.

Connected eth0 again, LAN was there but no Internet. It was one or the other, not both.

Apparently the network manager couldn’t (or I couldn’t) handle this situation.

(I’ll be grateful to hear of anyone who knows how all this can be done in network manager).

At this point I went to Usenet and as usual, got good advise from there.

Solution:

The reason to this problem was that the default route was pointing to the old wired connection.
This could be seen with ‘/sbin/route -n’

So I disconnected eth0 again to get Internet, installed wvdial and umtsmon.
Then I disconnected UMTS cobnnection, went to YaST and changed back to ifup.

After that I removed the old default route (as root) with
‘route del default’

Then kicked UMTS up again (with umtsmodem, very handy program).
Now everything was there, both LAN and Internet:

Steps:

1. LAN plugged

2. UMTS stick plugged, not connected yet.

3. /sbin/route del default

4. UMTS connected

You’re done.


Running Firefox remotely over ssh

Oct 11, 2011 in Howto, Remote administration

I’m connected to a remote machine over ssh (‘ssh -X remotemachine’).

I try to launch Firefox
user@linux-iek6:~> firefox

It launches, yes, but locally! Quite surprising to me.
OK, so I stop it and do some google searching…

Then, to make it run on the remote machine I command:

user@linux-iek6:~> firefox -no-remote
GConf-WARNING **: Client failed to connect to the D-BUS daemon:
Using X11 for dbus-daemon autolaunch was disabled at compile time, set your DBUS_SESSION_BUS_ADDRESS instead
GConf Error: No D-BUS daemon running

OK, it runs remotely now, but I stop it again and do some google search again.
Then, to get rid of that problem I first command: export $(dbus-launch)

user@linux-iek6:~> export $(dbus-launch)

and then:

user@linux-iek6:~>firefox -no-remote
*** nss-shared-helper: Shared database disabled (set NSS_USE_SHARED_DB to enable).

Some google again…
To get rid of also that I command:
user@linux-iek6:~>export NSS_USE_SHARED_DB=ENABLED

and then:
user@linux-iek6:~>firefox -no-remote

and now it runs on the remote machine without errors!

So I put all those in a script:

#!/bin/bash
export $(dbus-launch)
export NSS_USE_SHARED_DB=ENABLED
firefox -no-remote &

That tiny thing does all the above nicely.
If you like to see what it’s doing add -x to the first line:

#!/bin/bash -x


Automatic Trashcan

Jan 05, 2011 in Howto, openSUSE

Make your trash go out by itself (like it does during the night at the office)

There may or may not be an icon “Trash” on your desktop.
If there is one, it normally has a menu item “Empy Trashcan” or similar.
That should empty it when the user so chooses.

The icon is not the real trashcan though, just a link to it, or them.
Real trashcans are directories in the file system.
In case there are storage devices mounted somewhere outside /home there are several /Trash directories, too.

Also in such  cases using the icon’s menu should take care of everything.
But it needs to be done manually…

To automate the process

we first need to find all the Trash directories.

Every user has a trash directory, ~/.local/share/Trash (that is /home/username/.local/share/Trash)
It is, as you notice there, a so called “dot directory” or “hidden directory”.

There are also sub directories in it, called /files and /info.
In some /Trash directories there can be a third one called /expunged.
I haven’t seen anything in those yet, so I don’t know really what they are and who may put trash in them.

The scripts need to be modified according to any additional directories, for example this system has

/data1/.Trash-1000/

which is on a disk mounted in /data1, owned by UID 1000.

These additional directories need to be placed in the scripts accordingly.

Delete after nn days

A simple way is to use find and rm.
Here’s a script that finds files older than one day or 24 hours
and removes them:

#!/bin/bash
##
find ~/.local/share/Trash/info* -mtime +1 -exec rm {} \;
find ~/.local/share/Trash/files* -mtime +1 -exec rm {} \;
##

The option -mtime +1 can be changed in 24 hours increments, 2 being two days or 48 hours.

Delete after nn hours

Here a program called tmpwatch is used.
If you don’t have it, in openSUSE run as root:

zypper in tmpwatch.

When installed, here’s a script that uses it and deletes files older than 1 hour:

#!/bin/bash
##
# See man tmpwatch for other options.
# The number there is for so many hours since mtime, option -m
# Option -a means all file types
# Option -f is like in rm -f
# Replace username with your own
#
#
/usr/sbin/tmpwatch -maf 1 ~/.local/share/Trash/info
#
# I like to snooze a little between command executions, so
#
sleep 5
/usr/sbin/tmpwatch -maf 1 ~/.local/share/Trash/files
#
##

To make everything automagic, save a script in your path, make it executable  and add it to your cron jobs.

P.S. It seems to take quite some time for the desktop icon to be updated after these removals.
Anyway, I’ve pretty much forgotten about the desktop Trashcan after having automated its function.


DynDNS censorship blocked my site

Sep 10, 2010 in Uncategorized

“Web content filtering like never before”

The line above is a quote from a Web censoring company called Barracuda that works together with DynDNS and who now have blocked my site from anybody using DynDNS Windows client software.

I have a couple of DynDNS accounts. I use them to be able to easily connect to my machines that have dynamic addresses. Fine. So far.

This has even been free (as in beer) and they have given you up to five hosts to handle via this service. Recently they reduced the number to two and started wanting money for the rest. No biggie IMHO. And this post is not about that. Lue lisää…


blockhosts

Apr 17, 2010 in openSUSE

After my previous post about blockhosts it was added to openSUSE Build Service, OBS, by David Bolt.


Vahis