Archive for FreeBSD

Simple Testing of SMTP with Telnet

SMTP is a pretty straightforward protocol, and thats why it is so simple for spammers to mess with, but it also makes it easy for us to test if its working.

Many times you want to verify your server before bringing it live in your MX record or even just test to make sure everything is good on your sendmail side.

Simple way of doing this is using telnet from the command line:

$ telnet your.mail.server.name.com 25

Trying your.mail.server.name.com…
Connected to your.mail.server.name.com.
Escape character is ‘^]’
220 your.mail.server.name.com ESMTP Sendmail 10.0.1/10.0.1; Mon, 13 Aug 2007 18:36:27 -0400 (EDT)

HELO your.doman.com
250 your.mail.server.name.com, nice to meet you!
MAIL FROM:you@your.domain.com
250 2.1.0 you@your.domain.com… Sender ok

RCPT TO:me@your.domain.com
250 me@your.domain.com… Recipient ok
DATA
354 Enter mail, end with “.” on a line by itself

Put your message here, and finish with a line that
only contains a period, so hit enter, then hit period, then hit enter, like below
.

250 2.0.0 l7DMerMV044784 Message accepted for delivery
QUIT

That should give you a good idea of what areas are having issues, so if you receive something like:
550 5.7.1 someone@someother.com… Relaying denied

you know that the mail server isn’t setup to receive messages for that user, or that the server is mis-configured for relaying.

Comments

Setting the time zone in FreeBSD

Couldn’t figure out how to set the timezone on my FreeBSD router/server box.

Found a mailing list post that suggested copying the appropriate file (in my case, PST8PDT) from /usr/share/zoneinfo to /etc/localtime. It worked well.. probably not perfect, but ;)

Comments

Freebsd ports tree… and updating it

I admit I’m a lazy person, so i love using the freebsd ports tree for software installs.. but when you don’t update it suddenly your left stuck without a source code file to install…

i’ve done updates using:

portsnap fetch update

give it a shot.

Comments

Setting up ip aliases in freebsd

Often times in a server environment your going to need to setup multiple ip addresses to the same ethernet card, it’s really a simple procedure, and the way that I generally do these things is create a file called /etc/rc.aliases and include the alias line in there:

If the IP is on the same netmask:

/sbin/ifconfig fxp0 alias 192.0.3.9 netmask 255.255.255.255

Otherwise, just specify the network address and netmask as usual:

/sbin/ifconfig fxp0 alias 172.16.0.223 netmask 255.255.255.0

once you’ve added each line, then add a line in the /etc/rc.local file

sh /etc/rc.aliases

This way when you want to edit the aliases on each server you have them all in one location.

Comments (1)

FreeBSD servers and keyboards

One of the minor issues I have with freebsd out of the box is that when I have a server network of a few hundred servers, I can’t just plug in a keyboard when we’re having an issue with the networking.

This is a common issue, the freebsd kernel doesn’t support just plug and play keyboards, however there is an easy fix to this mess.. well, easy if your comfortable recompiling a kernel (which you should be).

# cd /usr/src/sys/i386/conf
# cp GENERIC MYKERNEL

vi MYKERNEL

search for:

device atkbd0 at atkbdc? irq 1 flags 0×1

and replace the line with:

device atkbd0 at atkbdc? irq 1

save it (:wq!)

and then

# /usr/sbin/config MYKERNEL

# cd ../compile/MYKERNEL
(For FreeBSD versions prior to 5.0, use the following form instead: # cd ../../compile/MYKERNEL)

# make depend
# make
# make install
If everything went cleanly..
# shutdown -r now

and it should come back with a kernel that allows you to just plug in a PS2 style keyboard without any issues.

Comments

NTP — Keeping your clock in sync

One of the most insane things about working in the unix world is that it complains when the system clock on your computer is wrong. There is nothing more disturbing then when you create a tarball on another machine and extract it on yours and it complains that the files were created in the future.

A great way to deal with this problem is a system called ntp, network time protocol.

Network Time Protocol (RFC-1305), or more commonly known as NTP is pretty simple to setup, most OS’s are simply an RPM or ports tree install away.

(freebsd)
Connect to your machine and su - to root, then:

# cd /usr/ports/net/ntp
# make

# make install
# rehash

once thats done, simply run:

# ntpdate time.nist.gov
5 Nov 19:46:40 ntpdate[46439]: step time server 192.43.244.18 offset -2.467839 sec
#

This will update your server to the current time.

My suggestion is to set this up as a nightly cronjob,

# vi /etc/crontab

and add the line:

0 2 * * * root /usr/sbin/ntpdate time.nist.gov > /dev/null

and restart cron (

# killall -HUP cron

And you should be good to go!

Comments

« Previous entries ·