Saturday, September 27, 2008

Ubuntu Linux Router Setup - How to

Here are the instructions for Ubuntu Linux Router configuration using the old PC. The purpose of this is to utilize the slow PC to become a Router in replacement for commercial Routers, like the Linksys WRTG54GS. The following specifications of an Old PC are as follows: AMD Athlon XP 1.7GHz Processor, 512MB DDR1 400 memory, 40GB IDE 7500rpm Seagate Hardisk, Redfox Mainboard with built-in Video, Audio and LAN card and extra Realtek LAN Card at the PCI slot.

Instructions:

  1. Bring-up the Console Terminal of the Ubuntu Linux and Running ifconfig -a will show you what network interfaces are available.

  2. Internal Network Information: Router: Address: 192.168.1.1, Network: 192.168.1.0, Netmask: 255.255.255.0, Broadcast: 192.168.1.255 and Clients: Addresses: 192.168.1.2 - 192.168.1.254, Netmask: 255.255.255.0, Broadcast: 192.168.1.255, Gateway: 192.168.1.1

  3. Setting up network interfaces: Device Naming: eth0 = external and eth1 = internal.

  4. Take a backup of your current network configuration: sudo cp /etc/network/interfaces /etc/network/interfaces.bak

  5. Configuring the External Network Interface:

    • For Dynamic IP Addresses (DHCP) Only:

      • Open /etc/network/interfaces with your favourite editor. Delete everything and paste in what is below. Follow the commented out instructions carefully.
        # Set up the local loopback interface
        auto lo
        iface lo inet loopback
        # Set up the external interface
        #
        # Don't forget to change eth0 to the proper name of the external
        # interface if applicable.
        #
        auto eth0
        iface eth0 inet dhcp

    • For Static IP Addresses Only

      • Open /etc/network/interfaces with your favourite editor. Delete everything and paste in what is below. Follow the commented out instructions carefully.
      # Set up the local loopback interface
      auto lo
      iface lo inet loopback
      # Set up the External interface
      #
      # For every xxx.xxx.xxx.xxx, enter the numeric address given to you
      # by your Internet provider. Don't forget to change eth0 to the proper
      # name of the external interface if applicable.
      #
      auto eth0
      iface eth0 inet static
      address xxx.xxx.xxx.xxx
      netmask xxx.xxx.xxx.xxx
      gateway xxx.xxx.xxx.xxx

      Now, set up your DNS servers as given to you by your service provider in /etc/resolv.conf, which should look something like this
      nameserver xxx.xxx.xxx.xxx
      nameserver xxx.xxx.xxx.xxx
  6. Testing Connectivity: Reload the network configuration and test for connectivity,
    sudo /etc/init.d/networking restart
    ping -c 3 -W 10 ubuntu.com
  7. Configuring the Internal Network Interfaces

    • Wired Only

      • Append the following to /etc/network/interfaces and follow the commented out instructions carefully.
        # Set up the internal wired network
        #
        # Don't forget to change eth1 to the proper name of the internal
        # wired network interface if applicable.
        #
        auto eth1
        iface eth1 inet static
        address 192.168.1.1
        network 192.168.1.0
        netmask 255.255.255.0
        broadcast 192.168.1.255

  8. Restart Networking Now, if the following command is executes successfully, your networking devices have been properly configured.
    sudo /etc/init.d/networking restart