My Adventures in Linux - Part 1 … Networking my two computers for simultaneous Internet access.

I have been running Linux since Nov 98 (first Slackware 3.6, more recently Slackware 7.1), and having a wife and daughter, a Win98 computer and a Linux computer (kernel 2.4.0-test10), and only ONE ISP account, I felt it was time to network the boxes for simultaneous Internet access. Linux has a setup generically called IP_MASQUERADE, and there is a ton of literature available on the net.

My first step was to buy two cheapo Ethernet cards, Smartlink Ethernet cards (NE 2000 NIC clones, which my computers identified as Realtek RTL 8029(AS) PCI Ethernet NICS) for CDN$ 25.00 each and a twisted pair cable.. CDN$ 10.00.

The installation procedures are a s follows:

modprobe 8390

insmod ne2k-pci.

After I rebooted and ran these scripts, lsmod indicated that the ne2k-pci was loaded.

ifconfig eth0 192.168.0.1 netmask 255.255.255.0 up # This configured my card's address and subnet mask.

route add -net 192.168.0.0 netmask 255.255.255.0 eth0 # This line configured the routing of the NIC on what was basically the beginning of my network.

insmod ip_conntrack

insmod ip_conntrack_ftp

insmod iptables

… Etc for all the other modules listed in this directory

insmod ipt_MASQUERADE # I left this one as the last line on the script.

I tested my setup by pinging both of these addresses on both boxes, (ping 192.168.0.1 or 0.2) to make sure that my connection was working, which it was. The really unusual part of this exercise was my linux box not recognizing the new modules compiled in the kernel,(well 2.4.0-test10 is a beta kernel, *grin*) but the solution was pretty simple, creating the scripts as described above, which I load at boot ( placed the names of the scripts in /etc/rc.d/rc.local) . In working with Linux, creativity and patience are essential J . Well I then needed to load the iptables binary, but being a new technology, its source did not come with the 2.4.0-test10 source, but a kind person in #linux on the Dalnet IRC network guided me to a source of this binary: http://netfilter.samba.org (used to be netfilter.kernelnotes.org). I downloaded and installed iptables-1.1.3.tar.gz, copying the iptables binary to /sbin. The script I wrote to run the iptables binary and create the connection between by linux box (used as the gateway) and my Win98 box, I called load_iptables and its contents are as follows:

iptables -t nat -P POSTROUTING DROP

iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE

I had a some problems with iptables communication issues (dcc chat with my eggdrop bot, etc) but I read an article on Feb 13/2001 on www.linux.com re iptables setup and I changed my load_iptables script to the following:

iptables -P FORWARD ACCEPT

iptables -A FORWARD -i ppp0 -m state --state NEW,INVALID -j REJECT

iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE

echo 1 > /proc/sys/net/ipv4/ip_forward

As explained above, I load all these scripts at bootup on my linux box, then I connect to the net on the linux box, and continue with my usual net activity there, surfing, checking email, chatting with friends on IRC, while my wife or daughter surf's on the same connection on my Win98 boxJ . For this project, I did extensive research, reading the ethernet and ip_masquerading howtos at www.linuxdocs.org and http://jgo.local.net/LinuxGuide.

 

 

Hosted by www.Geocities.ws

1