Solved

Linux as a GATEWAY ---> HELP!

Posted on 2002-07-03
8
220 Views
Last Modified: 2013-12-15
The scenario is the following...

I have a p133 notebook running linux mandrake 7.1 with not gui installed so i am using the console for everything as the gui is too slow on the notebook. This notebook is connected to a HUB. My ADSL modem is connected to the same HUB. I have another computer in another room which is connected to the hub as well (there are now 3 things connected) and it has MS WINXP on it. I want the linux notebook to connect to my ADSL connection (i know the username and pswd and the DNS search suffix) and once connected, it must share the connection so that other computers on the network can use the internet too. Tell me how to configure the linux box and the windows xp box and i will award the points. By the way the work group on the windows computers is MSHOME.

Thank - you...

Tim.
0
Comment
Question by:timster692001
8 Comments
 
LVL 17

Expert Comment

by:psimation
ID: 7129122
Use netconf to have the Linuxbox receive the correct IP and subnet. Make sure you can ping to and from the pc's.

Now, make sure your linux box can connect via adsl on it's own.

When you have that done, add the linux box's IP to the windows box(es) as the gateway, then on the Linux box you need to masquerade the linux box IP, I use iptables for that, you might need to read up on ipchains.
For iptables(given that it is compiled on the Linux box...)

# echo "1" > /proc/sys/net/ipv4/ip_forward
# iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE

just replace ppp0 with the appropriate interface name of the adsl ( probably eth1)
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 7129469
even all 3 boxes are on the same hub, you need to different IP subnets for it:
  1. notebook and ADSL
  2. notebook and Windoze
'cause you have only one interface in your notebook, you need to add a virtual one, like:
  ifconfig eth0:1 10.10.10.1 netmask 255.255.255.0 up
wher eth0 has IP 192.168.1.1
your ADSL box might have the IP 192.168.1.2
your Windoze box might have IP 10.10.10.2

no you can NAT all using:
   iptables -t nat -A POSTROUTING -o eth0 -s 10.10.10.0/24 -j MASQUERADE
0
 
LVL 40

Accepted Solution

by:
jlevie earned 100 total points
ID: 7130253
I'll have to differ with ahoffman on this. I've found a firewall/gateway to be problematical if it doesn't have two physical interfaces. And everything I've read on IPchains/IPtables says not to attempt a firewall/gateway with only one interface. Furthermore, I believe you'll have problems with everything connected to a single hub, and you've certainly compromised the security afforded by a firewall with inside and outside connections on a single "wire".

Get another PCMCIA NIC for the laptop. Connect one NIC to the ADSL modem and the other to the hub and set up IPchains or IPtables as desired. You'll be using an RFC1918 private network on the inside and will need to configure the xp box accordingly.
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 7131119
jlevie, I'm aware of the security problems when there is only one interface. My iptables can handle virtual interfaces (as long as there are no MAC rules), I'm not shure about ipchains.
Another NIC would of corse be the better solution.
0
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 

Author Comment

by:timster692001
ID: 7133797
That would be easy to add a nic, however the notebook does not have a USB port and i am not going to spend $100 on a new PCMCIA lan card. So i will have to network them as i specified in the first place. Please expand on some of your answers, they are difficult to follow as i am not as experienced as you people.
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 7133808
step by step:
  1. # setup physical and virtual interface/IP on notebook:
     ifconfig eth0 192.168.1.1  netmask 255.255.255.0 up
     ifconfig eth0:1 10.10.10.1 netmask 255.255.255.0 up
     echo 1 > /proc/sys/net/ipv4/ip_forward
  2. # check on notebook  if you can ping both
  3. # setup other IPs (C, modem) as described above:
     # ADSL: 192.168.1.2
     # PC:   10.10.10.2
  4. # check if you can ping each of them
     # ping on PC should not reach ADSL, and vice versa
0
 

Author Comment

by:timster692001
ID: 7139748
Hello all again, if you are reading, i have come up with the solution myself. The thing is that you are probably all right, however there are easier ways to do things. I used the Internet Connection Wizard in mandrake 8.2 and used a 3com net driver for my ethernet card. Then i used 'host' as the hostname and an ip of '192.168.0.1' as the server. I set it to get an IP with DHCP on boot and restarted Mandrake, thus connected to the internet when i loaded Mozilla. Things are simple, i just wanted a simple answer, i don't want to edit config files, i don't want to recompile my Kernel. Thank you anyway...
0
 

Author Comment

by:timster692001
ID: 7139761
THE closest
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Currently, there is not an RPM package available under the RHEL/Fedora/CentOS distributions that gives you a quick and easy way to allow PHP to interface with Oracle. As a result, I have included a set of instructions on how to do this with minimal …
Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now