NAT Gateway and DHCP Server configuration on Linux

IPv4 NAT entry and DHCP Server

Step :1
  1. Install UNIX server
  2. configure ipaddress manually
  3. install openssh server---for Remote login
Note:don't insert secondary LAN card UNIX installation time


  1. shutdown the system
  2. insert secondary LAN card
  3. configure ipaddress for secondary lancard
  4. //etc/network/interfaces
Step:i /etc/network/interfaces
vi /etc/network/interfaces

              auto lo
              iface lo inet loopback
                        auto eth0
         iface eth0 inet static
        broadcast ten.20.30.255
       dns-nameservers ten.20.30.15

   auto eth1
   iface eth1 inet static

step:ii /etc/sysctl.conf
vi /etc/sysctl.conf
And uncomment the road
# net.ipv4.ip_forward=1
so that it currently seems as

sysctl -w internet.ipv4.ip_forward=1

Step:iv /etc/rc.local
vi /etc/rc.local
Make sure the subsequent 2 lines seem before the exit zero line within the file.
/sbin/iptables -P FORWARD settle for
/sbin/iptables --table nat -A POSTROUTING -o eth0 -j MASQUERADE

 iptables -P FORWARD settle for
 iptables –-table nat -A POSTROUTING -o eth0 -j MASQUERADE

Step:vi Restart Networkin Services
 /etc/init.d/networking stop
/etc/init.d/networking begin

Step:vii chckout eth0 and eth1 area unit up or not
 ifconfig eth0 up
 ifconfig eth1 up

Step :3 Install DHCP server

Step:i Install DHCP server
yum install dhcp-server

Step:ii /etc/dhcp/dhcpd.conf
 vi /etc/dhcp/dhcpd.conf
The file is incredibly well commented and you'll be able to learn plenty reading it. simply check that it's a minimum of the subsequent configuration.
ddns-update-style none;

# possibility definitions common to any or all supported networks...
option domain-name "";
option domain-name-servers ten.20.30.15,;

default-lease-time 3600;
max-lease-time 7200;

# If this DHCP server is that the official DHCP server for the native
# network, the authoritative directive ought to be uncommented.

# Use this to send dhcp log messages to a special log file (you additionally
# have to be compelled to hack syslog.conf to finish the redirection).
log-facility local7;

# this can be a really basic subnet declaration.
subnet netmask 

Step :iii /etc/default/isc-dhcp-server
vi /etc/default/isc-dhcp-server
The line can seem like this before you alter it
And when you alter it, it'll seem like this:

Step:4 stop and begin the DHCP server
  1. service isc-dhcp-server stop
  2. service isc-dhcp-server begin