Sam Cassiba

hacker

Breaking the Chains: Unbonding Bonded NICs

| Comments

I’m not sure why you’d want to do this, but say you have a couple of network interfaces teamed and you want to go back to using a single interface. Say you’re also using a Red Hat derivative, like CentOS. This could be because you want to use SDN or some other reason. In order to break the bond, you have to take down the interface. Typically, you should be doing this via OOB or some other dedicated interface:

Move the ifcfg files away from /etc/sysconfig/network-scripts:

# mkdir /root/`date +%Y%m%d`
# mv /etc/sysconfig/network-scripts/ifcfg-{bond0,eth*} /root/`date +%Y%m%d`

Take the interface down:

# ifconfig bond0 down

Remove active slaves:

# echo "-eth0" > /sys/class/net/bond0/bonding/slaves
# echo "-eth1" > /sys/class/net/bond0/bonding/slaves
...

Remove the bonding kernel module:

# rmmod bonding

Restart networking:

# service network restart

Wireless on FreeBSD

| Comments

According to the FreeBSD Handbook, you’re supposed to set the following in /etc/rc.conf:

  wlans_dev0="wlan0"
  ifconfig_wlan0="WPA DHCP"

This normally works, for the most part, but recently when I installed FreeBSD on a laptop, wireless wasn’t connecting. After a significant amount of research and trial and error, I came across another guide on wireless under FreeBSD by Warren Block here.

In short, what wound up working for me is using SYNCDHCP instead of DHCP, which tells the system to use synchronous mode and pause while DHCP completes.

Berkshelf and Multiple Chef Servers

| Comments

At work, we have multiple unique Chef Servers. They each serve different purposes. However, many components that are used are the same; one being Berkshelf. But, I ask, how do you deal with uploading cookbooks to different Chef Servers using your local workstation? You can manually move things around, create some scripts to do it, whatever. I came up with my own solution without having to write a single line of code.

I’m going to assume you know how to use Berkshelf since you’re reading this. Here’s what you do:

  • Install chefvm and create your environments
  • Create a symlink from ~/.berkshelf/config.json to ~/.chef/config.json
  • Drop your config.json files into ~/.chefvm/configurations/config_name{1,2,3}
  • ???
  • Profit

Now, when you issue ‘chefvm use config_name1’, Berkshelf will have the correct config. Simple as that.

Hello World

Howdy! My name is Sam Cassiba and this is my blog.

I’m using Octopress to serve this site via GitHub Pages. Look ma, no servers!

Getting started

To get started, create a new GitHub repo called yourgithubuser.github.io.

This is important because GitHub Pages will automatically look at this repository and serve up the content it finds in the master branch at http://yourgithubuser.github.io.

Clone Octopress and change to the new directory:

$ git clone git://github.com/imathis/octopress.git yourgithubuser.github.io
$ cd yourgithubuser.github.io

Install bundler and required gems:

$ gem install bundler
$ bundle install

Install the default theme:

$ rake install

Octopress has a rake task that automatically sets the repo up for deployment to GitHub Pages:

$ rake setup_github_pages

This task creates a new _deploy directory that is itself another git repository. This is where Octopress generates the flat website for deployment to the master branch of your repo on GitHub.

Octopress has rake tasks to make this easy to manage. Before going further, make sure everything checks out:

$ rake generate
$ rake deploy

This copies the generated files into _deploy, adds them to git, commits and pushes them up to the master branch.

Visit http://yourgithubuser.github.io in a browser to see your new site.

At this point, only the website has been committed. The source itself needs to be committed separately via:

$ git add .
$ git commit -m 'Initial source commit'
$ git push origin source

Theme customization

I’m using the ‘Whitespace’ theme by lucaslew.

I installed the theme by running the following in the root of the source branch. Say yes when it asks you to overwrite existing files.

$ git clone git://github.com/lucaslew/whitespace.git .themes/whitespace
$ rake install['whitespace']
$ rake generate

_config.yml

This is where the main site configuration lives. Things like the blog title and various third-party settings, Twitter handle, GitHub profile, etc.

Creating a new post

Easy as 3.14159:

$ rake new_post["Hello World"]

Deploying to GitHub Pages

$ rake generate
$ rake deploy

Make sure to manually commit changes made in the source branch.

Custom domain

GitHub has full details on how to do this in the GitHub Pages Documentation.

Inside your source branch run the following:

echo 'your-domain.com' >> source/CNAME

Regenerate your site and deploy up to GitHub. In your DNS settings point an A record (for your naked domain) to 204.232.175.78.

For www just point a CNAME record to yourgithubuser.github.io