Alternate ADSL Setup Guide by Corey (tourettes)
Created on March 28th, 2000.
Last updated on September 19, 2003.
Update:Over the past few years, linux distributions have become advanced enough that manual configuration for your internet connection has been pretty much wiped out. DHCP connections have become effortless thanks to the dhcpcd program that automatically reads your connection and configures your system to use it. An alternate adsl connection is pppoe which uses a username and password to connect to the internet, but I have little experience with this therefore it is beyong the scope of this guide, for more information on this, please review Joey's PPPoE (ADSL) Guide.
The purpose of this guide is to network a linux box and a windows box and have them share an internet connection through an ADSL connection on the Linux Box. This is NOT guarrenteed to work for everyone, this is a unique setup, and goes against a lot of other guides out there, but it worked for me, and it may work for you.
This guide uses information that was gathered from the following sources:
Table of Contents: 1. Setting Up ADSL on the Linux Box 1.1 - Basic Host Information 1.2 - Name Server Specification (DNS) 1.3 - Routing and Gateways 1.4 - Testing the Connection 2. Networking a Linuxbox with a Windowsbox 2.1 - Configuring the LinuxBox 2.11 - Basic Host Information 2.12 - Information about other computers on your network 2.2 - Configuring the Windows Box 2.21 - Installaiton of Drivers 2.22 - IP Address 2.23 - Gateways and DNS Servers 2.24 - Testing the Connection 3. Sharing Internet Access using IP Masquerading 3.1 - Setting Up IP Masquerading 3.2 - Initiating and Testing the Connection 4. Further Reading
ADSL - Janou has a great description on ADSL in his guide located
here.
1. Setting Up ADSL on the Linux box
What you need: You need to find out what your IP and what your Host Name is. Unfortunitly there are ISP's out there that don't give static IP's to DSL customers, which i can't understand why. I do not know exactly how I would go about setting that up, this assumes that you have a static ip.
For this guide i will assume the following:
My IP: 142.163.75.70
My Hostname: 70warp75.newtel.com
Distribution: I'm using Redhat 6.1 for this.
1.1 Basic Host Information
When I did this, luckily my pci ethernet card was detected, so there wasn't much I had to do with modules or anything.
As root user, type "linuxconf" to bring up the linux configuration. The gnome-linuxconf is an excellent program for this.
Go to Networking -> Client Tasks -> Basic Host Informaiton.
Under the Host Name tab, enter in your host name. I have "70warp75.newtel.com".
Then open up Adaptor 1 tab next to the Host Name tab. If you have any settings here left over from a local network you had set up, move them to the Adapter 2 section (listed as just "2" on the tab).
Under the adapter 1 tab enter the following:
Enabled: Check this
Config Mode: Manual (SirPlaya sugests DHCP, but i could not get this working)
Primary name + domain: 70warp75.newtel.com (this will be the same as your host name)
Alias (opt): linuxbox 70warp75 (this is optional, i have it set for the sake of it)
IP Address: 142.163.75.70 (this is your static ip address)
Netmask (opt): 255.255.255.0 (i believe this filled in automatically for me, but you can set it to this)
Net device: eth0
Kernel module: ne2k-pci (like i said earlier, mine was detected off the start, select from the drop down box what yours is)
I/O port: empty
IRQ: empty
Now accept the changes to that.
1.2 Name Server Specifications (DNS)
Go to Networking -> Client tasks -> Name server specifications (DNS) in linuxconf
DNS Usage: UNCHECK (this was my biggest problem in setting up adsl)
default domain: leave empty
nameserver1: this was automatically filled in for me when my modem detected my isp, if this is not filled in for you, please contact your ISP to find out your nameserver settings.
nameserver 2: same as above
search domain1: sympaticowarp.ca (this was also filled in automatically. Once again, if it is not for you, then contact your ISP and find out)
Everything else should be empty, so accept the changes to that.
1.3 Routing and Gateways
Now, go to Networking -> Client Tasks -> Routing and Gateways -> Defaults
Default gateway: 142.163.75.254 (I got this ip from a friend of mine, you may need to contact your ISP to find out what yours is)
Enable Routing: UNCHECKED (my friend told me this was the reason why he couldn't get connected through his box)
Accept the changes to that, and close down linuxconf while saving all changes.
1.4 Testing the Connection
Now the ultimate test, open up a terminal and try and ping an address, or even better open up your web browser and try to call up a page. If your page comes up, congrats, if not, please visit us in #LinuxHelp.net on Dalnet for further help.
If it didn't work, go into your console and type "/sbin/ifconfig" and check and see if there's a connection with your ISP, it should look like this:
eth0 Link encap:Ethernet HWaddr 00:00:1C:05:50:38
inet addr:142.163.75.70 Bcast:142.163.75.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:286123 errors:0 dropped:0 overruns:0 frame:0
TX packets:228179 errors:0 dropped:0 overruns:0 carrier:0
collisions:13 txqueuelen:100
Interrupt:10 Base address:0xe400
2. Networking a Linux Box with a Windows Box
2.1 Configuring the Linux Box
To get more information on this, check out _ToXic_MYsT_'s well done guide on www.linuxhelp.net . I will run through it here for a setup with adsl.
2.11. Basic Host Information
Once again, as root user, open up "linuxconf".
Goto Config -> Networking -> Client tasks -> Basic Host Information -> Adapter 2
Enabled: Check this
Config Mode: Manual Mode
Primary name + domain: linuxbox.sympaticowarp.ca (the domain doesn't really matter, i just used my isp's alternate domain name, but i think you should keep the "linuxbox" part to name your box)
Alias (opt): "linuxbox" what i got my linuxbox named as on the network
IP Address: 192.168.0.1 (ip address of my linuxbox on the network, this is a safe range to use if you're local network will also be on the internet to avoide conflicts)
Netmask: i have this left empty, but you can put in 255.255.255.0 if you like
Net Device: eth1 (keep this setting)
Kernel Module: The module needed for your NIC that connects your LOCAL network. Mine is 3c509
I/O port: Empty
IRQ: Empty
Accept the changes to this. As opposed to _ToXiC_MYsT_'s guide, we will not touch the DNS now, we have it set up with the ADSL with our ISP and that's good enough.
2.12 Information About Other Computers on your network.
Okay here's where it gets kind of confusing, I'll take as much time as I can for this part.
Go into Config -> Networking -> Misc -> Information about other hosts
In this section I have 4 entries. One is for my adsl connection to the internet, one is for my linuxbox on the local network, one is for my window's box on the local network and one is the loopback (127).
Here's a copy of what mine looks like: IP Number name & aliases 142.163.75.70 70warp75.newtel.com linuxbox 251warp75 192.168.0.1 linuxbox.sympaticowarp.ca linuxbox 192.168.0.2 winbox.sympaticowarp.ca winbox 127.0.0.1 localhost.localdomain localhost
If you don't have one of these, click on "ADD" and it will bring you to the /etc/hosts file addition.
Example if i was to add the window's box again:
Primary name + domain: winbox.sympaticowarp.ca
Alias (opt): winbox
IP Number: 192.168.0.2
Comment (opt): empty
Comparing this with the top list shows where everything comes from. I just named my window's box "winbox" and used the local network name "sympaticowarp.ca".
After entering in the information, click "Add" again, and you should see your entry in the list with the others, add all the information you need (I only have 4 there, but if you're trying to network more then just one other machine, you'll need to add the other machines here so they can use the connection).
Now you need to give the computers on your network access to the server. To do this we need to edit /etc/hosts.allow and /etc/hosts.deny
As root enter the following command: pico /etc/hosts.allow
Enter the following line: ALL: 192.168.0.2
Now hit ctrl+o to save the file and ctrl+x to exit pico. You need to add IP addresses to hosts.allow so they can use the local services
As root enter the following command: pico /etc/hosts.deny
Enter the followign line: ALL:ALL
That's it for configuring your linux box for the local network, now save all your changes and move to the windows box.
2.2. Networking a Linux Box and a Windows Box (Configuring Windows)
2.21 Installtion of Drivers
Make sure all the software was installed for your NIC drivers to ensure that your NIC will function correctly.
Right-Click on Network Neighborhood on the desktop and select "Properties"
In the configuration tab locate your NIC's Protocol by clicking on it, and hitting the "properties" button. You should have TCP/IP protocol installed, if not, install it but clicking the "Add" button. In the add screen go to protocol and find "TCP/IP" protocol and add it.
2.22 IP Address
After selecting or adding the TCP/IP protocol for your NIC driver, click the properties button. Select the "IP ADDRESS" tab. Enable "Specify an IP address" and enter the IP address of your Windows computer that you specified in linuxconf. Then enter the netmask for your IP address. For this example the IP address will be 192.163.0.2 and the netmask will be 255.255.255.0
Click apply, then go to your WINS Configuration tab, this should be turned off.
2.23 Gateways and DNS Server
Now go to your "Gateways" tab and remove anything that it's the list by clicking on it and hitting "Remove", now you need to add your Linuxbox as the gateway, so in the provided space, enter in 192.168.0.1 then add it. Now go to your DNS Server tab, in the host name enter your Linuxbox's host name on the internet, if you look back, you see that i set mine as "70warp75" so enter whatever you had there in this box. In domain, enter in your Local network domain, mine was set to "sympaticowarp.ca". In the nameservers section, add your ISP's given nameserver. You set this in linuxconf under Config -> Networkign -> Name Server Specifications (DNS) under the Name Server1 entry.
2.24 Testing the connection
Okay, once again, that should be it for the windows box. Now, test your network by going into MS-DOS prompt on your windows box and typing "ping 192.168.0.1" if you get a reply, then they're connected.
3. Sharing Internet Access using IP Masquerding
Once again, SirPlaya has this nicely covered in his guide "Janou's Guide to IP Masquerading" located at http://www.linuxhelp.ca/guides/ipmasq/. . But i will run through it quickly here, for a more detailed description, check out his guide.
This will assume that you are running 2.2.x kernel and with ALL masquerading features compiled in. In my install of Redhat 6.1 this was all set up.
3.1 Setting up IP Masquarding on the LinuxBox
On your linuxbox, log on as root and edit your rc.local file by typing "pico /etc/rc.d/rc.local" and add the following at the end of the file:
#---- IP Masquerade section w/IPCHAINS --- /sbin/depmod -a /sbin/modprobe ip_masq_ftp /sbin/modprobe ip_masq_raudio /sbin/modprobe ip_masq_irc /sbin/modprobe ip_masq_quake /sbin/ipchains -P forward REJECT /sbin/ipchains -A forward -s 192.168.0.0/24 -d 0.0.0.0/0.0.0.0 -j MASQ echo 1 > /proc/sys/net/ipv4/ip_forward #---- IP Masquerade END ----
Save the file and exit pico.
3.2 Intiating and Testing the Connection
From your console, as root, type "sh /etc/rc.d/rc.local" . For some reason I get an error asking me to type in the line "echo 1 > /proc/sys/net/ipv4/ip_forward " again, if you don't get this, then that's good, doesn't cause any problems anyways. Now, go to your Windows machine and open up your web browser and try to call up a website, if it works, great! if not...visit us in #LinuxHelp and we'll try our best to assist you in fixing it.
Having trouble? Got questions? Require further assistance? If so please feel free to visit our Help Forums and ask the experts!