LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
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 12-02-2008, 07:09 AM   #1
baig
Member
 
Registered: Nov 2008
Location: وادی ھنزہ
Distribution: Solaris 5.10, Debian Server 5.2, CentOS 5.6
Posts: 226
Blog Entries: 3

Rep: Reputation: 38
Can I share my lan connection?


Hello,

I wonder if I could share my LAN connection with other Computer, W$ndows XP installed on it...

Background:

I have two PCś I can share my LAN Connection from xp to Fedora Through "Share My Connection " option. I have two LAN Cards Installed on my new PC,
1. Through first LAN Card I am connected to my LAN server.
2. Through Second LAN Card My Both PCs are connected together by CAT5 Crossed Wire cable..

Problem:

I don't know how to configure Fedora 9 to make it share LAN connection with my other pc ?

Is there any "Connection Sharing Option " like W$ndows?

Sketch:

It Works:

------[^^]<------------>[^^]<---------------->[^^]

LAN SERVER-----My W$n(OS)--------My Fedora(OS)


How to make it Work?

-------[^^]<------------->[^^]<--------------->[^^]

LAN SERVER<--->My Fedora(OS)----?----W$n(OS)


Thanks in advance.
 
Old 12-02-2008, 07:56 AM   #2
farslayer
Guru
 
Registered: Oct 2005
Location: Willoughby, Ohio
Distribution: linuxdebian
Posts: 7,228
Blog Entries: 5

Rep: Reputation: 189Reputation: 189
If you want a connection sharing option, you can install firestarter, and check the box for Internet Connection Sharing..
It should be in the repository for your Distro..

http://www.fs-security.com/

http://www.fs-security.com/docs/connection-sharing.php

There are other methods of enabling that functionality as well, that can be done from the command line..
 
Old 12-02-2008, 08:08 AM   #3
David1357
Senior Member
 
Registered: Aug 2007
Location: South Carolina, U.S.A.
Distribution: Ubuntu, Fedora Core, Red Hat, SUSE, Gentoo, DSL, coLinux, uClinux
Posts: 1,302
Blog Entries: 1

Rep: Reputation: 107Reputation: 107
Quote:
Originally Posted by baig View Post
Is there any "Connection Sharing Option " like W$ndows?
If you need a GUI, then farslayer has given you the right path. If you just want to bridge traffic from one card to the other, you need to create a network bridge on the Fedora box. You will need bridge-utils installed. Here are the steps
Code:
$ brctl addbr bridge0         # Create the bridge
$ brctl addif bridge0 eth0    # Add an interface to the bridge
$ brctl addif bridge0 eth1    # Add an interface to the bridge
$ ifconfig eth0 0             # Remove the IP address from the interface
$ ifconfig eth1 0             # Remove the IP address from the interface
$ ifconfig bridge0 x.x.x.x    # Give the bridge an IP address
If you are using DHCP for the IP address of the Fedora box, you might have to kill dhclient. Run "ps aux | grep dhc" to see what kind of DHCP client might be running.

If you need to make all this permanent, there are several ways to do it. If you need to know how, please post a reply to this thread.
 
Old 12-02-2008, 08:41 AM   #4
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,395
Blog Entries: 2

Rep: Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903
There are several GUI-based firewall/router packages. There are also some good canned packages that perform the same purpose. The one I prefer and recommend is http://homelansecurity.sourceforge.net/index.php.
There are examples of how to customize your setup, and it runs right out of the box with very simple configurations.
You may want to run a DHCP server on the firewall, to replace the functionality of your ISP's DHCP if you were using that for your local LAN hosts.
--- rod.
 
Old 12-02-2008, 08:59 AM   #5
baig
Member
 
Registered: Nov 2008
Location: وادی ھنزہ
Distribution: Solaris 5.10, Debian Server 5.2, CentOS 5.6
Posts: 226
Blog Entries: 3

Original Poster
Rep: Reputation: 38
@David

Yes of Course I would love to hear form you in detail...



I have only on pc as my client and i am my self a client to LAN server..


So let me know how to make it permanent..??

Cheers!!
 
Old 12-02-2008, 01:34 PM   #6
David1357
Senior Member
 
Registered: Aug 2007
Location: South Carolina, U.S.A.
Distribution: Ubuntu, Fedora Core, Red Hat, SUSE, Gentoo, DSL, coLinux, uClinux
Posts: 1,302
Blog Entries: 1

Rep: Reputation: 107Reputation: 107
Quote:
Originally Posted by baig View Post
Yes of Course I would love to hear form you in detail...
Are you sure?

Quote:
Originally Posted by baig View Post
I have only on pc as my client and i am my self a client to LAN server..
So let me know how to make it permanent..??
The easy way is to add the commands to "/etc/rc.local". The hard way is to write an init script for your system.

If you do not use a splash screen at boot up, an init script can give you visual feedback about whether or not your script succeeded (e.g. the [OK] and [FAIL] messages that show up during boot).

If you do add your commands to "rc.local", you will probably want to make sure you handle errors gracefully. If one of your commands fails, the "rc.local" script will exit, and anything after your commands will not get executed.

You will also want to add logging.

Here is an example of what you might add to "rc.local":
Code:
# Create a network bridge and use DHCP to get an IP address
BRIDGE=bridge0
INTERFACES="eth0 eth1"
LOGFILE="/var/log/bridge.log"

rm -f $LOGFILE
echo "Creating bridge..." >> $LOGFILE 2>&1
if [ ! /usr/sbin/brctl addbr $BRIDGE >> $LOGFILE 2>&1 ] ; then
    echo "Failed." >> $LOGFILE 2>&1
    exit 0
fi
echo "Done." >> $LOGFILE 2>&1

for nic in $INTERFACES ;
do
    echo "Adding interface ${nic}..." >> $LOGFILE 2>&1
    if [ ! brctl addif $BRIDGE $nic ] ; then
        echo "Failed." >> $LOGFILE 2>&1
        exit 0;
    fi;
done
echo "Done." >> $LOGFILE 2>&1

echo "Getting IP address for bridge ${BRIDGE}..." >> $LOGFILE 2>&1
if [ ! dhclient $BRIDGE ] ; then
    echo "Failed." >> $LOGFILE 2>&1
    exit 0
fi
echo "Done." >> $LOGFILE 2>&1
Obviously, this could be improved. The biggest problem is that it does not remove the bridge if adding one of the interfaces fails.
 
Old 12-02-2008, 01:51 PM   #7
baig
Member
 
Registered: Nov 2008
Location: وادی ھنزہ
Distribution: Solaris 5.10, Debian Server 5.2, CentOS 5.6
Posts: 226
Blog Entries: 3

Original Poster
Rep: Reputation: 38
Thumbs up

Pretty complicated shell script...At least for me....

Anyway, Thank you so very much for your help and suggestion..

firestater is doing its job perfect... as some body had suggested ..Let me examine it first..


Once again thanks to you all above.. and to David for his Script!

Cheers!!
 
Old 12-03-2008, 06:16 PM   #8
hikerguy
LQ Newbie
 
Registered: Oct 2008
Posts: 18

Rep: Reputation: 0
Why not go the easy route and install a router? I have a Linux box and a WinXP box connected to a router,
and it works great. If you're simply looking for a way for two different systems to access the Internet, IMHO, that's the best route to go. Not sure if your looking to be able share files between the two, but if it's just Internet access, give that some thought. A router is pretty easy to set up. If you decide to go that route and need help setting it up, I'm sure you'll find a lot of people willing to help out.

Andy
 
Old 12-03-2008, 06:27 PM   #9
baig
Member
 
Registered: Nov 2008
Location: وادی ھنزہ
Distribution: Solaris 5.10, Debian Server 5.2, CentOS 5.6
Posts: 226
Blog Entries: 3

Original Poster
Rep: Reputation: 38
Thank you for you suggestion..

But if I simply connect a router then who is going to learn every aspect of Networking? ;-) Never mind!!

The situation will be even more worse than this if I go for a router because till now I don't know anything more that its definition. I do share my printer, Combo and File system inbetween my both pcs. Only one connection can be made at a time using my LAN CABLE... so I need to be acting like Server for my old pc...


Situation is under control with the help of Firestater firewall.
Am able to share my net connection from Fedora 9 to windows.. and I have to run DHCP for my single coz there were probs in static configuration.

Cheers!!

Last edited by baig; 12-03-2008 at 06:32 PM.
 
  


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
How to prioritise LAN connection over WiFi connection __spc__ Linux - Wireless Networking 0 09-05-2008 02:38 PM
How to share internet connection with Single LAN card shared over a switch!! anupamjamatia Linux - Networking 1 05-29-2008 07:28 AM
How to share internet connection with Single LAN card shared over a switch anupamjamatia Linux - Networking 1 05-29-2008 05:49 AM
searching samba share breaks connection to share Elomis Linux - Server 1 05-11-2007 12:28 AM
How can I share my Internet connection with other LAN ms windows users emiliofil Linux - Networking 1 02-21-2004 10:01 AM


All times are GMT -5. The time now is 05:46 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration