LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 04-09-2005, 05:14 AM   #1
webwolf70
Member
 
Registered: Feb 2004
Distribution: Windows XP. I gave up with Linux & I left LQ.
Posts: 502

Rep: Reputation: 30
Two Ethernet Cards


Is there a way I can use both of my ethernet cards. What I mean is that I have Cable and I would like to have it going into one computer and then out from that computers second ethernet card to my second computer. I am not even sure if that is possible but I would like to try.

Thanks

Webwolf
 
Old 04-09-2005, 05:39 AM   #2
Mega Man X
LQ Guru
 
Registered: Apr 2003
Location: ~
Distribution: Ubuntu, FreeBSD, Solaris, DSL
Posts: 5,339

Rep: Reputation: 65
I never did it myself, but it should be possible. However, you will need to install a DHCP client on your computer with two cards, so that your second computer will get an IP address.

Before testing this, make sure that both of your network cards are identified.
Type:

lspci | grep net

to see if both cards are there.

Good luck!
 
Old 04-09-2005, 06:29 AM   #3
webwolf70
Member
 
Registered: Feb 2004
Distribution: Windows XP. I gave up with Linux & I left LQ.
Posts: 502

Original Poster
Rep: Reputation: 30
Thank you. Now that I know it should be possible I will give it a try. Both cards are picked up and works so that is not a problem. This should be fun, lol. Once I am done then I will be using the one computer as a webserver. That is also new for me.



Webwolf
 
Old 04-09-2005, 07:07 AM   #4
Mega Man X
LQ Guru
 
Registered: Apr 2003
Location: ~
Distribution: Ubuntu, FreeBSD, Solaris, DSL
Posts: 5,339

Rep: Reputation: 65
Not a problem mate . And just to clarify a bit. You will need to install a DHCP server on your machine with two network cards and a DHCP client on your second machine. Those servers/clients are pretty much shipped with all major distributions around, so no big there.

And about Webserver, if you are going with Apache, it's awesome and works practically out of the box too with any major distributions. And peoples say Linux is difficult
 
Old 04-09-2005, 08:00 AM   #5
webwolf70
Member
 
Registered: Feb 2004
Distribution: Windows XP. I gave up with Linux & I left LQ.
Posts: 502

Original Poster
Rep: Reputation: 30
One of the problem I am having is that one computer has Fedora Core 3, the other has both Mandrake 10.1 Official and XP. While I have not tried anytihg with Mandrake yet, XP is a pain. But for now I will be using it also.

Now to set up a DHCP host I am lost on, I need to firgure that out but I am sure it is not that difficult. Fedora Picks up both eth0 and eth1. eth0 has the cable from the internet and eth1 will be going to the second computer, (though right now it says inactive becuase there is no cable connected to it.)
Both are Compaq Ethernet cards.

I have heard a lot of good things about Apache. I look forward to learning more about it and giving it a try. SLoooowly I am getting there, lol.

Webwolf
 
Old 04-10-2005, 11:57 AM   #6
winsnomore
Member
 
Registered: May 2004
Location: USA
Distribution: #1 PCLinuxOS -- for laughs -> Ubuntu, Suse, Mepis
Posts: 315

Rep: Reputation: 31
Apache has nothing to do with it unless you want to run a httpd (or web daemon) on one machine.

What you really are trying to do is run your one computer as a cheap router .. a noble effort but you will need to do more than run DHCP clients on both machines.
On the machine acting as "the router" .. one port you will have to run DHCP server .. and then you will have to mark the routes (route command) .. and route traffic from leaf computer to the cable modem. (need less to say that your two networks are diffrent subnetworks as your port connected to windows will get an IP address from the iSP and the other will be
a "local addresss" .. to make work properly will you have to run the NAT also ... you will be well advised to think about runing a firewall ..
It can be done, has been done but will be a good learing experience if you haven't done it before.
 
Old 04-10-2005, 03:48 PM   #7
branden_burger
Member
 
Registered: Dec 2004
Posts: 66

Rep: Reputation: 15
well, its not that very complicated. As winsnomore says, you have to find out about NAT.

it's like this -

router machine has 2 network cards, (eth0, eth1)

so what you have to do :

cable/DSL ---> router eth0

On the router machine:

run iptables for SNAT (if you have a static ip on your cable) else iptables for MASQUERADE (if your provider assigns addresses using DHCP) in the POSTROUTING section.

Make sure that ip forwarding is ON (set to 1) in /etc/sysctl.conf

And allow forwarding across eth1 in iptables for your client.

On the client machine:
Make the default gateway the ip addr of the router machine on eth1 ( in /etc/sysconfig/network). And you could assign a static address here, on the same network as eth1. No need for DHCP if you have just 2 machines on a network.

Really, it's not that hard. It'll take you a day or two maybe to get it figured out. http://google/linux search for
iptables NAT router how-to
I'm sure you'll come across something useful

have fun (beating your head against the wall when it doesn't work, but it will in the end!!)

Last edited by branden_burger; 04-10-2005 at 03:49 PM.
 
Old 04-13-2005, 11:52 AM   #8
webwolf70
Member
 
Registered: Feb 2004
Distribution: Windows XP. I gave up with Linux & I left LQ.
Posts: 502

Original Poster
Rep: Reputation: 30
Thanks for the additional info. I have not had time to do anything yet but I will be working on this and researching it later today. I will post my results here. I will be using one of the computers for a website so I will need to have it set up with Apche also, but first I need to get the DCHP server working.



Webwolf
 
Old 04-13-2005, 01:18 PM   #9
branden_burger
Member
 
Registered: Dec 2004
Posts: 66

Rep: Reputation: 15
dude - you don't need dhcp for just two computers on a network. really. you'll be far better off manually assigning addresses. DHCP is useful when you have lots of computers on a network you can't run around manully assigning IP addresses to. It'll take a while, all the stuff I told you, for sure, maybe a week of nothing else!!
 
Old 04-15-2005, 12:20 PM   #10
webwolf70
Member
 
Registered: Feb 2004
Distribution: Windows XP. I gave up with Linux & I left LQ.
Posts: 502

Original Poster
Rep: Reputation: 30
Mainly what I wanted to do was use one computer as a router. From the cable modem to that computer to my other computer. But what I think I may do is just go and buy a router. I can get one for about 36 dollars(US.) The Hub I have doesn't work that well. For some reason it likes to stop working on certain ports or all of them. I then have to unplug the ethernet cables, unplug the power, wait for a few minutes(If I am lucky and it works at all,) and plug it all back in. After that I have to power cycle my modem. It is a pain and I was looking for something else. I want to use my one computer as a webserver but I can't if the hub decides it doesn't want to work.

So right now I plan on getting a router and then working on the webserver. Thanks to everyone for the thoughts, opinions and help.


Webwolf
 
  


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
Two ethernet cards Scorper Linux - Hardware 1 06-05-2005 07:38 AM
using 2 ethernet cards one Tx and one Rx kayser Linux - Networking 11 05-03-2004 02:03 PM
2 ethernet cards.. Nyybai Slackware 8 04-12-2004 11:49 AM
2 Ethernet Cards matt80 Linux - Networking 14 12-01-2003 03:19 PM
Ethernet Cards and Sound Cards SchizoIV Linux - Newbie 2 07-05-2002 09:10 PM

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

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