Changing the IP Address of a Slax+8 Linux Machine


Slax+8 is a self-configuring portable Linux distribution that boots from a CD or USB thumb drive. During the boot process Slax+8 detects and configures the network connection to your LAN. This means that Slax+8 receives its IP address from the LAN router. But what if you want to fix the IP address instead of having it assigned at boot-up? This is useful if your router is configured for virtual servers and you want the Slax+8 machine (or any Linux PC) to be at the IP address reserved for the HTTP, Telnet and FTP ports.

This Technical Note describes the Linux commands needed to change the IP address of your Slax+8 PC. These commands should work for other Linux distributions as well.

Changing the IP Address

As an example, suppose your LAN router is configured for a virtual HTTP server at IP address You want your Slax+8 PC to reside at this address so you can check the Readings page on the Channel 8 server over the Internet. You don't know what IP address the router will assign the PC on boot-up, so you need to be sure the Slax+8 PC is at To change the IP address of the ethernet port on your PC in Linux, use the following command:

ifconfig eth0

Setting the Default Gateway

The gateway address is the IP address used by the PC to communicate over the network. The gateway address must be set to the router IP address. For this example we will assume the router is set to IP The command to add the default gateway to the Slax+8 PC is as follows:

route add default gw

Checking the Settings

To verify the new IP address of the PC, use the Linux ifconfig command, as follows:


A listing of all the devices with their IP addresses will follow. The eth0 port is the ethernet connection.

To check the gateway assignement, use the route command, as follows:

route -n

You will see something like that shown below. Look for the router IP address as the gateway.

To verify that the Slax+8 PC is actually on the network, ping the router, as follows:


You should see the responses back, giving the transit time in milliseconds:

To stop the ping process, press Ctl+C.

To verify that the Slax+8 PC can reach the internet, ping Yahoo, as follows:


If you are connected to the Internet you should see a response. If there is an error message "network unreachable" then there is a problem with the IP address, gateway address or the configuration of the virtual servers on the router.

Fixing the IP Address Automatically

If you have a Slax+8 USB thumb drive version, there is a way to fix the PC to the same IP address every time it is booted. Proceed as follows:

Find the rc.local file using the Linux cd command:

cd /mnt/sda1_removable/rootcopy/etc/rc.d/

Edit the rc.local file using the Joe editor:

joe rc.local

Add the following lines at the top of the file, after the comments:

# Set IP Address
ifconfig eth0
route add default gw

(Obviously you would use the IP you desire for the PC and the router IP in the above commands.)

Save the file using Ctl+K X. Reboot the PC and verify that the IP address is correct and that you have connections to the Internet and router.