How do I share my internet connectivity to another NIC?

2

I would like to share my internet connectivity on eth0 with another computer on eth1.

+-----------+             +-----------+             +-----------+ 
|           |             |           |             |           | 
|ADSL Router|-------------| Computer  |-------------|NFS Client | 
|           |         eth0|           |eth1         |           | 
|           |         dhcp|           |static       |           | 
+-----------+             +-----------+             +-----------+

How can i maintain this network topology and allow internet connectivity with dns across my main computer?

JavaRocky

Posted 2011-04-25T13:16:34.420

Reputation: 223

You can use Internet Connection Sharing, have a look at an answer I posted before: http://superuser.com/questions/274622/how-to-share-internet-in-windows-7-using-two-netcards/274624#274624

– Sandeep Bansal – 2011-04-25T13:24:05.193

2@Sandeep Bansal - ICS is for a windows machine and eth0, NFS and linux tag are indicating OP is running linux. – laurent – 2011-04-25T17:46:34.383

Sorry misread the question – Sandeep Bansal – 2011-04-25T18:06:07.177

Answers

1

You have to configure your Computer as NAT.
That's not trivial to explain here, please take a look to these links.

binfalse

Posted 2011-04-25T13:16:34.420

Reputation: 1 426

1

You can run a NAT/Firewall software like Firestarter on your computer.

Another solution without running anything is to do the NAT manually with iptables on NAT Table postrouting using Masquerade on your output external interface (eth0). See rule below:

-A POSTROUTING -o eth0 -j MASQUERADE 

and you will need to enable ip forwarding with:

/bin/echo 1 > /proc/sys/net/ipv4/ip_forward

and you will need to config a DHCP server (which is not hard in your case) but firestarter would do everything with a wizard.

laurent

Posted 2011-04-25T13:16:34.420

Reputation: 4 166

0

I posted just such an answer at ServerFault.

Kevin M

Posted 2011-04-25T13:16:34.420

Reputation: 2 396

This is an ancient post, but please consider expanding your answer. It's better for answers to be self-contained rather than sending the reader off to check out an answer somewhere else. You can duplicate the answer here and leave the link for attribution, or include the essential points here and use the link for further reading. Thanks. – fixer1234 – 2016-01-09T09:37:46.440