View Single Post

  #4 (permalink)  
Old 03-28-2008
Tomás Ó hÉilidhe
 
Posts: n/a
Default Re: Achieving what's done by Microsoft's "Internet ConnectionSharing"

Jurgen Haan

> From the console, all you need is two set up ethernet devices, ip
> forwarding, a default gateway and iptables.
>
> eth0: 192.168.1.1
> wlan0: 10.10.10.1



ifconfig eth0 192.168.1.1 netmask 255.255.255.0
ifconfig wlan0 10.10.10.1 netmask 255.255.255.0

OK done. . .

> 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



I thought routing tables were strictly to do with *sending* packets
rather than receiving them. When eth0 receives a packet with an IP
address other than its own, how will it know that it has to route it
thru wlan0?


> 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).



Thanks for that
Reply With Quote