From: Vincent Cunniffe (vincent at domain cunniffe.net)
Date: Tue 18 Jul 2000 - 00:27:47 IST
Eugene O'Leary wrote:
>
> Can anybody give me info on how I can connect two networked (peer to peer)
> Linux boxes to the Internet using one modem. What I want to do is make a
> connection similar to Windows Internet Connection Sharing.
Your kernel, if it's at all recent, should come with settings for IP
forwarding and masquerading built in. If it doesn't, then switch to
root,
cd /usr/src/linux, 'make xconfig' or 'makemenuconfig' depending on
whether you've got X installed and running, and enable the following :
Network firewalls
TCP/IP Networking
Advanced router
Firewalling
Transparent proxy support
Masquerading
ICMP masquerading
Masquerading special modules support
and add the following lines to the bottom of /etc/rc.d/rc.local :
echo "1" > /proc/sys/net/ipv4/ip_forward
echo "1" > /proc/sys/net/ipv4/ip_dynaddr
/sbin/ipfwadm -F -p deny
/sbin/ipfwadm -F -a m -S 192.168.1.0/24 -D 0.0.0.0/0
replacing 192.168.1.0 with your own local IP addresses if necessary.
Once you bring up your ppp connection on that machine, it should now
masquerade external connections for any machine on your lan, as long
as those machines have the IP address of the main machine set as
their default gateways. If you're using Redhat, use 'netcfg' to set
such things as gateways, or edit the files directly if you're happy
to do so.
Regards,
Vin
P.S. If you change your kernel, then obviously you'll need to reboot.
For a first try, however, just run those four lines at the bottom
manually and try connecting from the other machine, which should
work. Then add them into rc.local and they'll ayto-run on every
subsequent boot.
This archive was generated by hypermail 2.1.6 : Thu 06 Feb 2003 - 13:06:53 GMT