Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Networking
User Name
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.


  Search this Thread
Old 12-13-2003, 07:28 PM   #1
Registered: Dec 2003
Distribution: Slackware 9.0
Posts: 32

Rep: Reputation: 15
Arrow sharing internet connection from linux to another linux

hello everyone ^_^

my name is Renato and I am a newbie in linux... i'm using Slackware 9.1 in this pC (connected to the internet by eth1) and I would like to give internet access to another pC (connected to my pC by eth0), and this other pC runs a linux version called Kurumin (a brazilian distribution based on debian)

my internet connection is a dhcp type... I connect to it doing

dhcpcd -d eth1

and it automatic get a new IP address, a new gateway and etc... my IP is not static, is dinamic

how can I give internet connection to my other pC? could someone give me some straight help or indicate me some document/howto to read for help?

thanks =P
Old 12-13-2003, 07:45 PM   #2
LQ Newbie
Registered: Dec 2003
Posts: 26

Rep: Reputation: 15
Linux connection

the answer is DEFINETLY YES!!

Of course u can do that, but what I recommend to use in your lan machine es not a dhcp, but a static ipadress

if you connect through eth1 , then do this

ifconfig eth0 down
ifconfig eth up

to the lan machine, put the ipaddress

then u must route connections (with iptables)

so in command line write:

iptables -F
iptables -t nat -F
iptables -X

this is to flush any possible chains

iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE
we assume that eth1 is your internet nic.
this will redirect your lan directly to the internet

you must be sure that all policies are in ACCEPT mode, if arent ask me how to configure them

hope this can help!
Old 12-14-2003, 10:35 AM   #3
Registered: Dec 2003
Distribution: Slackware 9.0
Posts: 32

Original Poster
Rep: Reputation: 15
thaks dude!!! but i phoned my internet provider and they said I can't have a static IP... my ip will always be dinamic with DHCP...

is there still some way to give internet access to this other computer? ут
Old 12-14-2003, 10:44 AM   #4
LQ Newbie
Registered: Dec 2003
Posts: 5

Rep: Reputation: 0
What he means is that the computer you want to sahre your internet connection with, should be static. Your ISP will only see your first computer. I just set up Redhat 9 that way. I have one computer conenction to my cable modem, which has two network cards. The second NIC is then assigned an internal address, like Your second computer will have have subnet gateway of the 2nd NIC on your first computer and using the same DNS provided by your ISP.

Then there is some iptable stuff to add. But I can't help you there because I am very new myself. Good luck!
Old 12-14-2003, 03:04 PM   #5
Registered: May 2003
Location: Canada
Distribution: Fedora 13
Posts: 49

Rep: Reputation: 15
I've been looking at this problem too. I have a router serving http requests to one of my computers, but when I set up bind to forward them to my newer, faster puter the requests just time out.
So I guess my question is, can I use a dhcp server if my router is already serving addresses? or would my router be as blind to this as my isp?
Old 12-14-2003, 07:33 PM   #6
LQ Newbie
Registered: Dec 2003
Posts: 5

Rep: Reputation: 0
I don't know if this will help, but this is what i used as reference:
Old 12-15-2003, 07:40 PM   #7
Registered: Dec 2003
Distribution: Slackware 9.0
Posts: 32

Original Poster
Rep: Reputation: 15
thank you very much people!!! ^_^

I've read all that network corse from linuxchix... I am installing slackware in that other computer too and in a few hours I'll ve trying it out... thanx =P
Old 12-15-2003, 11:10 PM   #8
Senior Member
Registered: Feb 2003
Location: The Real Washington
Distribution: Debian, Android
Posts: 1,819

Rep: Reputation: 46
You can use DHCP on your internal network as well as having your external address assigned. As far as getting Internet access to your lan you can either A. Set up routing tables using Iptables, or B. Use a proxy like Squid to provide web access. Which one you choose depends on your needs (as far as ports needed by the machines on the Lan).


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
linux internet connection sharing usa1234 Linux - Networking 3 10-29-2004 12:27 PM
Internet Connection Sharing through Linux 9 unmesh vaidya Linux - Newbie 1 11-25-2003 08:32 AM
Internet Connection Sharing LINUX Please HELP MistroTHX Linux - Networking 2 10-06-2003 04:50 PM
Internet connection sharing between XP and linux kidicarus Linux - Networking 16 09-16-2003 08:05 PM
internet connection sharing in linux anwar_lpk Linux - Networking 2 05-06-2003 02:10 PM > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 01:49 PM.

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