Friday, April 9, 2010

Start OS X TFTP Server using launchd

I had trouble with my TFTP Server application today which caused me to go digging and figure out how to run the TFTP server in OS X without an application to help me.

1. Edit the configuration
2. Start the server
3. Create a file with the appropriate file name and permissions
4. Stop the server

Edit the TFTP configuration file:

sudo vi /System/Library/LaunchDaemons/tftp.plist

You will probably want to edit the TFTP Directory string here:

 /usr/libexec/tftpd # The TFTP daemon
 -s # Enables the directory option. We're going to supply a directory next.
 /Users/my_username/Public/tftp # I edited this field with a directory I can find easily.

:wq # write and quit

Start the TFTP Server using launchd (launchctl):

sudo launchctl load -w /System/Library/LaunchDaemons/tftp.plist

Stop the TFTP Server:

sudo launchctl unload -w /System/Library/LaunchDaemons/tftp.plist
# For future reference when you want to stop the server. TFTP uses no authentication so you don't want to leave it on longer than you need it.


man tftpd
# The tftpd man page is very good

Pay close attention to this rule:

"Files may be written to only if they already exist and are publicly writable."

If you're using tftp to put a file from another system onto your system you need to create a file with that filename on your system before you try to put it on your system. You can do this using the "touch" command.

cd /Users/my_username/Public/tftp/

touch my_file.example
# Creates a tiny empty file with the name you give it

chmod 666 my_file.example
# You may need to chmod the file so that "other" can write to your file

Now that you've created this placeholder file and applied the appropriate permissions to this placeholder file you can go to your source system and send the file from your source system to your target system.

Thursday, January 28, 2010

VMware Fusion NAT Static IP Addressing

I am building a test Windows Server 2003 system in VMware Fusion. I need to assign the server a static IP address so the server won't complain about being configured for DHCP and also because a real DHCP server would have a static IP address. When I began researching this on the web I found references to editing the file: /Library/Application Support/VMware Fusion/vmnet8/dhcpd.conf

If you add a few lines such as those below to this file your host can remain configured for NAT and the OS can remain configured for DHCP and it will receive the statically assigned DHCP address configured in the dhcpd.conf file

host Windows_Server_2003 {
  hardware ethernet 00:AA:11:BB:22:CC;

If you supply the host with static DHCP via the VMware dhcpd.conf file the OS residing in the host, Windows Server 2003, will still complain that it's configured for DHCP because it doesn't realize it received a static DHCP address. I want to do this the easiest way possible and hopefully as close to reality as possible. Fortunately after googling some more I discovered VMware Fusion reserves the lower half of the subnet for static IP addressing and the upper half for DHCP. It is easier and works better for me to forget about configuring the dhcpd.conf file, leave the host configured for NAT, and manually configure the OS residing in the host for a static IP address within the range VMware reserves for static IP addressing.

The following VMware article was my reference for the addressing even though the addresses it lists are in a different subnet than the one VMware Fusion uses:

On my VMware Fusion installation I believe the addressing is as follows:

Address Use on a NAT Network


Address use



Host machine


NAT device


Static addresses




DHCP server



I was able to successfully leave my host set to NAT, and manually configure Windows Server 2003 with the following:

Wednesday, January 6, 2010

Installing Qosient Argus 3.0.2 on OS X 10.6.2

What is Argus?

Argus processes packet data and generates summary network flow data. If you have packets, and want to know something about whats going on, argus() is a great way of looking at aspects of the data that you can't readily get from packet analyzers. How many hosts are talking, who is talking to whom, how often, is one address sending all the traffic, are they doing the bad thing? Argus is designed to generate network flow status information that can answer these and a lot more questions that you might have.

My System:

OS X 10.6.2

Current Argus Version:

Argus 3.0.2
Argus Clients 3.0.2

Getting Argus:

Macports Argus isn't up to date so I downloaded the source and followed the instructions for the most part.

Download Argus and Argus Clients


I installed a few of the dependencies with macports.

sudo port install libpcap
sudo port install bison
sudo port install flex

tcp_wrappers is already installed on my system. I tried to install it with macports but it failed so I didn't try to fix the macports version and stayed with the OS X installation.

At the time I couldn't figure out what version of libpcap was installed on my OS X system so I installed it with macports. For future reference tcpdump -V will print the version of tcpdump and libpcap installed. My OS X installation has tcpdump version 4 and libpcap version 1 installed. Now I also have macports libpcap version 1 installed which supersedes the OS X installation in my path.

Bison was already installed on my system but the version was older so I installed a newer version with macports.

Flex was already installed on my system but I had already installed bison with macports so I decided to install flex with macports too. Probably not necessary that's just the way I did it.

Configure and Install Argus:

cd ~/bin/argus-3.0.2/
sudo make install

Argus installed successfully.

In hindsight I'm pretty sure all the dependencies I installed with macports were unnecessary. In Mac OS X 10.6.2 Argus will probably configure without installing or updating any additional software dependencies.

Friday, September 11, 2009

Using Sed to format text for Basecamp with Textile tables markup

Sometimes I have data in rows and cells in a spreadsheet I want to copy and paste into Basecamp with the tables. You can use Sed, the UNIX stream editor, to automate formatting the tabbed text into text which will appear in tables in Basecamp.

I copy and paste the data from the rows and cells in the spreadsheet spreadsheet into a text file. I'll name my text file "1".

Read the file named "1" line by line
For each line substitute each tab with " | "
Save the results in a file named "2"

The space after the first / is actually Ctrl-V Tab. If you type Ctrl-V the shell will record the meta character for the key you type. This will replace the tabs with " | " i.e. space pipe space. The g after the last / makes sed do this globally for the entire line not just for the first instance.

Read the file named "2" line by line
For each line substitute each first character with "| "
Save the results in a file named "3"

Read the file named "3" line by line
For each line substitute each last character with " |"
Save the results in a file named "4"

Super Sed:
If you use Super Sed this can be done in one command line consisting of the above operations piped one after another because Super Sed supports Perl-like editing of the file in place.

If you use a Macintosh and MacPorts you can install Super Sed with "sudo port install ssed"