Achieving what's done by Microsoft's "Internet Connection Sharing"



Before I begin, I'm not looking to turn a PC into a router (as can be
done with specialised Linux distros). I have a normal PC for everyday
use and I want to have the added ability of routing a connection thru
my NIC's.

I have two NIC's. One is wired, the other is wireless. Their names are
eth0 and wlan0 respectively.

I want to set up a virtual router between eth0 and wlan0. For
instance, let's say I have the following setup:

eth0: 192.168.1.1/24
wlan0: 10.10.10.1/24

If eth0 recieves a packet with an IP address different than its own,
then it should send it out unaltered on wlan0. Similarly, if wlan0
receives a packet with an IP address different than its own, it should
send it out unaltered on wlan0. This would be the most basic two-port
router.

I'd like to get that up and running first, and then I'd like to
experiment with a few more stuff:

With packets arriving at eth0, I'd like the router to perform "source
NAT" so that the packets forwarded out on wlan0 have a source IP
address of 10.10.10.1 rather than the actual originating IP address
(in exactly the same way your home broadband router works). In this
setup, there's no need for 10.10.10.1 to be set as a gateway on any
machine.

And lastly, I'd like to have a DHCP server on eth0. Altogether this
would enable me to do the following:

* Using my own computer, connect to an AP normally with my wlan0.
* Take a friend's laptop, connect it to mine via a cross-over cable.
* The DHCP server should give my friend's laptop an IP address, and it
should give it a default gateway of 192.168.1.1 (i.e. the IP address
of eth0)
* When my friend's laptop sends packets to the internet, my virtual
router should perform NAT. And when packets come back from the
internet, my virtual router should keep track of which host they've to
be forwarded to.

Under Microsoft Windows, this can all be done very simply by going
into the settings for wlan0 and clicking "Share this internet
connection". From there, you select a NIC thru which the connection
will be shared, e.g. eth0. And it all works perfectly.

I'm very interested in Linux, and I *do* want to learn about iptables
and dhcpd and so forth, but right now I'm just looking for a quick fix
so that I can get a little network up and running here at home.
Basically I'm looking for the most simplistic config files that will
achieve what I'm trying to do. Does anyone have config files that will
simulate Microsoft's connection sharing? Or perhaps could you guide me
thru what I've to do? So far, it looks like I've to do the following:

* Use iptables to make eth0 act as a gateway thru to wlan0.
* Use iptables to enable "source NAT" for packets coming from eth0
into wlan0.
* Use dhcpd to set up a DHCP server on eth0.

Any advice appreciated!
.



Relevant Pages

  • Re: Cant Navigate My LAN Or Ping
    ... reset of the router using the button on the back side but not before I ... I'm not sure if there are any other wireless networks in your ... Did you at least use different IP addresses for eth0 and wlan0? ...
    (Ubuntu)
  • Re: Cannot connect to RWW from home PC
    ... eth0 172.26.0.1/16 Extra none ... That would be the address you need a DNS record for. ... One question - if I reset the Thomson Router will that clear all the ... Heres' the info for our server: ...
    (microsoft.public.windows.server.sbs)
  • Re: Cannot connect to RWW from home PC
    ... No 10.0.0.138 is the address used to log onto Thomson's router to make the ... On the DNS question I can add an MX record in the DNS area of GoDaddy's ... eth0 172.26.0.1/16 Extra none ... Heres' the info for our server: ...
    (microsoft.public.windows.server.sbs)
  • Wireless newbie with WaveLan on Dell
    ... iface eth0 inet dhcp ... iface wlan0 inet dhcp ... Configuring network interfaces...Internet Software Consortium DHCP ... sit0: ...
    (Debian-User)
  • Re: Cannot connect to RWW from home PC
    ... If your router is listening to 10.0.0.138, ... eth0 172.26.0.1/16 Extra none ... That would be the address you need a DNS record for. ... Heres' the info for our server: ...
    (microsoft.public.windows.server.sbs)