Linux bridged network VMware Fusion OSX

Bridged network configuration with VMware Fusion 3 and a Macbook Pro’s Internal Wireless Card

For one of my development set ups, I use a virtual machine of CentOS through VMware Fusion 3 on a host of Mac OSX Snow Leopard running on a Macbook Pro.

My host uses the Airport (Wireless card) for its internet and my VM needs access to its internet to push to the development Git repository. My host also needs access to my Virtual Machine’s web server for testing the site before committing.

Pretty basic setup, all in all, so here it is:

I have VMware Fusion configured as a Bridged network with the internal wireless card. This will bind my Host’s wireless card (en1) to the ethernet of the virtual machine (eth0).

Note: The wireless card will be interpreted as an ethernet port in the Virtual Machine. If you want it to be interpreted as a wireless card, then you’ll have to use a USB wireless card.

1. Configure the network interface, set the IP address and the netmask:

ifconfig eth0 up 192.168.0.200 netmask 255.255.255.0

2. Add a route to the default gateway (router)… 192.168.0.1 is my router’s IP and eth0 is my card from the virtual machine:

route add default gw 192.168.0.1 eth0

3.
a) Add our DNS entry so we can resolve host names to IP addresses:

vi /etc/resolv.conf

b) Add the following to the /etc/resolve.conf file:

nameserver 192.168.0.1

Save, quit vi.

Check to make sure it worked!


ping google.ca

And there we have it!

This information was found from the following link, and this may offer more details if you need it:

http://www.fdlinux.com/networksetuphowto.html

That’s all you need for networking, but there’s one more step to allow the host to access the virtual machine’s website.

4. Edit the /etc/hosts file to resolve the chosen name to the VM’s web server:

192.168.0.200 local.dev.com

Now, when typing in “local.dev.com” in a web browser on the host’s machine it will load the virtual machine’s web server… assuming your virtual machine’s web server is configured correctly (which is beyond the scope of this article).

Git Delete Commit

To keep myself from looking when it happens again, here’s a personal reference of how to delete a commit:

If you made a commit, but have not pushed it to others:

git reset HEAD^

OR

git reset HEAD~1

both HEAD^ and HEAD~1 are shortcuts for the commit before head.

The above command will make sure you don’t lose your changes – instead, the commit will be deleted and your files will state they are locally modified. It’s the same thing as doing git reset –soft HEAD^

To delete your commit as well as ALL local changes including any staged, uncommitted, changes (remember, only if you haven’t pushed it to others):


git reset --hard HEAD^

If you already pushed your commit, you need to create a new commit that reverses your mistake.


git revert HEAD

Going green with electronics

Solar-Powered USB Charger

A few months ago I built a solar powered iPhone charger for a friend’s birthday – it turned out great!

The solar panel is 110mm x 140mm. It outputs 6V at 330 mA and charges a lithium ion polymer battery with a capacity of 1200mAh (total of about 4.5 Wh) and a nominal output of 3.7V.

Solar-Powered USB Charger Solar-Powered USB Charger

Christmas Post

Being the 24th of December, I thought it would be the perfect chance to give myself a gift – a new blog!

I’ve been planning it for awhile, I just hadn’t had the time until now (or so I keep telling myself…).

This blog will mainly serve the purpose of storing information I don’t want to forget, solutions to coding problems I’ve had and resolved, or just my general insane ramblings from time to time (though I do try to keep those on the down-low and off the internet).

Well, I hope you find the posts on my blog informative or interesting to read and I hope that you find whatever it was you were looking for when you landed here :-)

Merry Christmas and Happy New Year…or whatever season it is when you’re reading this ;-)