Re: Achieving what's done by Microsoft's "Internet Connection Sharing"
- From: Jurgen Haan <jurgen@xxxxxxxx>
- Date: Fri, 28 Mar 2008 12:27:42 +0100
Tomás Ó hÉilidhe wrote:
* 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!
Linux is practically built for the task of being a router. :)
Ofc there could be handy GUI thingies in gnome or kde from which you can
set it up quite easily, but I'm not familiar with those so I'll let
other people elaborate on that subject.
From the console, all you need is two set up ethernet devices, ipforwarding, a default gateway and iptables.
eth0: 192.168.1.1
wlan0: 10.10.10.1
Routing without nat. Well, that subject only uses the route command.
You just need to tell those networks where they can locate eachother.
(Important to keep in mind, for every route one way, a route back is
needed. It's useless for packets to know where to go, if the packets
that need to go back don't know which way to go.)
$ route add 192.168.1.0/24 gw 192.168.1.1
$ route add 10.10.10/24 gw 10.10.10.1
This tells the box that in order to reach the networks 192.168.1.0 and
10.10.10.0 from localhost, it needs to access those through the
respective gateways 192.168.1.1 and 10.10.10.1.
Ofcourse this will only work if the machines in those networks use that
box as gateway for eiter the destination network, or the default gate.
Make sure ip forwarding is set.
$ sysctl net.ipv4.ip_forward=1
Source routing is quite simple too:
$ iptables -t nat -A POSTROUTING -s 192.168.1.0/24 -j SNAT -o wlan0
--to-source 10.10.10.1
I did not test these commands, so there might be a typo somewhere. But
this should be the general idea (if I get your question right).
-R-
.
- Follow-Ups:
- Re: Achieving what's done by Microsoft's "Internet Connection Sharing"
- From: Tomás Ó hÉilidhe
- Re: Achieving what's done by Microsoft's "Internet Connection Sharing"
- References:
- Achieving what's done by Microsoft's "Internet Connection Sharing"
- From: Tomás Ó hÉilidhe
- Achieving what's done by Microsoft's "Internet Connection Sharing"
- Prev by Date: Re: VNC viewer is connected but blank screen
- Next by Date: Re: Need help in 'at' command
- Previous by thread: Re: Achieving what's done by Microsoft's "Internet Connection Sharing"
- Next by thread: Re: Achieving what's done by Microsoft's "Internet Connection Sharing"
- Index(es):
Relevant Pages
|