Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Distribution: Windows XP. I gave up with Linux & I left LQ.
Posts: 502
Rep:
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.
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:
Distribution: Windows XP. I gave up with Linux & I left LQ.
Posts: 502
Original Poster
Rep:
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.
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
Distribution: Windows XP. I gave up with Linux & I left LQ.
Posts: 502
Original Poster
Rep:
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.
Distribution: #1 PCLinuxOS -- for laughs -> Ubuntu, Suse, Mepis
Posts: 315
Rep:
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.
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.
Distribution: Windows XP. I gave up with Linux & I left LQ.
Posts: 502
Original Poster
Rep:
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.
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!!
Distribution: Windows XP. I gave up with Linux & I left LQ.
Posts: 502
Original Poster
Rep:
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.