LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 09-24-2003, 05:25 PM   #1
Chryzmo
Member
 
Registered: Jun 2003
Location: Virginia
Distribution: Slackware 10.1
Posts: 180

Rep: Reputation: 30
Question Internet Connection Sharing with a Windows PC


Heyas,

The modem on my windows PC recently stopped working and I have another computer that I run Mandrake 9.1 on. It can connect to the internet just fine, through dialup, and I was wondering if there is a way I could set up the Linux PC as a server and let the Windows PC connect to the internet through that. Then when I get cable again, can I turn it around, as the Windows PC will have the cable going into that.

The Linux PC has Mandrake 9.1 on it, the other PC ahs Windows 98SE. The LAN works when I go on my Windows partition from this computer, both see each other. However I havent been able to figure out how to get it to work from Linux.

Thanks,
Chris
 
Old 09-24-2003, 05:44 PM   #2
/bin/bash
Senior Member
 
Registered: Jul 2003
Location: Indiana
Distribution: Mandrake Slackware-current QNX4.25
Posts: 1,802

Rep: Reputation: 47
Just start up the Mandrake Control Center, click on Network&Internet, then click on DrakGW GW stands for Gateway. It's pretty easy to set it up.
 
Old 09-24-2003, 06:01 PM   #3
Chryzmo
Member
 
Registered: Jun 2003
Location: Virginia
Distribution: Slackware 10.1
Posts: 180

Original Poster
Rep: Reputation: 30
Ok, Thanks.

I think I got it to the point where the Windows computer can see there is an internet connection running on my Linux machine, as there is a little icon on the system tray that shows my Machine's name and the ISP's name, however when I run IE or Netscape they both sit there for like two minutes and then say the website can't be reached... Do I need to put in proxy settings or anything?

Last edited by Chryzmo; 09-24-2003 at 09:22 PM.
 
Old 09-24-2003, 10:07 PM   #4
Chryzmo
Member
 
Registered: Jun 2003
Location: Virginia
Distribution: Slackware 10.1
Posts: 180

Original Poster
Rep: Reputation: 30
Hmm... I was playing around with it, and I think I need to setup a proxy. However I have never done this, in Windows or Linux, so I really don't know how to go about doing it.

In DrakProxy there isnt a wizard or anything. It just gives me a screen to put the Proxy address in, I do not know if I just make one up for this computer or what. I went through the DrakGW wizard, so I would think that should be fine and I know the network equipmnt is OK because when I run my Windows partition both computers work fine. I also know that the network card works with linux because I have played LAN Quake2 games from Linux and it worked. I just can't seem to be able to share the internet...

Maybe someone who knows more about setting up networks with more than one OS can help?

Thanks,
Chris
 
Old 09-25-2003, 02:00 AM   #5
linuxmanju
Member
 
Registered: Sep 2003
Location: India
Distribution: Debian
Posts: 50

Rep: Reputation: 15
U need to masquerade the connection either using ipchains or ipfwadam...

man ipchains fr details..I canot give u the command as i dunno the conection type and the ipaddress of ur machine...

man ipchains will give u the hint...
its a pretty smple one line command
Bye
 
Old 09-25-2003, 02:48 AM   #6
Stoic
LQ Newbie
 
Registered: Sep 2003
Location: Netherlands
Distribution: Mandrake
Posts: 24

Rep: Reputation: 15
Config?

How did you configure your second NIC on Linux (the one Windows is connecting to?). You should set it up with a fixed IP: 192.168.1.1.

You then go to Mandrake Control Center->Network & Internet. There you should see an option like 'Share your connection'. This will make the bridge between eth1->eth0 (assuming eth0 is connected to the internet).

On the windows machine you should have no specific settings (so with dynamic IP, etc. - you might need to set gateway to 192.168.1.1 but I am not sure, as I did not do that explicitly and it just works). I assume you have so-called a crosscable going from Windows box->Linux box (afaik a normal ethernet cable does not work).

There is no need to set up a proxy on your Linux machine in order to enable the sharing.

Currently I am not at home, so I can't give you more details. But I do have a Windows machine connected to a Linux machine, which is connected to the internet. The setup was really easy.
 
Old 09-25-2003, 04:46 AM   #7
/bin/bash
Senior Member
 
Registered: Jul 2003
Location: Indiana
Distribution: Mandrake Slackware-current QNX4.25
Posts: 1,802

Rep: Reputation: 47
All you need to do is from Control Panel click on network, select TCP/IP for you NIC that is connected to the Mandrake machine, make the Mandrake machine the gateway and add the DNS numbers.
 
Old 09-25-2003, 05:59 AM   #8
Chryzmo
Member
 
Registered: Jun 2003
Location: Virginia
Distribution: Slackware 10.1
Posts: 180

Original Poster
Rep: Reputation: 30
Stoic,

The way my next work is set up is like this:

Linux -> conects to internet(with 56k modem for now)
||
HUB
||
Win98SE Computer

There were 3 computers on the network, which is why we use a hub. However, right now there are only 2, but I only have network cables, no cross over cables. So I am using the HUB to make it work. So there shouldn't be a problem with the wires.



/bin/bash,

Do you mean put the IP address of the Mandrake machine as the gateway and DNS numbers? I do not know the DNS numbers of my ISP as I have always just let whatever I used t connect determine taht by itself. Although, if I do need it, I believe I could find it on my ISPs website...


Thanks for the help everyone. I will try it when I get home today and let you know if there are anymore problems.

-Chris-

Last edited by Chryzmo; 09-25-2003 at 06:02 AM.
 
Old 09-25-2003, 06:25 AM   #9
Gorbachov
LQ Newbie
 
Registered: Sep 2003
Location: Bankya
Distribution: ASPLinux v7.3 Vostok
Posts: 29

Rep: Reputation: 15
It is simple as possible..

You have two interfaces...eth0 is with the address from your ISP and eth1 is the NIC that is in your network that you want to share...!


Code:
modprobe ipt_MASQUERADE
iptables -F; iptables -t nat -F; iptables -t mangle -F
iptables -t nat -A POSTROUTING -s "your_network"/24 -o eth0 -j MASQUERADE
echo 1 > /proc/sys/net/ipv4/ip_forward

First masquerade after that...routing and last getting flag 1 to allow Linux to give the packages to move trough two interfaces...

And put this into rc.local or whatever you find for good...

Good luck,
Gorbachov

Last edited by Gorbachov; 09-25-2003 at 06:26 AM.
 
Old 09-25-2003, 07:18 AM   #10
Stoic
LQ Newbie
 
Registered: Sep 2003
Location: Netherlands
Distribution: Mandrake
Posts: 24

Rep: Reputation: 15
Quote:
Originally posted by Gorbachov
It is simple as possible..

You have two interfaces...eth0 is with the address from your ISP and eth1 is the NIC that is in your network that you want to share...!


Code:
modprobe ipt_MASQUERADE
iptables -F; iptables -t nat -F; iptables -t mangle -F
iptables -t nat -A POSTROUTING -s "your_network"/24 -o eth0 -j MASQUERADE
echo 1 > /proc/sys/net/ipv4/ip_forward

First masquerade after that...routing and last getting flag 1 to allow Linux to give the packages to move trough two interfaces...

And put this into rc.local or whatever you find for good...

Good luck,
Gorbachov
Some just like user interfaces on top of this 'nerdish' stuff . I do have the skills to do it in the manner you propose, but then I'd like to know what I am actually typing rather than copy&paste. If there is a 'friendlier' way to do the same, why not use that instead? Eventually, when I have the time, I'll dig into the really technical details on how NAT/Masquerading works within Linux. But currently I just don't have the spare time for that.

I do not want this thread to end in a terminal vs UI manner of configuring a system. Some like the UI because of ease of use and less technical stuff and some like the terminal because of total control. And some like it both ways (like me ).
 
Old 09-25-2003, 07:36 AM   #11
Stoic
LQ Newbie
 
Registered: Sep 2003
Location: Netherlands
Distribution: Mandrake
Posts: 24

Rep: Reputation: 15
Quote:
Originally posted by Chryzmo
Stoic,

The way my next work is set up is like this:

Linux -> conects to internet(with 56k modem for now)
||
HUB
||
Win98SE Computer

There were 3 computers on the network, which is why we use a hub. However, right now there are only 2, but I only have network cables, no cross over cables. So I am using the HUB to make it work. So there shouldn't be a problem with the wires.
Indeed, in this case you do not need a cross over cable.

Quote:
/bin/bash,

Do you mean put the IP address of the Mandrake machine as the gateway and DNS numbers? I do not know the DNS numbers of my ISP as I have always just let whatever I used t connect determine taht by itself. Although, if I do need it, I believe I could find it on my ISPs website...
Afaik you do not have to put in the DNS numbers (at least I didn't) - so this should somehow be transparent. I am not sure whether you have to explicitely put in the gateway on your Windows machine (again I didn't - I left every input field empty).

Quote:
Thanks for the help everyone. I will try it when I get home today and let you know if there are anymore problems.

-Chris-
Good luck and keep us updated
 
Old 09-25-2003, 07:57 AM   #12
Gorbachov
LQ Newbie
 
Registered: Sep 2003
Location: Bankya
Distribution: ASPLinux v7.3 Vostok
Posts: 29

Rep: Reputation: 15
I am not sure for your meaning...or what exactly you want...or you just making me fun?!

OK lets tell you what I have...cable net - Linux Router and Server - private network with M$ Machines...

What I do...


Code:
modprobe ipt_MASQUERADE
iptables -F; iptables -t nat -F; iptables -t mangle -F
This two lines flashes the tables and start NAT...

Code:
iptables -t nat -A POSTROUTING -s "your_network"/24 -o eth0 -j MASQUERADE
This line give one rule for Iptables tables that all routed from the range of the network that you use on eth0 /that is the external interface, INTERNET interface/ all will be MASQUERADE or masked...!So no one could see what is there behind the Linux...

Code:
echo 1 > /proc/sys/net/ipv4/ip_forward
This line is very important /all of these are important / this line sets the flag in the fail ip_forward to "1" for Linux that means that the all packages could pass trough the two interfaces...

All this is put in /etc/rc.d/rc.local and will be execute at boot...

On the Windowz machines the Gateway adress will be the iner address of the Linux and for DNS put the address of the ISP or if you have named runned on your router...?

That is all...

Gorbachov

Last edited by Gorbachov; 09-25-2003 at 08:01 AM.
 
Old 09-25-2003, 10:33 AM   #13
Stoic
LQ Newbie
 
Registered: Sep 2003
Location: Netherlands
Distribution: Mandrake
Posts: 24

Rep: Reputation: 15
I was not joking really. I was just referring to the fact that you can share your Linux Network Connection through Tools that are available in your distro. E.g., I am using Mandrake and you can share your internet connection by just going to Mandrake Control Center and enable it over there. This means that you don't have to type all the things that you mention. It is just an alternative way of achieving the same goal.

So, in essence, there are two ways of configuring stuff. Either by typing stuff in a terminal, or by using a Tool/Wizard/Application that essentially does the same for you but has a User Interface on top of it. For some things there may not exist a User Interface so you would need to edit certain files. But most of the stuff can be configured through a User Interface.

Btw, thanks for the explanation of the commands you mentioned! Now I have a better idea what those lines actually mean .
 
Old 09-25-2003, 11:03 AM   #14
Gorbachov
LQ Newbie
 
Registered: Sep 2003
Location: Bankya
Distribution: ASPLinux v7.3 Vostok
Posts: 29

Rep: Reputation: 15
I am happy that there is no problem...

But I have never used tool... You may think that is old fashioned but I use only the console...

PS. But now you know how to do it trough console...

Gorbachov
 
Old 09-25-2003, 11:08 AM   #15
Stoic
LQ Newbie
 
Registered: Sep 2003
Location: Netherlands
Distribution: Mandrake
Posts: 24

Rep: Reputation: 15
Quote:
Originally posted by Gorbachov
I am happy that there is no problem...

But I have never used tool... You may think that is old fashioned but I use only the console...

PS. But now you know how to do it trough console...

Gorbachov
Sure there is no problem at all . I do not think it is old fashioned to use the console only. It just requires more knowledge to use the console . And to build up that knowledge consumes time .
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
sharing internet connection with windows xp melinda_sayang General 11 12-10-2004 09:51 PM
Sharing internet connection with windows Kontrau Linux - Networking 2 05-02-2004 07:10 PM
Windows Xp, Slackware Internet Connection Sharing. Volcom Slackware 14 07-04-2003 06:18 PM
Windows and Linus sharing an internet connection... Negativ13 Linux - Newbie 15 02-21-2003 01:37 AM
Windows internet connection sharing Config Linux - Networking 3 02-22-2002 12:17 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 04:13 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration