LinuxQuestions.org
Help answer threads with 0 replies.
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 01-23-2003, 03:24 AM   #1
rory
LQ Newbie
 
Registered: Jan 2003
Location: Manchester U.K.
Distribution: Vector Linux SOHO 5.1.1
Posts: 12

Rep: Reputation: 0
Internet sharing between Linux and Windows


I am trying to make my Red Hat Linux 8.0 machine to act as an internet gateway.

I have a Red Hat Linux machine with a dial up modem connecting to the Internet. This works OK.
I have a Windows NT machine connected to the Linux machine by an ethernet cable. The connection between the 2 PC’s is OK, in that each can ping the other.

The IP address on the Linux machine is 192.168.1.2 and the subnet mask is 255.255.255.0

I have enabled IP forwarding on the Linux machine by editing the /etc/sysctl.conf file and changing the value on the appropriate line from 0 to 1, and restarted the machine.


The NT machine has its IP address set to 192.168.1.1 and the subnet mask is 255.255.255.0

On the NT machine I have configured Internet Explorer to use a Proxy Server, and set the address of the Proxy to 192.168.1.2 (the IP of the Linux machine) and the port to 80.

I had hoped that this would enable me to reach the internet from the NT machine, but it doesn’t.

I have read somewhere that this should work without installing Proxy software on the Linux machine.

What have I missed?

Any advice will be much appreciated.
 
Old 01-23-2003, 03:30 AM   #2
peter_robb
Senior Member
 
Registered: Feb 2002
Location: Szczecin, Poland
Distribution: Gentoo, Debian
Posts: 2,458

Rep: Reputation: 48
It's not a "Proxy" function to go through another pc to the Internet...

It's called Gateway or Masquerading...

Change the Gateway setting in the local pc's to the Linux ip number, remove the Proxy setting in the browser...

You will also need to add a POSTROUTING rule in the firewall to masquerade the LAN numbers to the external ip number.

Last edited by peter_robb; 01-23-2003 at 03:33 AM.
 
Old 01-23-2003, 02:20 PM   #3
KevinJ
Member
 
Registered: Feb 2001
Location: Colorado Springs, CO
Distribution: Redhat v8.0 (soon to be Fedora? or maybe I will just go back to Slackware)
Posts: 857

Rep: Reputation: 30
do you have iptables installed? Do you know what your firewall rules currently look like?

-Kevin
 
Old 01-24-2003, 02:19 AM   #4
rory
LQ Newbie
 
Registered: Jan 2003
Location: Manchester U.K.
Distribution: Vector Linux SOHO 5.1.1
Posts: 12

Original Poster
Rep: Reputation: 0
I wasn't aware of the firewall rules. I just accepted all the defaults when I installed RH8. I tried to add the POSTROUTING rule as Peter suggested, and after this, Linux would not start up. It let me log in but then froze on the logo screen. Not knowing where to go from here, I reinstalled Linux. This time I selected customise the Firewall and said allow TCP/IP WWW & SSH. Is this right? Not had time to test it yet, (its keeping me up late at nights).
 
Old 01-24-2003, 02:28 AM   #5
born4linux
Senior Member
 
Registered: Sep 2002
Location: Philippines
Distribution: Slackware, RHEL&variants, AIX, SuSE
Posts: 1,127

Rep: Reputation: 49
try this:

http://www.yolinux.com/TUTORIALS/Lin...rkGateway.html

look for example 2.

hth.
 
Old 01-25-2003, 06:43 PM   #6
rory
LQ Newbie
 
Registered: Jan 2003
Location: Manchester U.K.
Distribution: Vector Linux SOHO 5.1.1
Posts: 12

Original Poster
Rep: Reputation: 0
My iptables file is as below

# Generated by iptables-save v1.2.6a on Sun Jan 26 00:04:01 2003
*nat
:PREROUTING ACCEPT [0:0]
:POSTROUTING ACCEPT [1:60]
:OUTPUT ACCEPT [1:60]
-A POSTROUTING -o ppp0 -j SNAT --to-source 192.168.1.2
COMMIT
# Completed on Sun Jan 26 00:04:01 2003
# Generated by iptables-save v1.2.6a on Sun Jan 26 00:04:01 2003
*filter
:INPUT ACCEPT [723:287230]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [795:99830]
COMMIT
# Completed on Sun Jan 26 00:04:01 2003


I looked at the tutorial suggested, but I think it was written for Red Hat 7.1, RH 8.0 seems not to accept some of the lines they suggest.

I have set the gateway on my NT box to 192.168.1.2 (which is the RH box).

The tutorial says that I should set the DNS to that of the ISP on the internet.

I tried pinging my ISP's name from the RH machine and got an IP address returned. I can ping this IP address from the RH machine. Should I also be able to ping it from the NT machine?

I got the Postrouting syntax from the Red Hat Linux 8 for Dummies book.
Worryingly I have found several mistakes in other parts of the book. Is this wrong too?
 
Old 01-25-2003, 10:40 PM   #7
peter_robb
Senior Member
 
Registered: Feb 2002
Location: Szczecin, Poland
Distribution: Gentoo, Debian
Posts: 2,458

Rep: Reputation: 48
The SNAT rule is definitely wrong!!!

It needs to reference your EXTERNAL ip number so that packets know where to come back to.
192.168.xxx.xxx is a local number to any machine.

Most times with dial-ups it is better to have this rule instead...
iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE

This takes care of the dynamically changing numbers from the ISP
There are a lot of rules you will need to add to protect yourself.. This tutorial is very comprehensive and has sample scripts at the end...
 
Old 01-26-2003, 06:44 PM   #8
rory
LQ Newbie
 
Registered: Jan 2003
Location: Manchester U.K.
Distribution: Vector Linux SOHO 5.1.1
Posts: 12

Original Poster
Rep: Reputation: 0
Thank you Peter, I am making some progress, though not there yet.
I used your line

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

and I can now ping my ISP or any other external IP address from my NT machine.

I put the IP address of my ISP in the DNS Service Search Order box in TCP/IP properties in Network Neighbourhood.

If I type www.google.com in the address bar of Internet Explorer I get a "Page cannot be displayed" message.

However, if I type in http://216.239.53.101 I get Google's home page.

Same with my ISP.

How do I make the Internet Explorer accept a name instead of only an IP address. I guess it is something to do with DNS, and I have tried every combination I can think of, but nothing seems to work.
 
Old 01-27-2003, 10:18 AM   #9
KevinJ
Member
 
Registered: Feb 2001
Location: Colorado Springs, CO
Distribution: Redhat v8.0 (soon to be Fedora? or maybe I will just go back to Slackware)
Posts: 857

Rep: Reputation: 30
You need to put your ISP's DNS servers in the TCP/IP settings of your Windows box.

-K.
 
Old 01-27-2003, 05:42 PM   #10
rory
LQ Newbie
 
Registered: Jan 2003
Location: Manchester U.K.
Distribution: Vector Linux SOHO 5.1.1
Posts: 12

Original Poster
Rep: Reputation: 0
This is the information supplied by my ISP

Web site URL http://www.ukonline.net/
Modem Dialup Number 0845 3331121
ISDN Dialup Number 0845 3331122
Incoming (POP3) Mail Server pop3.ukonline.co.uk
Outgoing (SMTP) Mail Server smtp.ukonline.co.uk
News (NTTP) Server news.ukonline.co.uk
Primary DNS Server Assigned
Secondary DNS Server Assigned

As you see, they do not provide any DNS information.
One of the tutorials I read, said I should put my ISP's IP address in the DNS box, but this did not work.

I have emailed my ISP with the details to see if they can help me.
I will post their response when I get it.
 
Old 01-28-2003, 07:33 PM   #11
Jakkin
Member
 
Registered: Jan 2003
Distribution: Mandrake 9.0
Posts: 47

Rep: Reputation: 15
On client

mask: 255.255.255.0
ip: 192.168.x.x
DNS: <your server IP>
gateway: <your server IP>

that should work
 
Old 01-28-2003, 09:22 PM   #12
sewer_monkey
Member
 
Registered: May 2002
Location: Toronto, ON, Canada
Distribution: Ubuntu, Debian, RedHat/CentOS
Posts: 624

Rep: Reputation: 31
Get gShield. It will set up a fully-fledged iptables ruleset for you, and it includes NAT (masquerading) support.

Unless of course you actually want to learn how iptables works...
 
Old 01-29-2003, 05:58 PM   #13
rory
LQ Newbie
 
Registered: Jan 2003
Location: Manchester U.K.
Distribution: Vector Linux SOHO 5.1.1
Posts: 12

Original Poster
Rep: Reputation: 0
Problem finally solved!!

UKOnline Technical support emailed their PrImary and Secondary DNS addresses.

I put these in the DNS Service Search Order box on the client.

The default Gateway on the NT client machine is the static IP address of the Linux machine.

The iptables entry:

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

successfully does the IP translation.

The file /etc/sysctl.conf needs the following entry to turn on IP forwarding:

# Controls IP packet forwarding
net.ipv4.ip_forward = 1

The default value is 0 which means IP forwarding is turned off.

I know I still have to sort out the firewall rules, but thats another story.

Many thanks to all for your suggestions.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Windows and Linux Internet Sharing LinuxSeeker SUSE / openSUSE 12 11-10-2005 02:41 PM
Internet Connection Sharing from Windows XP to Linux Patchy Linux - Networking 2 09-21-2005 03:02 PM
Sharing internet from linux to windows Infernal211283 Linux - Newbie 4 01-01-2005 04:46 PM
Internet connection sharing between linux and windows mdkusr Linux - Networking 4 11-09-2004 01:27 AM
sharing internet connection between linux and windows homer_3_16uk Linux - Networking 1 03-21-2004 01:23 PM

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

All times are GMT -5. The time now is 05:53 PM.

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