Some times we need to use our existing hosting account to (maybe temporarily) place another web-site in it. But what we can do, if our hosting provider allows only one hosting directory and only aliases for main site (as GoDaddy.com does)? We can use the following Apache+mod_rewrite trick to host unlimited number of domains on one hosting directory.

First of all, we need to point our new domain to hosting server IP. If server’s IP is static, we can do it by simple A-record in our DNS-zone control panel:

    new-domain.com  IN A IP.ADD.RE.SS

If you don’t know IP address of hosting server or this address is not permanent (for example, because of some load balancing used by hosting provider), you can use simple trick with CNAME-record in your new DNS-zone:

     new-domain.com  IN CNAME already-hosted-domain.com.

After the first step was finished we have new-domain.com pointed to our hosting provider’s server. Now, we need to add this domain support to hosting server. We can do it by your hosting provider’s “Domain aliases” option or another option with such meaning.

After we have associated our new domain name with existing directory on hosting server (/hosting/dir), everything we need is to do something to force hosting server to use some sub-directory for all requests to new-domain.com (/hosting/dir/new-domain). To do it, we need to put following code into the .htaccess file in /hosting/dir directory:

    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_URI} !^/new-domain/
    RewriteCond %{HTTP_HOST} new-domain\.com$
    RewriteRule (.*) http://already-hosted-domain.com/new-domain/$1 [L]

That’s all! After we have created this file, all requests to new-domain.com will be pointed to /hosting/dir/new-domain directory.

source here

Sometimes we need to connect two or more geographically distrubuted ethernet networks to one broadcast domain. There can be two different office networks of some company which uses smb protocol partially based on broadcast network messages. Another example of such situation is computer cafes: a couple of computer cafes can provide to users more convinient environment forr playing multiplayer computer games without dedicated servers.

Both sample networks in this article need to have one *nix server for bridging. Our networks can be connected by any possible hardware that provides IP connection between them.

Short description: In described configuration we are connecting two remote LANs to make them appearing as one network with 192.168.1.0/24 address space (however physically, presense of bridges in network configuration is not affecting IP protocol and is fully transparent for it, so you can freely select any address space). Both of the bridging servers has two network interfaces: one (as eth0 in our example) connested to the LAN, and second (eth1) is being used as transport to connect networks. When ethernet tunnel between gateways in both networks will be bringed up we will connect tunnel interfaces with appropriate LAN interfaces with bridge interfaces. Schematically this configuration can be following:

          +-------+                       +-------+
          |  br0  |                       |  br0  |
          +-------+                       +-------+
           |     |                         |     |
Network 1  |     |                         |     |   Network 2
----------eth0  tap0---eth1........eth1---tap0  eth0---------------

Setting Up Bridging Servers

Notice: This article describes Debian GNU/Linux servers setup. If you are using another distribution, there can be some differences in network configuration and package management, but the main idea of described actions will be the same.

First of all, we need to check if tun and bridge modules is not included in current kernel. If they are not includen, we need to rebuild kernel with CONFIG_TUN and CONFIG_BRIDGE options.

Next, we need to create tunnel device file for our tunnel: Read the rest of this entry »

Sometimes, I need to connect remote Unix servers with tunnels to provide some specific services or to get access to some internal networks. I was very surprised, when my friend, young system administrator, asked me about how to bring up IP-IP tunnel between different Unix operating systems (FreeBSD and Linux in his case) and said, that he can’t find information about this configuration. As the result of my discovering, this HOWTO has been created.

Lets see to what we have and what we need to do.

We have 2 servers:

  • Server1:
    • OS: Linux
    • Network Interface: eth0
    • IP: 100.100.100.100
  • Server2:
    • OS: FreeBSD
    • Network Interface: fxp0
    • IP: 200.200.200.200

We need to get IPv4 over IPv4 tunnel with the following parameters between described servers:

  • Server1: 10.0.0.1 / 255.255.255.252
  • Server2: 10.0.0.2 / 255.255.255.252

To setup described configuration on Linux server we need to do following steps:

  • Create ipip tunnel interface:

    # ip tunnel add tun0 mode ipip \\
    > remote 200.200.200.200 local 100.100.100.100 dev eth0
    

  • Set interface IP addresses:

    # ifconfig tun0 10.0.0.1 netmask 255.255.255.252 \\
    > pointopoint 10.0.0.2
    

    Read the rest of this entry »

You can use the ‘pw’ command to add a user and or group to the FreeBSD System.
The ‘pw’ command is a program that will allow any user with superuser priveledges
to edit and or add users and groups on FreeBSD with ease. It also allows you a way
to standardize modification of adding and removing users and groups.
You will want to be logged in as root and or a user with sudo access.

# pw groupadd adminusers

This would create the group ‘adminusers’ to the machine.

Now say you want to add the users ‘mike’ to the adminusers using pw

# pw useradd mike -s /bin/csh -g adminusers

This command would create the user mike, with a shell of /bin/csh and add it to the adminusers groud.
The user would also have his home directoryu under /home/mike

Now say you want to have this user’s home directory on a different partion, for example /mnt/disk2/home

#pw useradd mike -d /mnt/disk2/home/mike -s /bin/csh/ -g adminusers

Now say that you want to add mike to a secondary group on the system say a group that has been created already called ‘ftpusers’
To do this you would want to do the following

#pw usermod mike -G ftpusers

Say you want to add mike to multiple groups at the same time.

#pw usermod mike -G ftpusers,wwwusers,sales

source here

Hey this was really easy. Really, it is just a matter of aliasing your ls commands. However, it is only really easy if you know how to do it. When you forget, it is annoying. So here is another post to store the info I once knew but forgot and had to learn again.

Using sh, the default shell

  1. Edit your .shrc file in your home folder:
    # ee /usr/home/username/.shrc
  2. Add/Change the alias commands as follows:
    alias ls=’ls -G’
    alias ll=’ls -laFoG’
    alias l=’ls -lG’

    The first one I added, the second two I only added the -G parameter to the already existing aliases for ls.

  3. Save and close the file.
  4. Logout and login and your shell should have colors when you use ls.

Using bash

  1. Edit your .shrc file in your home folder:
    # ee /usr/home/username/.shrc
  2. Add/Change the alias commands as follows:
    alias ls=’ls -G’
    alias ll=’ls -laFoG’
    alias l=’ls -lG’

    The first one I added, the second two I only added the -G parameter to the already existing aliases for ls.

  3. Save and close the file.
  4. Copy the .profile file to .bash_profile.
    # cp /usr/home/username/.profile /usr/home/username/.bash_profile
  5. Edit the .bash_profile and add the following:
    # Source the .shrc
    source .shrc
  6. Logout and login and your bash shell should have colors when you use ls.

source here