Send Linux Tips and Tricks to firstname.lastname@example.org
- Laptop in different places, setting up different DNS
Answers to Mail Bag Questions:
Laptop in different places, setting up different DNS
Tue, 21 Sep 1999 23:13:08 -0400
From: Pierre Abbat
I use a laptop at home, at the office, and elsewhere. I set up a script so that it recognizes where it is when it boots. It is /etc/rc.d/whereami and has mode 744:
#!/bin/sh # Figure out where I am by pinging known hosts. if [ -z "`/sbin/ifconfig|grep Ethernet`" ] ; then sleep 2 ; fi echo -n elsewhere >/etc/where ping -c 1 192.168.97.1 && echo -n home >/etc/where ping -c 1 192.168.96.1 && echo -n office >/etc/where chmod 0644 /etc/where
(Names and numbers have been changed to protect the innocent.) I call this from /etc/rc.d/init.d/inet, which is run after pcmcia, so the card is up by then. (The sleep 2 is in case it isn’t.) Then I do the following:
cp /etc/resolv.conf.`cat /etc/where` /etc/resolv.conf
This installs the appropriate nameserver list.
The two networks I’m on are next door to each other, which means I can supernet the card and ping both without ifconfigging it. But if one were 10.*.*.* and the other on 192.168.*.*, I’d have to ifconfig eth0 in whereami to ping them both.
Tips in the following section are answers to questions printed in the Mail Bag column of previous issues.
ANSWER: reply to Linux on a laptop
Thu, 2 Sep 1999 14:09:36 -0700
From: Russ Johnson
I’m a linux newbie. I installed linux (redhat 5.2) on a laptop with an ATI rage LT PRO AGP2X, and there’s no driver for this graphic card to run Xwindow, I tried to find one on the web, but without success, I also tried other ATI drivers (like ATI rage pro and other MACH64 drivers) without better results. Is there any solution ? Please help me…
You bet there’s a solution. It’s not perfect (yet) but it works well until XFree86 gets a new server out there. The solution is to use the Frame Buffer server. Details are here: www.0wned.org/~cain/ragefury.htm Other than that, the only solution available is to purchase a commercial X server.
ANSWER: Funny signature
Fri, 3 Sep 1999 03:03:41 +0300 (IDT)
From: Mikhael Goikhman
Hi, Csaba Feher.
I am refering to your tip in LG #45. Please don’t get me wrong, I don’t want to bash you, why should I? 🙂
1) sigchange script itself has redudant IMHO lines (rm, cat, echo?). Here is a smaller version:
#!/bin/sh cp $HOME/.signature.basic $HOME/.signature >& /dev/null /usr/games/fortune -s linuxcookie computers >> $HOME/.signature
2) It is not very good to put home grown scripts to /bin or /usr/bin. This is what /usr/local/bin and $HOME/bin is for.
3) It is not very good to put something to /etc/rc.d/rc.sysinit. This is what /etc/rc.d/rc.local is for.
Have a nice day, Mikhael.
ANSWER: DNS on the fly
Fri, 3 Sep 1999 12:40:53 +0900
From: Dmytro Koval’ov
Ernst-Udo Wallenborn suggests:
i use the SCHEMES facility of the PCMCIA package to solve a related problem: how to use a laptop in two LANs with different IP addresses, different domains, and (naturally) different DNS servers.
Basically you set up a file /etc/pcmcia/network.opts which contains all network options, esp. something like:
case "$ADDRESS" in home,*,*,*) [snip] SEARCH="domain.com" DNS_1="188.8.131.52" DNS_2="" DNS_3="" [snip] ;; work,*,*,*) [snip] SEARCH="work.com" DNS_1="184.108.40.206" DNS_2="" DNS_3="" [snip]
Then, when booting with lilo you can append SCHEME=home or SCHEME=work, or better write this into /etc/lilo.conf directly. and type ‘home’ or ‘work’ at the lilo prompt.
Well, may be I was lucky enough – I didn’t understand what SCHEMES mean when I was doing my setup 😉
The problem with approach of Ernst-Udo is that you need to reboot system when you come home from work. But this is a Linux world and nobody needs a reboot just to change the IP address and/or DNS.
Another approach I’m using with the same /etc/pcmcia/network.opts file is to have different setup for different PCMCIA slots. In this file you can find comment:
# # The address format is "scheme,socket,instance,hwaddr". #
This comment explains setup below:
case "$ADDRESS" in *,0,*,*) [snip] IPADDR="220.127.116.11" SEARCH="domain.com" DNS_1="18.104.22.168" DNS_2="" DNS_3="" case "$ADDRESS" in *,1,*,*) [snip] IPADDR="22.214.171.124" SEARCH="work.com" DNS_1="126.96.36.199" DNS_2="" DNS_3=""
Having this you’ll have only to plug you NIC into 1st PCMCIA slot at home and into 2nd slot at work. You IP addresses and DNS are set correctly upon card insertion! No reboots.
ANSWER: ATI rage LT PRO AGP2X
Sat, 04 Sep 1999 10:53:59 +0200
From: August =?iso-8859-1?Q?H=F6randl?=
hi, there are some cards which can be used with a new framebuffer X server
there is a description at home.t-online.de/home/mueller.elmar/linux.htm (german only)
ANSWER: LG Formatting problems
Wed, 8 Sep 1999 16:52:41 +0100
From: James Tappin
A clue as to the source of the Opera formatting problem (Mailbag Sep ’99 – message from Bjorn Eriksson 27/Aug) comes from the fact that KFM (1.1.2 pre 3 release of KDE) also has the same problem which strongly suggests a QT problem as (IIRC) Opera for Linux is also QT based.
Not sure of any way around it though.
Thu, 9 Sep 1999 14:11:23 -0500
From: McKown, John
There is a commercial driver from Xig which is supposed to support this card. You can look at www.xig.com/Pages/CardMfgrSiS.html
It is EXPENSIVE! US $99.95! . I’ve not used the Xig X server, so I don’t know how good it is. I have seen some good reviews.
Thu, 9 Sep 1999 14:11:48 -0500
From: McKown, John
Have you looked at Metro Link? Go to http://www.metrolink.com. They indicate that they have a driver for this card. Actually it says « Rage LT Pro AGP » not « AGP2X ». I don’t know if it is any different. However, it is not free. It costs US$39. If you have a credit card that they can accept, you can download the driver from their FTP server. I have had their driver for 2 days now for my STB Riva 128/ZX which did not work well with the XFree86 supplied driver. It works very well with their driver. Just a thought.
I hope it is of some help to you.
By the way – your English is quite good.
ANSWER: Poor Internet Speed
Thu, 9 Sep 1999 14:12:03 -0500
From: McKown, John
If your system got good speed at your friend’s house but not yours, then I can only think of one of two possibilities. One – you friend has a better modem or Two – your friend has a better telephone connection. I would bet on the telephone connection. I regularly connect at around 44,000. I have a friend who says that he can only get around 24,000. But he is in the « boonies » and I’m using a commercial grade line to my house.
ANSWER: Clearing Lilo from MBR
Thu, 23 Sep 1999 02:34:20 -0700
From: Jim Dennis
Just read the item on clearing lilo.
All I do is boot from a Dos ( 5 or greater ) boot disc and issue the command:
that seems to fix anything including boot sector viruses. Maybe Linux fdisk would take the same parameter. I enjoy your column, keep up the good work, best wishes,
The /MBR option was undocumented and only introduced in MS-DOS 5.0. I don’t remember the question to which you were referring. If I didn’t mention FDISK /MBR it was probably because I was not assuming that the user was trying to restore an MS-DOS 5.0 or later boot loader to their system.
Linux fdisk is a different program and doesn’t touch the boot code in the MBR. It only works on the partition tables (which comprise the last 66 bytes of the MBR and possibly a set of others for extended partitions).
There are several Linux programs which do write boot records. /sbin/lilo is the most commonly used. ‘dd’ will do in a pinch (if you have a .bin image to put into place).
BTW: don’t count on /MBR to fix a virus. Some viruses encrypt portions of your filesystem, thus causing major problems if they aren’t removed corectly. To prevent infection by boot sector viruses, disable the « floppy boot » options in your BIOS. You should only enable those long enough to perform an OS installation or system recovery and disable it immediately thereafter. To prevent viral infect by « multi-partite » and « file infector » viruses, stop running MS-DOS. To avoid MS Windows macro viruses, avoid MS Office, MS Exchange and related software (with virus^H^H^H^H macroing hooks built into them).
ANSWER: Why are they trying to telnet into my Linux box?
Fri, 24 Sep 1999 14:32:22 -0400
From: Rick Smith
Since my previous letter about Dalnet providers trying to connect to my Linux box via telnet port 23, I have found out that they are also trying port 1080. I have instigated a policy of dropping all incoming connections via a command run by host.deny:
/sbin/ipfwadm -I -i deny -S %a
I hate to do this to my niece, but I don’t know of any alternative until these dalnet jerks stop this intrusive practice.
Anyway, my niece has moved to other irc providers that don’t do this kind of thing.
This page written and maintained by the Editor of the Linux Gazette, email@example.com Copyright © 1999, Specialized Systems Consultants, Inc.
Published in Issue 46 of Linux Gazette, October 1999