Archive for Linux

How to change DNS servers

In both linux and Solaris and possibly other UNIX’es you can change your dhcp servers simply by editing your /etc/resolv.conf

It should look like below.

search domain.com otherdomain.com
nameserver 192.168.0.1
nameserver 192.168.0.2

The nameserver’s or DNS server will try to be connected to in order from top to bottom. The search domains do not matter if they are at the top or bottom. Search domains are usefull if you dont want to have to type in the whole FQDN (Fully Qualified Domain Name). So instead of typing in “ping sparky.domain.com” you can shorten it to “ping sparky”.

Comments (1)

How to renew your dhcp lease in linux

root@client:~# dhclient eth0
There is already a pid file /var/run/dhclient.pid with pid 4478
killed old client process, removed PID file
Internet Systems Consortium DHCP Client V3.0.6
Copyright 2004-2007 Internet Systems Consortium.
All rights reserved.
For info, please visit http://www.isc.org/sw/dhcp/

Listening on LPF/eth0/00:22:cb:ze:95:sh
Sending on   LPF/eth0/00:22:cb:ze:95:sh
Sending on   Socket/fallback
DHCPREQUEST of 192.168.0.101 on eth0 to 255.255.255.255 port 67
DHCPACK of 192.168.0.101 from 192.168.0.1
bound to 192.168.0.101 — renewal in 284384 seconds.
root@client:~#

You could want to restart your leas for a variety of reasons.  You just set up a static DHCP lease and you want to computer to pick up the new ip.  If you are logged in via SSH make sure when you connection is dropped that you know what the new ip will be before hand or at least have a log in to the router so you can find out what it was assigned.

Comments

How to change the mac address in Linux

# ifconfig eth0 down
# ifconfig eth0 hw ether 00:80:48:BA:d1:20
# ifconfig eth0 up
# ifconfig eth0 |grep HWaddr

This is always fun to do.  Why might you want to do this.  Say your friend paid for internet access at at coffee shop.  Your friend leaves early.  You change your mac to what his mac is and then you can freely surf the internet with out paying.  Kind of like using a parking meeter that still has time on it :>

Comments

Set terminal to VT100 and Editor to VI

So you go to use crontab -e and you get some strange stuff at the bottom of the line.  Yup you are in ee, which is even older then vi.  This can often happen when you are using a serial connection, and even when using ssh.  This is a simple fix, with examples below.

TERM=vt100 ; export TERM ; EDITOR=vi;export EDITOR

user@server:~$ echo $TERM
xterm
user@server:~$ TERM=vt100 ; export TERM ; EDITOR=vi;export EDITOR
user@server:~$ echo $TERM
vt100

Comments

How to tell your current run level?

[root@Linux ~]# who -r
run-level 3 Sep 22 14:51 last=S

root@Solaris# who -r
. run-level 3 Feb 26 09:51 3 0 S

Comments