[Linux-disciples] Net access for one machine from another machine

Adam Rosi-Kessel adam at rosi-kessel.org
Sun Jun 12 09:57:10 EDT 2005


On Sat, Jun 11, 2005 at 09:38:59PM -0400, Stephen R Laniel wrote:
> Suppose I have a Windows machine that only has a wired
> Ethernet connection, and I'd like to give it access to the
> Net through my nearby laptop -- which has a wired and a
> wireless connection. Suppose I could connect the laptop and
> the Windows machine via a crossover cable or a hub. I would
> like the laptop to act as a router onto the Internet, as
> well as getting Net access itself. How would I do that?

eth0 = your laptop ethernet
wifi0 = your laptop wireless

iface eth0 inet static
   address 192.168.5.2
   netmask 255.255.255.0
   network 192.168.5.1
   broadcast 192.168.5.255
iface wifi0 inet dhcp

modprobe ipt_MASQUERADE
iptables -F; iptables -t nat -F; iptables -t mangle -F
iptables -t nat -A POSTROUTING -o wifi0 -j SNAT --to <your wifi DHCP address>
echo 1 > /proc/sys/net/ipv4/ip_forward

I believe this is right; sometimes I get the source and destination
confused and have to switch them around.  But that's the basic idea.

Then the Windows box you set the IP address to 192.168.5.3, set the
gateway to 192.168.5.2, and set the DNS manually.

If you want the Windows box to get its IP address information
automatically, you'll need to install a DHCP server on your laptop.

If you want the Windows box to get DNS from your laptop, you'll need to
install a DNS server on your laptop.

Repeat, add water, rinse, etc..
-- 
Adam Rosi-Kessel
http://adam.rosi-kessel.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.bostoncoop.net/pipermail/linux-disciples/attachments/20050612/ae3dc747/attachment.pgp


More information about the Linux-disciples mailing list