Wednesday, January 28, 2009

SELinux KVM QEMU errors

I'm getting close to disabling SELinux under F10. I'm trying to setup a bridged network so that my windows guest can have full access to the network. Windows runs fine in qemu_kvm using the "-net nic -net user" options. My problem is that in bridge mode it uses "-net nic,macaddr=11:22:33:44:55:66 -net tap". When I try to run the virtual machine I get this message "warning: could not configure /dev/net/tun: no virtual network emulation".

Update: I disabled SELinux, but that didn't fix the problem. I got rid of the error by configuring the tap at least somewhat correctly. I still can't get the bridge to work.

Update: My virtual machines now work with bridged networking. The MAC address that I created above doesn't work. You need to make it something else. Use the networking information on this page as a guide to setting it up. I'm using the /etc/qemu-ifup. I use this script to create 3 taps corresponding to three virtual machines so I can run them at the same time. I don't let my scripts for the virtual machine startup run the /etc/qemu-ifup script. If you're running SELinux make sure that you apply the proper labels to the image.

I'm running a machine with 8GBs of RAM on an AMD Phenom II 840 processor. I'm getting good performance with it. I did upgrage the Fedora 10 kvm module to one from Fedora 11 development repos so that it wouldn't have so many problems with audio.

Saturday, January 24, 2009

Send Hostname to Router

I have Tomato firmware on my Linksys WRT-54GL wireless router. I purchased the router so I could put Tomato or another open source firmware version.

One of the things that I wanted with this was to assign the same ip address to each computer through DHCP and get my internal DNS working without setting up bind. The tool that performs this duty and comes with most of these firmwares is Dnsmasq. It's a very easy to setup DNS and DHCP server.

The Tomato web interface makes it easy to assign an ip address to the specific MAC address of the ethernet or wireless network card. If the machine has one interface this isn't a problem. This becomes an issue for laptops that connect either via the wireless card or the ethernet cable. The problem is that Dnsmaq (and most other DHCP software) will not allow the same ip address to be assigned to two different mac addresses.

Most DHCP clients have the ability to send a hostname so that the DHCP server can assign a specific address to the machine everytime no matter the interface being used. This prevents tying the ip address to a specific MAC addresss. This ability is easy to enable in the Dnsmasq interface in Tomato.

Go to the Advanced -> DHCP/DNS. Enter the following in the custom configuration section:
dhcp-host=MyHostname.domain.what, 192.168.xx.xx

Change the information to be what you want it to be for your internal network. I don't use a "domain.com" or "domain.anything" that is could be a real domain name.

In Windows, change the computer name to match "MyHostname" and reboot. After rebooting, go to Start -> Run -> type cmd and click Run. A command window should have appeared. Type ipconfig[ENTER] to see the IP Address assigned. I had no problem setting this up in Windows.

Under Fedora 10, I ran into more difficulty. I used the normal Network Admin tools to attempt to set the "DHCP-Hostname". After starting the interfaces a few dozen times, I was never able to get the IP assigned in this manner.

NetworkManager is used to control the interfaces on the laptops. If it used to edit the connection information, there is an option on the IPv4 Settings tab for DHCP Client ID. This is not the same as sending the hostname.

In the man page for dhclient.conf, there's an option for sending the hostname:
send host-name "MyHostname.domain.what";

The problem is that NetworkManager does not read the file called /etc/dhclient.conf. NetworkManager generates it's own .conf file to pass to dhclient. Finally I came across a post that mentioned creating a file called /etc/dhclient-ifname.conf. In my case, the files are called:
/etc/dhclient-eth0.conf
/etc/dhclient-wlan0.conf

I placed the above configuration option for sending the hostname into these files and restarted NetworkManager. NetworkManager or the dhclient program picked up these file for the interface and sent the host-name. So it works for me now.

This is what's in my /etc/dnsmasq.conf file on the router:

interface=br0
domain=doman.internal
resolv-file=/etc/resolv.dnsmasq
addn-hosts=/etc/hosts.dnsmasq
expand-hosts
min-port=4096
dhcp-range=192.168.xx.mm,192.168.xx.rr,255.255.255.0,1440m
dhcp-option=3,192.168.99.2
dhcp-authoritative
dhcp-host=00:15:C5:BB:37:3C,192.168.xx.aa,1440m
dhcp-host=00:0B:82:04:03:E7,192.168.xx.bb,1440m
dhcp-host=00:04:F2:02:27:62,192.168.xx.cc,1440m
dhcp-host=MyHostname.domain.internal,192.168.xx.hh


If you don't want to maintain a /etc/hosts file on all of your machines, ssh into the router and edit the /etc/hosts file. Any ip and name pair will resolve when doing the following from the command line:
host machine-name

The /etc/hosts/file looks like this: This doesn't work

192.168.xx.aa MyHostname
192.168.xx.bb AnotherHostname



Update: Modifying the /etc/hosts files directly doesn't work. This post describes what you need to do. Go to Basic ->Static DHCP and add an entry. Don't fill out a mac address.

Update: Added a semi-colon to the send host-name line.

Tuesday, January 20, 2009

W2COG Agile for the Government

I came to W2COG website because it was referenced in an article in the Communications of the ACM on using agile software methods for government projects. They did an experiment where two projects were to produce similar software. One project used the "standard" procedures, spent $1.5 million, and only produced a document. The other project used agile methods, spent $100k, and produced working software.

They've published some information on using agile in government projects. Go to their website and click the publications link. I would provide a link, but it's one of the worst uses of flash for a website that I've seen (see previous post).

Update: Changed some of the sentences around and did away with worst website moniker. I've seen much worse sites. I was frustrated so I was harsh.

Flash Gone Wrong

If you want to a site where flash has gone wrong check out the website for the World Wide Consortium for the Grid. I don't understand why someone would want to create the entire site in flash.

Monday, January 19, 2009

Don't Use Boost Test

I've been using Boost Test in some production code that I work on. This code has to run and compile on RHEL 5. This should include the test, otherwise the tests aren't very useful. My work environment had been Fedora 7.

I recently updated my work laptop to Fedora 10. I started running my unit tests and noticed that they were failing. In version 1.34.1, the way to create and run tests was changed to what appears to be an incompatible way of setting up and running tests now. Because of the above requirements for RHEL 5 compatibility, this means that I can't rely on Boost Test.

I've been somewhat skeptical of using Boost, this kind of reinforces it for me. From what I can tell, there's been no guarantee of backwards compatibility or I've never read one. Perhaps the other modules/libraries in Boost do provide some kind of statement. The libraries that are scheduled for inclusion in the new C++ standard are probably the most stable.

If anyone can provide any hints how to fix this without adding too many ifdefs, feel free to chime in. I've not been able to use the suggested fixes in the link below.

Here's the error message that I get on link using the old style of Boost Test.
/usr/lib/gcc/i386-redhat-linux/4.3.2/../../../crt1.o: In function `_start': (.text+0x18): undefined reference to `main'

Discussion about changes:
http://archives.free.net.ph/message/20071218.095023.e2639d79.en.html

Here's an example using the new way that actually works.

#define BOOST_TEST_DYN_LINK
#define BOOST_TEST_MODULE MyTest
#include < boost/test/unit_test.hpp>

BOOST_AUTO_TEST_CASE( my_test )
{
BOOST_CHECK_EQUAL(2, 2 );
}


Update:I'm still using Boost Test even though it's not backwards compatibility. There's no requirements for testing in the code base that I'm using so I just use the post 1.34 capability. Also, there's no way that I could use another tool associated with the software product that I'm using. The requirement is that the software be available on RHEL 5.

Saturday, January 10, 2009

Windows 7 Beta Fail

So, I was going to download the Windows 7 Beta and install it on a qemu+kvm virtual machine. This would be the first time that I've ever downloaded a MS Beta product. Unfortunately, I need a MS Passport account so I can sign in and get it.

Considering all of the flack that MS has gotten for Vista, you would think that they would make obtaining the beta really easy. They're handing out keys for the OS like candy. Why would they limit a user to a Windows Passport account?

I may have had one in the past, but I don't remember what it was/is. I'm certainly not going to sign up for one now. My wife has a HotMail account. I may have her download it tomorrow.