can I set up ethernet between two machines without a hub or switch?
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.
can I set up ethernet between two machines without a hub or switch?
I have two machines with LAN cards and a cat5 cable - is there any reason I cannot just plug the two cards together and use pppd for the connection ... I could configer both cards to use static IP and there would be nothing else on the LAN.
It strikes me that this should be very simple to do - but, of course, all my examples are for more complex setups. So I'd like the benifit of someones experience and advise please. (i.e. what important issues am I likely to face, especially those commonly stuffed up )
With just two hosts, you can use a crossover cable. If they are far apart, get an adaptor the allows you to plug in two cables (extending the length) with a short cross over cable in one of the ends.
You can use whatever services you want to connect the computers. You might want to set up NFS shares. If neither computer is on the internet, you don't have to worry about firewalls.
A hub (at least) would electrically isolate the machines from each other - I don't know where you are, but hubs are more often than not available for free from Best Buy (with a rebate) or other retailers. If you google around, you could probably find one on the web for free (with a rebate.)
Originally posted by jordanthompson A hub (at least) would electrically isolate the machines from each other - I don't know where you are, but hubs are more often than not available for free from Best Buy (with a rebate) or other retailers. If you google around, you could probably find one on the web for free (with a rebate.)
jordanthompson: you will see from the sidebar that I am on Waiheke Island - googling atround will show you that it is in New Zealand. Here - stand-alone hubs or switches are impossible to get. I can only get one with a nat router for around NZ$100 (Roughly 40 greenbacks?) which is a little steep just to isolate the two machines electronically. B'sides, I don't have it right now.
However, your observation that someone may just give me one is pause for thought. I could try trolling old hackers to see if they have any in their hardware bins.
Have connected two machines via crossover cable, set static IP adresses, and included both hosts in each other's /etc/hosts file
ping <otherhost> tries to use the modem ... ??? How do I ping another host via ethernet? Reading man ping suggests that ping -I /dev/eth0 <otherhost> could be right - only it isn't.
reading about NFS shares.
It would be good to get this going since I'm setting up the other computer for someone else, and it would be handy for transferring large files (thump! burn CD - move CD 1m - thump!)
Re: can I set up ethernet between two machines without a hub or switch?
Quote:
Originally posted by Simon Bridge I have two machines with LAN cards and a cat5 cable - is there any reason I cannot just plug the two cards together and use pppd for the connection ... I could configer both cards to use static IP and there would be nothing else on the LAN.
Why do you want to use pppd? This would probably cause your system to try and dial. Just use straight ethernet when you configure each NIC.
BTW: Are you sure you are connecting these two computers with a cross-over cable. Do you see a link light on each NIC after you connect them?
haha! needed route info - man route tells me how to tell the machines which IP adresses are the network - great!
Now I can successfully ping <this> host from the <other> one. But not the other way!?
Suspect the firewall here. Be right back ...
Nope! Not the firewall - I've tried to ping the other host with the firewall switch off and nada ... none returned 100% packet loss. (post edit: but see later!)
It can't be a routing problem, since the connection works the other way! (presumably this host can figure out where to return the packets to?)
BTW: what I'd like to do, in the end, is access the other hosts filesystem from this one.
BTBTW: hello teckk, nice to see you again other folk welcome too.
Yes, I'm sure it's a x-over cable: it has "crossover cable" stamped on it at each end and the connectors are red (heh heh heh) also the little green light goes at both ends.
No, I don't want to use pppd - I read a bit more.
Last edited by Simon Bridge; 05-19-2005 at 08:03 AM.
Right: I need to figure out how to let network traffic through the firewall ...
Currently set to policy = drop for everything.
accepts everything on the loopback interface
lets all outgoing packets through
restricts incoming packets to RELATED, ESTABLISHED
allows SSH connections on dport 22
presumably I want to do something similar for whatever port uses tcp/ip?
haha! got it!
I added the rule:
# iptables -A INPUT -s 192.168.23.0/24 -m state --state NEW,RELATED,ESTABLISHED -j ACCEPT -i eth0
And now I can ping hauora3 from indigo prime .. wowee...
Comment tho - is there a better way of doing this?
Now to go look at the other machine - setup NFS/SAMBA?
Last edited by Simon Bridge; 05-19-2005 at 07:59 AM.
I notice that if I want indigo-prime to access everything in hauora3, I'd have to set up Hauora3 as the NFS server - and export the root directory. Hauora3 has not those modules ... ho hum. So instead I'm using indigo-prime as the NFS server, and exporting a directory called /home/sharenfs (So maybe I can also have a directory called /home/sharesmb for samba later...)
In this way I can happily swap files backwards and forwards.
In Hauora3 I mount the share using ...
# mount -t nfs indigo-prime:/home/sharenfs /home/sharenfs
(presumably all the hosts on a network could do this, and thus share files amongst the lot of them... like a drop box. Only the server has the "real" /home/sharenfs ... is that right? Comment?)
However - while the share does mount OK - the mount command dosn't exit. The curser moves to a new line as if it expects an additional command. (I don't get the input prompt back...) I can exit the terminal ... but this is kinda like what happens when I start a text editor from terminal (gedit /etc/hosts) ... the command dosn't exit until the terminal is quit.
So I guess there is a program running from this terminal and I have to unmount the nfs share to exit.
Maybe the problem will go away if I configure fstab to load the share at boot?
I am also speculating that I can use the same "share" directory for samba too - then linux and windows systems will share the same set of files ... unless windows can also see NFS shares - but I don't see how (no mount command in windows). It would be a neat way to give linux systems on the network an exclusive share ...
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.