Sunday, December 12, 2010

Setting up a VPN connection to a Linux Internet server

First, this has absolutely nothing to do with Ruby or Rails, but I wanted to post this since I couldn't find much good info anywhere.

If you have a need to connect to a server directly on the Internet (not on a private LAN) to access services on the server that are not publicly exposed, or to tunnel your Internet connection through that server, setting up a VPN connection to the server is the way to go. Most documentation, tutorials, etc. are for setting up a VPN to an entire behind the firewall network, but this guide is for setting up a VPN connection to just one server.

OpenVPN is the best server based VPN solution out there. It's open source so you can install it on any OS, I'll be guiding you through setting it up on a Ubuntu or Debian Linux server. Client software is readily available and easily configured for Windows, Linux, and Mac.

Setting up OpenVPN Server
Run "sudo apt-get install openvpn" to install the OpenVPN server.

Now you'll need to generate certificates and keys. Some example scripts are provided to make this easy.
  1. Run "sudo mkdir /etc/openvpn/easy-rsa/"
  2. Run "sudo cp -r /usr/share/doc/openvpn/examples/easy-rsa/2.0/* /etc/openvpn/easy-rsa/"
  3. Run "sudo chown -R $USER /etc/openvpn/easy-rsa/"
  4. Edit the file /etc/openvpn/easy-rsa/vars, and change the KEY_COUNTRY, KEY_PROVINCE, KEY_CITY, KEY_ORG, and KEY_EMAIL to what you want to show up in your server certificates.
  5. "cd /etc/openvpn/easy-rsa/"
  6. Run "source vars"
  7. Run "./clean-all"
  8. Run "./build-dh"
  9. Run "./pkitool --initca"
  10. Run "./pkitool --server server
  11. Now generate the actual keys in the keys folder. "cd keys"
  12. Run "openvpn --genkey --secret ta.key"
  13. Now copy all keys to the main open VPN folder with "sudo cp server.crt server.key ca.crt dh1024.pem ta.key /etc/openvpn/"
  14. Now you'll need to generate a client certificate. "cd .."
  15. Run "source vars"
  16. Run "./pkitool client-certificate-name", substituting client-certificate-name for whatever you want to call it.
Now you'll need to create a server config file for OpenVPN to use. Place this file in /etc/openvpn/server.conf. An example file with plenty of comments for all possible examples is in the file /usr/share/doc/openvpn/examples/sample-config-files/server.conf.gz. I'll show my example file here which is set up for the client to only access the server and to use the server's Internet connection.


# Port to listen on, this needs to be opened
# in the firewall
port 1194

# TCP or UDP server. I had better download
# throughput when using TCP, but slower
# upload throughput. If you have speed
# issues try switching this.
proto tcp
;proto udp

# Use "dev tun" to create a
# routed IP tunnel, where clients get their
# own subnet behind the server. This is
# what you should use if you only want to
# VPN to the server to access private server
# resources, or to get the client out to the
# Internet through the server's connection.
# "dev tap0" is used for an ethernet bridge
# VPN, this config isn't for this type of
# VPN.
dev tun

# Certificate and key file locations
# (in /etc/openvpn/)
ca ca.crt
cert server.crt
# This file should be kept secret
key server.key
# Diffie hellman parameters.
dh dh1024.pem

# For "dev tun" configurations only.
# Configure server mode and supply a VPN
# subnet for OpenVPN to draw client
# addresses from. This can be modified to be
# any private /24 network (ie 192.168.10.0,
# 10.8.8.0, etc.) that the server doesn't
# already know about.
# The server will take 172.18.100.1 for
# itself, the rest will be made available to
# clients. Each client will be given its own
# /30 subnet in this range, and will able to
# reach the server on 172.18.100.1. Comment
# this line out if you are using "dev tap"
# for ethernet bridging.
server 172.18.100.0 255.255.255.0

# Maintain a record of client <-> virtual IP address
# associations in this file. If OpenVPN goes down or
# is restarted, reconnecting clients can be assigned
# the same virtual IP address from the pool that was
# previously assigned.
ifconfig-pool-persist ipp.txt

# Push routes to the client, if you have
# other subnets that you want the client to
# access through the VPN. Isn't
# necessary for dev tun connections, as you
# only want the client to access the VPN
# server.
;push "route 192.168.10.0 255.255.255.0"

# Specify a DNS server that the client
# should use, by default it will continue
# to use its regular DNS server, which you
# probably don't want it using with all 
# traffic going through the VPN. 8.8.8.8
# is the Google public DNS server
push "dhcp-option DNS 8.8.8.8"

# Enable this to cause all of the client's
# Internet traffic to go through the VPN,
# including DNS requests (if this is set
# you should enable the above DNS option).
push "redirect-gateway def1 bypass-dhcp"

# The keepalive directive causes ping-like
# messages to be sent back and forth over
# the link so that each side knows when
# the other side has gone down.
# Ping every 10 seconds, assume that remote
# peer is down if no ping received during
# a 120 second time period.
keepalive 10 120

# The server and each client must have
# a copy of this key.
# The second parameter should be '0'
# on the server and '1' on the clients.
tls-auth ta.key 0 # This file is secret

# Enable compression on the VPN link.
comp-lzo

# It's a good idea to reduce the OpenVPN
# daemon's privileges after initialization.
user nobody
group nogroup

# The persist options will try to avoid
# accessing certain resources on restart
# that may no longer be accessible because
# of the privilege downgrade.
persist-key
persist-tun

# Output a short status file showing
# current connections, truncated
# and rewritten every minute.
status openvpn-status.log

# By default, log messages will go to the syslog
# Use log or log-append to override this default.
# "log" will truncate the log file on OpenVPN startup,
# while "log-append" will append to it. Use one
# or the other (but not both).
;log openvpn.log
;log-append openvpn.log

# Set the appropriate level of log
# file verbosity.
# 0 is silent, except for fatal errors
# 4 is reasonable for general usage
# 5 and 6 can help to debug connection problems
# 9 is extremely verbose
verb 3

# Silence repeating messages. At most 20
# sequential messages of the same message
# category will be output to the log.
;mute 20


Now that you have the server configured, if you're running a firewall on the server, here are the rules that you should add to iptables to allow traffic from your VPN clients to go through, and to open the OpenVPN port (these are usually in /etc/iptables.rules). First, add this to the top section, above the current rules. Substitute eth0 with the interface for the public Internet on your server.

*nat
:PREROUTING ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A POSTROUTING -s 172.18.100.0/24 -o eth0 -j MASQUERADE
COMMIT

Now, add these to your filter rules:

-A INPUT -i tun+ -j ACCCEPT
-A INPUT -p tcp -m tcp --dport 1194 -j ACCEPT
-A INPUT -p udp -m udp --dport 1194 -j ACCEPT
One last thing you'll need to do. To enable forwarding of data from your VPN clients to the server's Internet connection, edit the file /etc/sysctl.conf and uncomment the following line:

net.ipv4.ip_forward = 1

Now, the server's configuration should be complete! To make sure the firewall settings are correct just reboot the server.

Configuring the Client
Now you need a client to use with your OpenVPN server. For Linux, just use openvpn. You can simply place a client.conf file and all necessary certificates/keys in /etc/openvpn/. For Windows and Mac, get your client software from http://openvpn.net/index.php/openvpn-client.html. Use Community version for Windows.

I had some trouble getting the Windows client to install in Windows 7, particularly the network driver install. Be sure that the first time you install it, that when it pops up to install the driver, check to trust all software from this provider before clicking Install. If you don't check this, you must first run Delete all TAP virtual ethernet drivers from the OpenVPN -> Utilities folder on the start menu as an administrator (right click, Run as Administrator). Then uninstall it. Then right click on the install file and click Run as Administrator.

Now you'll need to copy the keys from the server to the client. For Windows, copy the following files to C:\Program Files (x86)\OpenVPN\config from /etc/openvpn/easy-rsa/keys on the server. For Linux, copy these files in to /etc/openvpn/.
  • client-certificate-name.crt
  • client-certificate-name.key
  • ca.crt
  • ta.key
And you'll need to create a servername.ovpn file that contains the client configuration file in the same directory. In Linux just call it client.conf in /etc/openvpn/. Here is my example servername.ovpn file:



client
dev tun
proto tcp
remote your_server_ip_address 1194
nobind
persist-key
persist-tun
ca ca.crt
cert client-certificate-name.crt
key client-certificate-name.key
tls-auth ta.key 1
comp-lzo
verb 3

Now, in Windows, to launch the client, you'll need to right click on the desktop and click Run as Administrator. If you don't run it as administrator, the routes can't be modified. Once you do this, just right click on the tray icon and click Connect. This should be it! Now all of your Internet traffic will be going through your server.

Windows 7 or Mac?

This blog posting was originally made on brentsowers.com on January 1, 2010.

Your current Windows laptop is a several years old, and is running pretty slow. You want to get a new laptop. The I'm a Mac and I'm a PC ads have been effective, it's made you think about getting a Mac. But you've also heard lots of good things about the new Windows 7? Do you make the switch and get a Mac, or get a new PC laptop with Windows 7? This is a question that many Windows users have thought about lately.

I've been a Windows user for a long time now, back to Windows 3.1. I used Macs a little 12-14 years ago in high school but haven't used one since. However, recently I got a Mac laptop at work for doing Ruby on Rails development. Shortly after I started using this at work, my Windows 7 upgrade discs arrived, and I upgraded my home desktop and home laptop to Windows 7. I've been using both for a few months now, and my experience with both has been very positive.

So I thought, why not write up my general impressions from using both Mac and Windows 7? I've been keeping constant notes on both as I've used them, learning how to use them, wondering why things work the way they do, finding problems with them, etc. By the end of this write up, I will give you my recommendation for the question at the beginning - make the switch or get a new Windows 7 computer.

Hardware
This isn't a true comparison, since I didn't get a new PC. My new Mac laptop is a 13" Macbook Pro. I've got to say that I am amazed at how nice of a laptop this is. The form factor is perfect, it's small enough to easily fit in to backpacks, it's easy to carry around, and it's light. The 13" screen looks great, it's still big enough to be able to do pretty much anything, however, I'm not sure I'd want to use it as my main computer, if I did I'd want an external display. All ports are on the same side which is nice. There aren't many ports, but when do you really need lots of ports on a laptop? 2 USB, 1 firewire (which I can't ever think of a reason why I'd need or even want), ethernet, power, display, SD card, and headphone. What else do you need? The DVD drive is on the other side, it's a slot load which is much better than a tray like many PC laptops have (no way to break a tray if there isn't one). The case is aluminum unibody, which means that it's basically one piece of aluminum. I LOVE this, the laptop feels much more sturdy than any PC laptop that I've ever used (well, maybe except for the big Toughbook). The only downside of this is that if you've just brought your laptop in from outside, and it's a cold day, the laptop will feel really cold!

In addition to all of the above things, Apple really seems to get the little details nearly perfect too. The screen opens and closes easier and more smoothly than any PC I've used. The power adapter is great - it attaches to the laptop with a magnetic connector. So if someone trips over your power cord, it will very easily yank out of the laptop without dragging the whole laptop with it. The keyboard keys are slightly lit up when it's dark in the room. The touchpad is huge and works great. The entire touchpad is a button, so there are no separate buttons to click, which is great.

Do I sound like an Apple fanboy yet?

My first gripe about the hardware is a pretty minor one. The display port is useless by itself unless you have a ridiculously expensive Apple monitor because it's a Mini Displayport connector. For it to be useful you have to buy the $30 Mini Displayport to VGA or $30 Mini Displayport to DVI adapter when you buy the laptop. Another gripe is the lack of choices for hardware. It's either a Macbook, Macbook Pro, or Macbook Air for laptops, and you don't get too much choice on components for them.

But those two gripes are far outweighed by how good the hardware is. I've never used or seen a PC laptop that has hardware that's as solid as the Macbook Pro.

Winner: Mac by a longshot


Turning on for the first time
I was very impressed with how simple and quick it was to get up and running for both. The Mac asked me a few questions like my name, then allowed me to easily select my wifi network. After this I was at the desktop! Windows 7 was about the same after upgrading with a clean install. Very few questions, all questions were easy to understand, and very easily to select the network to connect to. There were no questions about drivers, hardware, etc.

Both just kind of leave you hanging after you get to the desktop. There is no tutorial, no video explaining how to use them, or what's different from previous versions of the OS. It seems pretty easy to me to figure out how to use, but I can see a lot of people being confused, particularly Windows users that are coming from XP and not Vista.

However, both operating systems are very intuitive. I didn't think too often "that's confusing, why is it like this?" This more than outweighs the lack of a tutorial or video in both.

Winner: Both

Using the OS
This is a pretty big cateory so I'm going to split it up.

Loading programs and navigating between them
Loading programs, and navigating between running programs are two seemingly simple tasks but is one of the core things that can either make the operating system easier or harder to use. Both Windows 7 and Mac attempt to essentially blur the line between a program that's running and one that's not. Windows 7 has added a new taskbar that replaced the old taskbar that's essentially been the same since Windows 95. When you load a program, it shows up as a large icon with no text in the area where the taskbar used to be. If a program has multiple windows or instances running, the icon looks stacked. If you right click on this icon, you can "pin" the program to the taskbar, so it always appears in the taskbar. Programs that are actually running look different in the taskbar so you can easily see which ones are running. Moving your mouse over a running program's icon here shows you a little preview of the program, that you can click on to bring the program to the front. Many programs also support additional options if you right click on this icon, like loading your most recent documents for Word. All programs have an option to load a new instance of the program from the right click menu.

The old start menu is still there, it's like the Vista start menu which is one big list of programs. However, with the new taskbar, I rarely use the Start menu.

Mac has something similar to the new Windows 7 taskbar called the Dock. All running programs show up here, and programs that you've pinned to the dock are always there with one click to load them. This works great, just like Windows 7. It looks cooler than the Windows 7 taskbar, programs slide in and out with a cooler visual effect, and icons automatically resize depending on how many icons are in the dock. But that's about the only advantage it's got over Windows 7.

First, looking cooler comes at the expense of screen space. I'm sure it would be fine on a 17" Macbook pro with a big screen, but on my 13" it takes up way too much space at the bottom of the screen. I've moved it to the right side of the screen instead, but now it doesn't look as nice. Second, it's harder to visualize which programs are running. There's only a little dot below the icon to indicate that it's running, the visualization that Windows 7 has is much nicer. You can't mouse over the dock icon to get a preview of all windows of that application, like you can in Windows.

For navigating between running programs, Mac has a really cool feature called Expose. Activating Expose shows previews of all running windows in the foreground, and you can click on the one that you want to bring to the front. This is nice, but it's still not as easy to navigate between running programs on a Mac. First, bring up Expose isn't quick or convenient. Press F3 on the keyboard, or use all 4 fingers on the touchpad and move down. Second, if you've got a lot of open windows, the Expose screen seems really cluttered. You can always click on the program's icon in the dock, and if you have just one window for a program, this is a quick way to bring that program back to the front. But if a program has multiple windows, you've got to right click on it, and a non-user friendly text list shows up of all windows, no preview.

I consistently find myself getting frustrated when trying to bring back a different window of an already running program on Mac. I never have this problem in Windows. This is a huge annoyance for me. If Mac would just copy the hover over window previews that Windows 7 has, this would help a lot.

Mac also has an Applications folder which is similar to the start menu, except just for launching applications. I can see that it won't be quite as cluttered as the Windows start menu, since only application shortcuts get installed here. But that also means that icons don't get grouped by program name, and there aren't shortcuts for help pages, read me files, etc. This could be a good or bad thing, I'm not sure how I feel about it.

Winner: Windows

Program User Interface Features
In addition to the operating system wide capabilities for navigating around, another important part is navigating around individual programs. Individual programs have their own controls, but most have a common set of capabilities.

First, is the menu bar. Most programs (but not all in Windows) have a menu bar with File, Edit, etc, where clicking each main heading shows a list of options underneath for performing actions. In Windows, each program can have but doesn't have to have a menu bar. The menu bar is inside of the program's window. This works well, and it's always worked this way.

On Mac, however, there is always one menu bar at the very top of the screen, spanning the entire length of the screen. The contents of the menu bar change based on what program is the active program. I do not like the way this works at all. First, even on a 13" screen, there's always some empty white space for bigger applications like Firefox. Smaller applications have even more white space. I'd rather have that space back and let the application have the menu. Second, you've got to change which program is active to even see what menu options there are. Third, you might think one program is active and start clicking on the menu bar to do something, only to realize that you're actually clicking menu options in a different program. I think that having one menu bar for all programs is confusing, and I think the way Windows (and other operating systems) have always done it, with a menu bar per program, is much better.

Mac and Windows both have 3 common buttons in all applications - close, maximize, and minimize. This hasn't changed much since Windows 95 for Windows - close completely closes the window and program, maximize makes the window take up the whole screen, and minimize keeps the program running but hides the window down to the task bar. Things work similar in Mac, with a few key differences. Maximize (the green button) works the same. Minimize (yellow) is similar, except that the minimized program window goes in to a separate area of the dock. I'm not sure why there is a separate area of the dock for these. I don't find it any more useful to have a separate area of the dock, these minimized windows could just be activated by clicking on the program's main icon in the dock, like the Windows taskbar. The close button (red) is what I have a problem with though. When you click Close, the window goes away, but the program itself doesn't close, it stays running. The only way to get a program to actually stop running is to click the program's name in the menu bar at the top and click Quit, press Command (keyboard button) + Q while a program is running, or right click it in the dock and click Quit. I don't understand this at all. If you close the last window of a program, why would you want it to still run?

Maybe some of this is just me being used to Windows, but I just find the program specific controls much better in Windows 7.

Winner: Windows

Exploring and navigating files
Windows has Windows Explorer to browse and find files, and Mac has Finder. In Windows 7, not too much has changed from Vista, but it is somewhat different than XP. Windows 7 has added "Libraries", where you can quickly see all of your Documents, Music, Pictures, and Videos. This is similar to the My Documents, My Music, etc. that Windows previously had, except that you can add in other folders to these views as well. This is very helpful. Other computers in your homegroup (see the networking section later) also show up on the left side here. Navigating folders and files is pretty much like it always has been in Windows, except by default you don't see a tree structure of all files and directories as you're navigating.

Mac is pretty similar. I don't see a similar thing to Libraries though, the link for Documents is just one folder, and there is no Pictures, Music, or Videos links. There are quick search links on Finder by default, click to find all Images, Movies, and Documents, or everything from today, yesterday, or the past week.

Both have quick searching capability that will update search results as you type.

The capabilities are very similar, and any problems with one are equaled by different problems in the other.

Winner: Both

Speed
I haven't run any official speed tests or timed anything, so I'm just going by what I see. Both seem very quick, programs load quickly, things seem to run fine when lots of programs are loaded at once. Boot up times in Windows 7 are much better than Windows Vista, they're fast enough that you hopefully won't leave your computer on at night just becuase it takes so long to boot up. But Mac is MUCH faster at booting up. Shut down is the same story, Windows 7 seems quicker than Vista, but still a lot slower than Mac.

Winner: Mac

Stability
So far, both operating systems seem to be pretty stable, but not without issues. In Windows 7, I got an error at one point when copying lots of files to a USB flash drive, and no matter what I couldn't copy files. I ended up having to format the drive to be able to copy new files to it (files could be read no problem). I reset my computer without properly shutting down, and got the ugly start Windows in safe mode prompt. I'm used to this so I know what it is, but a lot of people might be a little scared off by this ugly screen.

Mac isn't without it's problems either. The program that I use with my AT&T 3G card, Globetrotter connect, always causes problems if I use it for a long time. The network will stop working, and if I click Disconnect and reconnect, nothing happens. Unplugging and plugging the card back in does nothing. I can't even shut the computer down. If I do this, the computer just sits there. I have to hold the power button in for 5 seconds. This isn't a one time thing, it's happened to me at least 5 times. No program should ever cause me to have to hold the power button in to turn the computer off. And I had an issue once where the computer would not get an IP address until I fiddled around with the network settings, not actually changing anything but clicking through different screens.

But, despite these few problems, both seem pretty stable.

Winner: Both

Included Programs
The operating system by itself doesn't do you much good, you need programs to do stuff. There isn't much good to say about what comes with Windows. Internet Explorer 8 is a very poor web browser, Microsoft still hasn't caught up to freely available browsers (Firefox, Chrome, Safari). It's slow, and has security issues. Windows Media Player is OK but seems a little clunky. Windows DVD maker seems like it could be good but I haven't tried it. Two small but useful applications are sticky notes and snipping tool.

Mac, on the other hand, has great programs included. First, the web browser is Safari, which is much better than Internet Explorer. iTunes is the included media player, which I'm not a huge fan of but is better than Windows Media Player. Where Mac really stands out are the programs where there isn't something comparable in Windows. Take iPhoto. This program allows you to very easily organize and edit your digital pictures. It's very simple to use and has as many capabilities as any photo program a regular person would ever want. It's also got a cool face recognition feature, which will find pictures of the same person. And, you can map photos (although it didn't read the coordinates on my geotagged photos). It's a better program for managing your photo collection than any program I've ever seen on Windows, and it comes with the OS. iCal is another pretty cool program that will use your Gmail or other online calendar, or use your own if you don't want to use an online calendar. iChat allows you to video chat with your IM buddies. Honestly, I haven't tried many of the other i programs, but the ones I have used are great.

Another really cool and useful utility that comes with Mac is Time Machine. If you buy a time machine compatible (you don't have to spend the extra money on an Apple Time Capsule) network hard drive (NAS), time machine will automatically make backups of your computer to it. You can easily browse through prior backups and find old versions of files, files that you accidentally deleted, etc. Or worst case, your hard drive dies (which a surprising number of people I know with Macs have had happen), you can restore from this. It's so easy to use!

Winner: Mac by a long shot

Other Programs
Windows has been the dominant desktop operating system for a really long time, and it definitely shows in the number of third party applications that are available. Windows 7 will run most old Windows applications without any problems, but I have run in to a few that won't run correctly (Winamp and VMWare Server). But just like Apple says "there's an app for that" about the iPhone, well, there's an application for just about anything on Windows. And most are free. I can't say the same thing about Mac. While there are a lot, there aren't anywhere near as many as Windows. And a lot of them cost money.

The abundance of programs for Windows can cause problems for security and stability. Many install spyware, and that's how the application company makes money. However, a good antivirus will keep most of these away.

Winner: Windows

Security
Windows 7 is MUCH improved over Windows XP for security, but it still has its problems. Most of it is related to the abundance of free applications that install spyware. In Windows 7, if you run a good anti virus (I would recommend Malwarebytes Anti Malware, it's fast and effective, buy the full version so you can get the real time protection), and allow updates to be installed automatically (the default setting), you shouldn't have any problems. But the simple fact remains, you don't have to run an anti virus on Mac to be safe.

Winner: Mac

Networking and file sharing
I only have one Mac, so I don't have a good comparison here. But from what I see with Windows 7, their home networking features would be tough to beat. Windows 7 has a new "homegroup" feature, which allows you to share your documents, music, pictures, and video libraries with anyone in your homegroup. This does just about everything right, other computers in your homegroup show up in Windows Explorer on the left pane, and you can very easily view and edit these files. You can also set up custom permissions, so things are read only, or only certain people in your homegroup have access. The biggest problem with this is that it's only available in Windows 7, not even Vista. So other computers have to have 7 to use this. Microsoft, why has it taken you so long to get this, and why don't you make a Vista and XP program to do the homegroup?

Media sharing is also integrated in to the libraries, pictures, music, and videos can be shared to other media devices. iTunes has this capability too but I haven't tried it.

Winner: Windows

Price
OK, price is a pretty important thing. The absolute cheapest Mac laptop that you can get is $1000. A few months ago Apple revamped this base Macbook laptop and it's actually a really good computer now. The biggest problem with this is that it has a 13" screen, and you can't get a bigger screen. I like the 13" screen of my Macbook Pro, but I wouldn't want to use it as my primary computer. Most PC laptops are 15", but from what I could find the 13" PCs are actually more expensive. A comparable 13" PC laptop will run you maybe 200 dollars less.

However, most PC laptops are 15". I think a 15" makes more sense as your primary computer. So let's compare prices for those. The base 15" Macbook pro is $1700 (ouch!). A comparable HP laptop with about the same specs is $925. That's almost $800 difference. Let's take it one step further and look at 17" laptops. A top of the line HP 17" laptop is $1500, and a comparable Macbook Pro is $2875, a difference of almost $1400!

Where the PC really stands out is the budget laptop. Say you don't have $1000 laying around to spend on a laptop. You can get a really good HP laptop with an AMD 2.2 GHz dual core CPU, 15" screen, 3 gigs of RAM for $500. This computer won't be slow, it'll run just about as fast as the 15" laptop that I priced out above. Now if you really want to go budget, you can get an Acer 15" laptop with a single core CPU, 3 gigs of RAM, for $330 from Best Buy. This laptop will run fine for years to come. The cheapest you can get a Mac for is $1000.

It's hard to argue against this. You can say that Windows costs more because you have to buy extra programs (anti virus, good image editing, etc.). Well, that will barely make a dent in the $925 difference for high end 15" laptops.

Winner: Windows, by a long shot

Other Factors
One thing that I love on Mac is the new multi touch mouse gestures. You can use two fingers on the touchpad to scroll up and down, three to go back and forward, etc. This is WAY better than what most PC laptops do with reserving an area on the top and right of the touchpad for this. Also, Apple has FINALLY added a right click capability, simply click the touchpad with two buttons for the equivalent of right click. Apple people, how did you go for so long with having to hold Ctrl for right click?

One annoyance I have with Mac is how programs are installed. When you download a program, you usually have to drag the icon for the program in to the applications folder, why don't programs do this automatically? And it leaves a "drive" on the desktop for the installer files, that you have to eject by right clicking on it or dragging it to the trash

However, the Downloads folder makes up for this. All downloaded files are stored in a Downloads folder which is accessible from the dock at all times. No wondering "Where did I download that file to?" like sometimes happens in Windows.

Winner: Mac


Final Verdict
It's very close, but I would recommend getting a new Windows 7 laptop instead of making the switch to Mac. While the Macbook Pro is a great computer, it just isn't worth the huge price difference. While Windows 7 has its shortcomings, particularly in bundled applications, in other ways it's better than the Mac OS. Honestly, if prices were the same, I MIGHT recommend making the switch. But prices aren't the same. However, you can't go wrong with either.