Professional Documents
Culture Documents
your linux distro. You will also need IPTABLES installed on your system.
Please note the following IP config I will be using
Replace xx.xx.xx.xx with your WAN IP
Replace yy.yy.yy.yy with your LAN IP
(i.e. 192.168.0.0/16, 172.16.0.0/12)
If you have the NIC's Installed correcly the output of this command will be 2.
Now we must give eth0 [The Primary Ethernet Card] An external WAN IP. This will be provided to you
by your ISP.
To do this type the following command
[root@yourRouter ~]#
vi /etc/sysconfig/network-scripts/ifcfg-eth0
You must make the file look similar to the configuration I have shown below
DEVICE=eth0
BOOTPROTO=none
BROADCAST=xx.xx.xx.255
# Optional Entry
HWADDR=00:50:BA:88:72:D4
# Optional Entry
IPADDR=xx.xx.xx.xx
NETMASK=255.255.255.0
# Provided by the ISP
NETWORK=xx.xx.xx.0
# Optional
ONBOOT=yes
TYPE=Ethernet
USERCTL=no
IPV6INIT=no
PEERDNS=yes
GATEWAY=xx.xx.xx.1
# Provided by the ISP
Now we have configured the eth0 card we must configure eth1 to have an INTERNAL IP Address. To do
this type the following
[root@yourRouter ~]#
vi /etc/sysconfig/network-scripts/ifcfg-eth1
Similar to above make the configuration look like the one below
BOOTPROTO=none
PEERDNS=yes
HWADDR=00:50:8B:CF:9C:05
TYPE=Ethernet
IPV6INIT=no
DEVICE=eth1
NETMASK=255.255.0.0
BROADCAST=""
IPADDR=192.168.2.1
NETWORK=192.168.0.0
USERCTL=no
ONBOOT=yes
# Optional
Now we need to configure the host file to tell the Router that it will be providing Network Address
Translation [NAT]
[root@yourRouter ~]# vi /etc/hosts
nat localhost.localdomain
localhost
Now we configure the gateway by editing /etc/sysconfig/network to do this use the vi command
[root@yourRouter ~]# vi /etc/sysconfig/network
Make that file like the one below. these IP's may differ from yours.
nameserver 203.145.184.13
nameserver 202.56.250.5
Now we need to delete all the chains not in the default filter and the NAT
[root@yourRouter ~]# iptables --table nat --delete-chain
Now ping some places from your client and see if it works