2 computers one usrobotics modem
Rashkae
ubuntu at tigershaunt.com
Thu Oct 29 03:40:16 UTC 2009
Paul Tader wrote:
> Dotan Cohen wrote:
>>> That's a new world to me Dolan, I just have two separate computers and
>>> no existing router, I guess I have to learn a little bit more about this
>>> and go out and hunt for a router. Â Thanks, Â John
>>>
>> If one of the machines has two NICs then you could configure one to
>> pass through to the other. Though, to be honest, you are best off with
>> a router. That is exactly what they were invented for.
>>
>
> Wonder if this would work...
>
> * System1 dials up and has a NIC connected to the LAN (or a crossover
> cable to System2)
>
> * run: " echo 1 > /proc/sys/net/ipv4/ip_forward "
> on the System1 to forward all traffic between the NIC and modem.
>
> * Set the default gateway on System2 to the NIC's ip address on System1.
>
> * surf away!
>
>
> I'm probably missing something. Hmm, gotta try this myself... now,
> where is that modem...
>
>
> -ptader
>
>
You're missing the nat.
The PC's inside a network will have a non-routable IP address (for
example, 192.168.0.x). when pc number 2 sends a request over the
internet, the receiving server will not be able to send any replies to
that address.
You work around this with an iptables entry that looks something like this:
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
That way, any packets that are being sent out of eth0 will have their
originating IP address re-written to be the same as eth0, and when
return packets are sent on that connection, they are in turn re-written
so they get sent back to the real originating computer.
More information about the ubuntu-users
mailing list