How To: Make IP Forwarding Permanent in Linux

While IP forwarding in Linux is disabled by default, as most people don't need it, there may be various reasons why you might want it enabled. Enabling IP forwarding is easy. First let's check if it is already enabled, by running the sysctl command as follows:

$ sysctl net.ipv4.ip_forward

If it is disabled the result will be:

$ net.ipv4.ip_forward = 0

… otherwise instead of "0" the value will be "1".

It gets this setting from the /proc/sys/net/ipv4/ip_forward file so another way of checking it is to just see what value is in that file, like this:

$ cat /proc/sys/net/ipv4/ip_forward

It will just return "0" for disabled or "1" for enabled. If it is disabled you can enable IP forwarding by changing the value from 0 to 1 using either of the following two commands with superuser privileges (sudo or login as root):

# sudo sysctl -w net.ipv4.ip_forward=1
# echo 1 > /proc/sys/net/ipv4/ip_forward

The latter may require you to be logged in as root. This would enable IP forwarding immediately, but after a reboot it will revert back to default. To permanently enable IP forwarding you would need to edit the /etc/sysctl.conf configuration file (with superuser privileges or as root). Specifically look for the lines that say:

# Uncomment the next line to enable packet forwarding for IPv4
# net.ipv4.ip_forward=1

To uncomment it just remove the hash sign # in front of net.ipv4.ip_forward=1, as the comment above it instructs. If the value there says "0" just change it to "1". Once you save the file IP forwarding will remain enabled permanently, or until you disable it again.

Installing VLC in Ubuntu

An extremely popular and extremely powerful VLC Media Player by VideoLAN is known for its ability to play just about any media file format you can throw at it.

Great news is that VLC is readily available from Ubuntu default repositories, and you can install it by opening the Ubuntu Software Center, searching for "VLC", and clicking install.

Or you can just open the terminal and run this apt-get command:

$ sudo apt-get install vlc

If this is just too easy or (more likely) you wish to have the latest and greatest version of VLC you can get one from a third party PPA repository. Note though that this is not officially supported by VideoLAN nor Ubuntu, and you just may run into an occasional bug, even though most of the times everything's fine.

A third party repository is maintained by a user djcj at

You can add this repository by running:

$ sudo add-apt-repository ppa:djcj/vlc-stable

Then update the package database to include the new repository:

$ sudo apt-get update

Now simply install vlc as usual:

$ sudo apt-get install vlc

Also note that if you're gonna be doing any transcoding with VLC you should also install libavcodec-extra, and if you wish to use the VLC browser extension you'll also need browser-plugin-vlc. To make sure you got them all just run:

$ sudo apt-get install vlc libavcodec-extra browser-plugin-vlc

And you're done. For all information about VLC visit its web site at


Ubuntu: How To Enable SSH

Secure Shell (SSH) allows secure communication between networked computers for such purposes as logging in to a remote computer, running some commands remotely, and transferring files (with the scp command).

By default SSH is not enabled in Ubuntu. There is an ssh command installed, but it is only a client, and only allows you to login into another computer, not to allow others to login into yours.

To enable that you first need to install the OpenSSH Server. To do that just use apt-get:

sudo apt-get install openssh-server

If you prefer you can also search for openssh server in the Ubuntu Software Center and install it that way.

Once it is installed you need to enable it in the OpenSSH Server configuration. To do this open and edit the /etc/ssh/ssh_config file with superuser privileges:

sudo nano /etc/ssh/ssh_config

The nano program is a terminal based text editor, but if you prefer a graphical editor you can open it in gedit:

$ sudo gedit /etc/ssh/ssh_config

In that configuration file look for the Port 22 line and uncomment it by removing the preceding hash sign #. That's all you need to edit to get the SSH server working, but if you wish you can review, enable, and edit other configuration options.

Once you're done save the file and restart SSH (which was started automatically when openssh-server was installed) for changes to take effect:

sudo service ssh restart

… or using the old method:

$ sudo /etc/init.d/ssh restart

Your Ubuntu machine will now be able to accept SSH logins and communications through its IP address or host domain.

Ubuntu: how to clean APT cache

Ubuntu uses APT (Advanced Package Tool) for installing, removing and managing software on the system, and in doing so it keeps a cache of previously downloaded and installed packages even after they've been uninstalled.

To save disk space the apt cache can be cleaned. This can be done in one of two ways. First will do it partially:
$ sudo apt-get autoclean
This command will remove only the outdated packages, like those superseded by a recent update, making them completely unnecessary.

This may free up some disk space, but if you want to clean out the cache in its entirety you would run:
$ sudo apt-get clean
This command will remove all of the cached packages, saving the most space. This just means that if you were to ever need a package that was cached it will simply have to be downloaded again. Depending on your connection speed and data plan this may or may not be of concern. Other than that, it is safe to do.

Perhaps noteworthy is that the apt cache resides in /var/cache/apt/archives/. You can see them if you run the ls command on that path or view it in a file manager. Manually removing packages from this directory should be safe, but with the simpler and faster methods above there's no need.