Virtual NAT router setup
==================
install basic centos 6.4 server
----------------------------------
eth0 public
eth1 private (or eth0:0 private)

set eth1 static with ipaddress 192.168.2.1/255.255.255.0 no gateway
-------------------------------------
vi /etc/sysconfig/network-scripts/ifcfg-eth1
-------------------------------
DEVICE=eth1
BOOTPROTO=none
NETMASK=255.255.255.0
TYPE=Ethernet
HWADDR=02:34:37:24:c0:a5
IPADDR=192.168.2.1
----------------------------------
or set eth0:0 with static ipaddress. replace eth1 with eth0:0 if you have only one nic card.
----------------
vi /etc/sysconfig/network-scripts/ifcfg-eth0:0
DEVICE=eth0:0
TYPE=Ethernet
IPADDR=192.168.1.1
NETMASK=255.255.255.0
NETWORK=192.168.1.0
IPV6INIT=no
USERCTL=no
NAME=eth0:0
BOOTPROTO=none

----------------------
iptables -A FORWARD -i eth1 -j ACCEPT
iptables -A FORWARD -o eth1 -j ACCEPT
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
sysctl -w net.ipv4.ip_forward=1
sysctl -p /etc/sysctl.conf
vi /etc/sysctl.conf change to net.ipv4.ip_forward=1
iptable-save > /etc/sysconfig/iptables
echo 1 > /proc/sys/net/ipv4/ip_forward
---------------------------------------------------------------------

# vi /etc/sysconfig/iptables
#===================
*nat
:PREROUTING ACCEPT [65:4714]
:POSTROUTING ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A POSTROUTING -o eth0 -j MASQUERADE
> COMMIT

*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [25:3244]
-A INPUT -m state --state RELATED,ESTABLISSHED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tccp --dport 22 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-hostt-prohibited
-A FORWARD -i eth1 -j ACCEPT
-A FORWARD -i eth0 -j ACCEPT
-A FORWARD -j REJECT --reject-with icmp-hoost-prohibited
COMMIT
============================
set dhcp server
yum install dhcp

vi /etc/dhcp/dhcpd.conf
----------------------------
#
# DHCP Server Configuration file.
# see /usr/share/doc/dhcp*/dhcpd.conf.sample
# see 'man 5 dhcpd.conf'
#
#specify domain name
option domain-name "yourdomainname";
#specify DNS server ip and additional DNS server ip
option domain-name-servers 8.8.8.8, 8.8.4.4;
#specify default lease time
default-lease-time 600;
#specify Max lease time
max-lease-time 7200;
#specify log method
log-facility local7;
#Configuring subnet and iprange
subnet 192.168.2.0 netmask 255.255.255.0 {
range 192.168.2.50 192.168.2.254;
option broadcast-address 192.168.2.255;
#Default gateway ip
option routers 192.168.2.1;
}
#Fixed ip address based on MAC id
#host Printer01 {
#hardware ethernet 02:34:37:24:c0:a5;
#fixed-address 192.168.1.55;
#}
----------------------------------------------
vi /etc/sysconfig/dhcpd
# Command line options here
#if you have only one nic use eth0:0 and change the ip address in the subnet
#DHCPDARGS=eth0:0
DHCPDARGS=eth1
--------------------------------