Thursday, January 28, 2016

Configure Linux as a Router



Configure Linux as a Router on RHEL5




In this tutorial you will show that how to configure Linux Machine as a Router. Routers are the devices those are used to connect two or more different networks. Routers are very costly devices. Linux could be a cost effective solution of routing in a small company.

In this practical I am using three computers. One System will be use for routing and two others will remain in two different networks. First we will configure the system which is going to play the role of router.

Pre-requisites for both Router and Other Machines:
  • A Linux Machine named Linuxrouter with two different LAN card
  • Two different IP address of Router Machine on two LAN Card one is 210.207.201.100 another is 192.168.161.10
  • Enable IP forwarding.
  • Configure both of the NIC card on Router machine.
  • Two Client machine, both could be Linux or one could be Linux and another could be Windows machine
  • Client Machine one IP address is 210.207.201.1 and another machine IP address is 192.168.161.1

Necessary configuration for Router Machine

IP Configuration: Change the IP address of both LAN card

[root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0

#Broadcom Corporation Net link BCM57875 Gigabyte Ethernet PCI Express
DEVICE=eth0
BOOTPROTO=static
HWADDR=00:0C:29: EB: B2: CA
ONBOOT=yes
TYPE=Ethernet
PEERDNS=no
USERCTL=no
IPV6INIT=no
IPADDR=210.207.201.100
NETMASK=255.255.255.0
NETWORK=210.207.201.0
BROADCAST=210.207.201.255

[root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth1

#Broadcom Corporation Net link BCM57875 Gigabyte Ethernet PCI Express
DEVICE=eth0
BOOTPROTO=static
HWADDR=00:0C:29: EB: B2: CA
ONBOOT=yes
TYPE=Ethernet

PEERDNS=no

USERCTL=no

IPV6INIT=no

IPADDR=192.168.161.100

NETMASK=255.255.255.0

NETWORK=210.207.201.0

BROADCAST=210.207.201.255

Changing Host name: Change the host name of your Router machine as Linuxrouter.

[root@localhost ~]# vi /etc/sysconfig/network

NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=Linuxrouter

Restart or Reload the NIC card: After changing the NIC card and hosting name you have to restart the network of router machine by following this command.


[root@localhost ~]# service iptables stop

[root@localhost ~]# chkconfig iptables off

[root@localhost ~]# service network restart

Enable IP Forwarding: Enable the IP forwarding by editng /etc/sysctl.conf file. So open the File using vi editor.

[root@Linuxrouter ~]# vi /etc/sysctl.conf

                                         Locate the               net.ipv4. ip_forward =0

Replace the Value ‘0’ to 1. This will enable the IP forwarding with permanently. But this requires a system reboot.

Restart Machine: After editing the sysctl.conf file restart your machine by following command.


[root@Linuxrouter ~]# init 6



MAXIT INTERNET

BLOGGER

CD DVD RW

DELL

DOWNLOAD

FTP Server Linux

HACK

HARD DRIVE

HOW TO WORKIN

HARDWAER

INTERNET

INTERNET CAFE

LAPTOP

LENOVO

LINUX

Additional configuration for Samba Server (Part 2)  

BSNL/Airtel/Idea using Huawei E156G 3g Wireless USB Linux 5   

Basic File Extensions    CHANGING AN ACCOUNT EXPIRATION DATE   

Configure Linux as a Router   

Configure SAMBA Server (Part-1)   

Configure VNC server   

Configure Yum Server (Part-1)   

Configure yum server for Client machine (Part 3)   

Configuring Samba as a Standalone Server (Part 3)  

Connecting ftp Server with Anonymous User Part 5  

Create ftp account with Shared directory Part 3  

DHCP Server Configuration Part 2  

DHCP Server Configuration Part-1  

DHCP Server Configuration Part-3  

Enabling FTP Services in Yum Server (Part 5)  

FTP Server Configuration Part 1  

FTP Server How to Change In Primary DNS Server Part 2  

HTTP Client side configuration (Part 4)  

How to Vsftpd conf files Parameter Part 6   

LINUX FILE SYSTEM STRUCTURE  

Linux User Administrtion  

Linux as a Router configuration for Client Machine   

Linux client machine FileZilla FTP Client Part 4  

Local Yum Server (Part 2)  

Modifying Existing User Information  

Primary DNS Server Configuration Part-1  

Primary DNS Server Configuration Part-2    

Primary DNS Server Configuration Part-3  

Remove Linux From Your Pc Safely and restoring your MBR  

Sharing & Accessing Samba Share (Part 4)   

Speeding up your internet connection under Linux and Windows   

THE ROOT FILE SYSTEM   

VNC Server Configuration

LINUX LAB

Linux as a Router

MOTHERBOARD

Mobile

NETWORKING

REDHAT 5

REGISTRY EDTOR

RESET BIOS PASSWORD

SAMBA Server Linux

SERVER

SERVER CONFIG

SOFTWAER

VNC server Linux

Window 10

Window XP