Yes you need to do NATing
Then if you are using static IPs . remember to add DNS ips on the clients.


On Fri, Mar 28, 2014 at 12:50 PM, Thuo Wilson <lixton@gmail.com> wrote:

On 28 March 2014 12:18, Cynthia Wahome <cwahome@jambo.co.ke> wrote:
Hello All
I am not an expert in Networking and hence i am posting this here for
assistance.

I have a CentOS Box which has 2 NICs
My setup is as follows on the CentOS server.

My WAN IP is 192.168.6.142/24
My WAN Gateway is 192.168.6.1/24
My LAN IP is 10.10.20.1/24

My server is able to browse the internet well.
i have connected my laptop network port to the LAN port of the server.
Laptop IP is 10.10.20.12/24 and i have put gateway to be 10.10.20.1

I am able to reach the gateway ie 10.10.20.1 from the laptop,however i
cannot reach anything on the internet (e.g i am unable to ping 4.2.2.2 or
8.8.8.8) Basically i cannot go outside to the internet.

On the server,when i do a netstat -rn,i get the following output

[root@linuxlearn ~]# netstat -rn
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt
Iface
192.168.6.0     0.0.0.0         255.255.255.0   U         0 0          0 eth1
10.10.20.0     0.0.0.0         255.255.255.0   U         0 0          0 eth2
0.0.0.0         192.168.6.1     0.0.0.0         UG        0 0          0 eth1
[root@linuxlearn ~]#

I have not put a gateway on the LAN

As you can see,the default route is OK.
i would like to be able to access the Internet from my laptop.

My questions are?

1)- Is there any config i have not done well or misconfigured?
    (My thinking is that my laptop should be able to go to the internet
because the routing appears OK,however i stand to be corrected.)
2)- Do i need to do any NATing somewhere?



Kindly give me your thoughts on this issue.

Regards
Cynthia

I will assume some few things here:
That your WAN/Outbound is ether0 and inbound is ether1
Behold:

Exec this on command line as root:
Paste one of the below:

iptables -t nat -A POSTROUTING -s 10.10.20/255.255.255.0 -o eth0 -j MASQUERADE 
OR the same principle here but you need to change SNAT ip everytime u change provider or WAN ip
iptables -t nat -A POSTROUTING -s 10.10.20/255.255.255.0 -j SNAT --to-source 192.168.6.142

service iptables save
service iptables restart

Finally enable packet forwarding in an easy way:

echo 1 > /proc/sys/net/ipv4/ip_forward 
sysctl -p

Start browsing.



Kind Regards,
Wilson./

_______________________________________________
skunkworks mailing list
skunkworks@lists.my.co.ke
------------
List info, subscribe/unsubscribe
http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks
------------

Skunkworks Rules
http://my.co.ke/phpbb/viewtopic.php?f=24&t=94
------------
Other services @ http://my.co.ke



--
Kind regards,

Brian 

Linux registered user: #565878