RSS

Posts Tagged ‘FreeBSD’

FreeBSD quote of the day #31

Monday, January 31st, 2011

Need to remove all those ^M characters from a DOS file? Try
tr -d \\r < dosfile > newfile

FreeBSD quote of the day #30

Sunday, January 30th, 2011

Want to strip UTF-8 BOM(Byte Order Mark) from given files?
sed -e '1s/^\xef\xbb\xbf//' < bomfile > newfile

FreeBSD IP Alias: Setup 2 or More IP address on One NIC

Thursday, January 27th, 2011

IP aliasing is the process of assigning more than one IP address to a network interface. This is useful for Apache web server virtual hosting or other network servers such as ftp server.

This tutorial explains how to assign one or more IP address to a single network interface under FreeBSD operating system.

It is possible to create network alias or assign 2 ip address to a single NIC under FreeBSD operating system.

Our Sample Setup

  • Interface name: lnc0 – IP : 192.168.1.1/255.255.255.0
  • Interface name: lnc0 alias - IP : 192.168.1.5/255.255.255.255

Netmask must be different otherwise you will get an error ifconfig: ioctl (SIOCAIFADDR): File exists.

Set ip alias using ifconfig command line utility

Login as the root user.

Now, use ifconfig command as follows to set alias:
# ifconfig lnc0 192.168.1.5 netmask 255.255.255.255 alias

Persistent IP Alias Configuration

Edit file /etc/rc.conf to setup persistent ip aliasing option by appending following configuration, so that next time FreeBSD comes up (after restart/shutdown) it will create alias for you:
ifconfig_lnc0_alias0="192.168.1.5 netmask 255.255.255.255"

Finally, Restart FreeBSD network service using network restart script:
# /etc/rc.d/netif restart && /etc/rc.d/routing restart

More information about this here: http://www.cyberciti.biz/tips/freebsd-how-to-setup-2-ip-address-on-one-nic.html

Creating and Controlling Jails in FreeBSD

Thursday, January 27th, 2011

Since system administration is a difficult and perplexing task, many powerful tools were developed to make life easier for the administrator. These tools mostly provide enhancements of some sort to the way systems are installed, configured and maintained. Part of the tasks which an administrator is expected to do is to properly configure the security of a system, so that it can continue serving its real purpose, without allowing security violations.

One of the tools which can be used to enhance the security of a FreeBSD system are jails. Jails were introduced in FreeBSD 4.X by Poul-Henning Kamp phk@FreeBSD.org, but were greatly improved in FreeBSD 5.X to make them a powerful and flexible subsystem. Their development still goes on, enhancing their usefulness, performance, reliability, and security.

More information about this can be found here:

Installing VirtualBox™ in FreeBSD

Thursday, January 27th, 2011

For a number of years, FreeBSD was not officially supported as a host OS by any of the available virtualization solutions. Some people were using older and mostly obsolete versions of VMware (like emulators/vmware3), which utilized the Linux® binary compatibility layer. Shortly after the release of FreeBSD 7.2, the Open Source Edition (OSE) of Sun’s VirtualBox™ appeared in the Ports Collection as a native FreeBSD program.

VirtualBox is an actively developed, complete virtualization package, that is available for most operating systems including Windows®, Mac OS®, Linux and FreeBSD. It is equally capable at running Windows or UNIX® like guests. It comes in two flavors, an open source and a proprietary edition. From the user’s point of view, perhaps the most important limitation of the OSE is the lack of USB support. Other differences may be found in the “Editions” page of the VirtualBox wiki, at http://www.virtualbox.org/wiki/Editions. Currently, only the OSE is available for FreeBSD.

More about this here: http://www.freebsd.org/doc/handbook/virtualization-host.html

How to obtain the /usr/src source tree in FreeBSD

Wednesday, January 26th, 2011
  1. Install CVSup by (as root) running pkg_add -r cvsup-without-gui
  2. Edit /usr/share/examples/cvsup/standard-supfile and use a cvsup server mirror near you (pick one from here, in ‘CVSup Sites’ section)
  3. Get all sources for your release by running (as root again!) cvsup -g -L 2 /usr/share/examples/cvsup/standard-supfile

Grab a newspaper because the download will take quite a while.

Tomcat 7 on FreeBSD 8.1

Tuesday, January 25th, 2011

I have installed Tomcat from ports: cd /usr/ports/www/tomcat7/ && make install clean, added tomcat7_enable=”YES” to /etc/rc.conf but there was still something missing.

It turned out I had to add the java home to /etc/rc.conf: tomcat7_java_home="/usr/local/diablo-jdk1.6.0/"