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



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
.



Relevant Pages

  • guys, help a newbie!
    ... ifconfig wlan0 192.168.0.2 netmask 255.255.255.0 ... route add -net default gw 192.168.0.1 ... This IP configuration will work with most default configurations. ...
    (Fedora)
  • Re: What is a default route??
    ... lines run to two different ISPs. ... By "bonding" the NICs the OP could have automatic failover (another ... two route paths. ... route related packets out one interface and other related packets out ...
    (comp.os.linux.networking)
  • Re: When does Linux drop UDP packets?
    ... I have the following setting in which a client that resides on the same ... arrives on any of its interfaces sent by that server. ... If the client removes its default route and doesn't have any route ... the packets get always discarded ...
    (Linux-Kernel)
  • Re: Understanding Local Networking - help please?
    ... incoming packets discarded ... 100 ICMP messages received ... 546 active connections openings ...
    (Fedora)
  • Re: Load Balancing using 2 NICS (same network) with (iproute2) multipath route
    ... I do think your setup will route packets out alternate interfaces, ... On Ciscos you can configure load balancing by alternating by ...
    (comp.os.linux.networking)