LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-26-2006, 01:49 PM   #1
Braynid
Member
 
Registered: May 2006
Location: Romania
Distribution: CentOS
Posts: 140

Rep: Reputation: 15
Share internet connection


Hello,
I relize that this topic has been discussed over and over again, and i to have read manny posts of this sort but it seems that i cannot have it done.
I have tried usig iptables but it won't work
I have Ubuntu on a computer, and another WinXP. eth2 is my internet and eth1 is my lan.
Could you pease teach me how to do this other than settup squid?
Thanks for your understanding.
 
Old 05-26-2006, 01:52 PM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
tell us what you've actually tried and what did and didn't work. ultimately you MUST use iptables to do this, so you must have just missed a step out. you might like to use a gui tool like firestarter to configure it for you.
 
Old 05-26-2006, 02:18 PM   #3
Braynid
Member
 
Registered: May 2006
Location: Romania
Distribution: CentOS
Posts: 140

Original Poster
Rep: Reputation: 15
I do not have firestarter or anything of the sort

apt-get install firestarter
Reading package lists... Done
Building dependency tree... Done
E: Couldn't find package firestarter

I have tried:
# iptables --flush
# iptables --table nat --flush
# iptables --delete-chain
# iptables --table nat --delete-chain
# iptables --table nat --append POSTROUTING --out-interface eth2 -j MASQUERADE
# iptables --append FORWARD --in-interface eth1 -j ACCEPT
# echo 1 > /proc/sys/net/ipv4/ip_forward

I work as root.The above are commands that I try from a HOW-TO, I have tried to follow the one on this forum but i get

apt-get install dnsmasq ipmasq
Reading package lists... Done
Building dependency tree... Done
E: Couldn't find package dnsmasq

Thank you for the quick reply!
 
Old 05-26-2006, 02:20 PM   #4
Braynid
Member
 
Registered: May 2006
Location: Romania
Distribution: CentOS
Posts: 140

Original Poster
Rep: Reputation: 15
P.S: On the other computer i have: IP: 192.168.0.10 // MASK: 255.255.255.0 // GW: My ISP provided GW // DNS: My ISP DNS.
I use a cable modem.
 
Old 05-26-2006, 03:22 PM   #5
Braynid
Member
 
Registered: May 2006
Location: Romania
Distribution: CentOS
Posts: 140

Original Poster
Rep: Reputation: 15
It seems that now I have broke it completely... i don't know how but now there is no ping reply between the two computers...
Any suggestions will be highly appreciated
 
Old 05-26-2006, 03:41 PM   #6
Brian1
LQ Guru
 
Registered: Jan 2003
Location: Seymour, Indiana
Distribution: Distribution: RHEL 5 with Pieces of this and that. Kernel 2.6.23.1, KDE 3.5.8 and KDE 4.0 beta, Plu
Posts: 5,700

Rep: Reputation: 65
To build an easy quick firewall router setup. Goto http://easyfwgen.morizot.net/gen/ and answer the questions it ask. Then it will build a script that you just need to cut and paste to a file and run. Also when you mean eth2 and eth1 do you mean eth0 and eth1 or does it have three nics installed. For me I perfer to make eth0 the wan internet side and use the rest as lan, dmz, other other network configurations.

Brian1
 
Old 05-26-2006, 04:06 PM   #7
manishsingh4u
Member
 
Registered: Oct 2005
Location: Bhopal, India
Distribution: RHEL 6
Posts: 422

Rep: Reputation: 30
Run these commands on Linux (as root) or prefix "sudo " to these commands
Code:
iptables -P FORWARD ACCEPT
iptables -t nat -A POSTROUTING -o eth2 -j MASQUERADE
echo 1 > /proc/sys/net/ipv4/ip_forward
Yout /etc/network/interfaces should look like this
Code:
auto lo
iface lo inet loopback
address 127.0.0.1
netmask 255.0.0.0
mapping hotplug
        script grep
        map eth2
iface eth2 inet dhcp
iface eth1 inet static
address 192.168.0.1
netmask 255.255.255.0
auto eth2
auto eth1
And your /etc/resolv.conf should have your dns entries
Code:
search somedomain.com
nameserver X.X.X.x
nameserver x.x.x.x
Replace somedomain.com with your isp's domain and "x.x.x.x" with your isp's dns ipaddresses.

Now, your windows XP machine must have configuration similar to this
ipaddress = 192.168.0.x
subnet mask = 255.255.255.0
default gateway = 192.168.0.1 (hint - linux eth1)
primary dns = your first dns (hint -used in /etc/resolv.conf on linux machine)
secondary dns = your second dns

If all this is correct and u have proper cabling, etc. Your internet connection sharing must work for sure. (I have this configuration...and it works).

Last edited by manishsingh4u; 05-26-2006 at 04:09 PM.
 
Old 05-26-2006, 04:43 PM   #8
Braynid
Member
 
Registered: May 2006
Location: Romania
Distribution: CentOS
Posts: 140

Original Poster
Rep: Reputation: 15
Dude you saved me. Now it's working!!!! Only one problem.. now i cannot access web-sites from the linux machine. It has ping reply only it does not resolve DNS correctly. I'll handle that tomorrow.
Many thanks to you, finally it's working.
 
Old 05-26-2006, 04:55 PM   #9
manishsingh4u
Member
 
Registered: Oct 2005
Location: Bhopal, India
Distribution: RHEL 6
Posts: 422

Rep: Reputation: 30
Good Luck.
 
Old 05-27-2006, 06:24 AM   #10
Braynid
Member
 
Registered: May 2006
Location: Romania
Distribution: CentOS
Posts: 140

Original Poster
Rep: Reputation: 15
I know it sounds lame, but how can i make a script that runs the commands on boot?
 
Old 05-27-2006, 12:25 PM   #11
manishsingh4u
Member
 
Registered: Oct 2005
Location: Bhopal, India
Distribution: RHEL 6
Posts: 422

Rep: Reputation: 30
Quote:
how can i make a script that runs the commands on boot?
1) just write the commands of your choice line by line in any text file and save it by any name of your choice (eg. sinternet)
2) copy this file to your /etc/init.d/ directory
Code:
sudo cp sinternet /etc/init.d/ -v
3) Make this file executable
Code:
sudo chmod 0755 /etc/init.d/sinternet
4) Add this script to your default runlevel to start automatically, the default runlevel is ubuntu is 2. (Don't forget to type the dot at the end of the command)
Code:
sudo update-rc.d sinternet start 99 2 .
And there you are done.

Last edited by manishsingh4u; 05-27-2006 at 12:54 PM.
 
Old 05-27-2006, 02:21 PM   #12
Braynid
Member
 
Registered: May 2006
Location: Romania
Distribution: CentOS
Posts: 140

Original Poster
Rep: Reputation: 15
I thank you verry much for the help given. You have been most kind to a noob like me. B Good.
 
Old 05-27-2006, 03:10 PM   #13
manishsingh4u
Member
 
Registered: Oct 2005
Location: Bhopal, India
Distribution: RHEL 6
Posts: 422

Rep: Reputation: 30
Quote:
Originally Posted by Braynid
I thank you verry much for the help given. You have been most kind to a noob like me. B Good.
It's your kindness. Some day, I was a noob too.
 
  


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
Share Internet Connection sam_casperson Linux - Networking 3 02-03-2005 06:07 PM
how to share internet connection digihall7 Linux - Networking 5 10-22-2003 11:53 PM
how to share internet connection digihall7 Linux - Networking 2 09-23-2003 03:42 PM
HOW to share Internet connection zaldyd Linux - Newbie 1 07-25-2003 12:42 AM
How do I share the Internet connection? Valeria Linux - Networking 4 07-19-2003 11:28 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:29 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