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
 
LinkBack Search this Thread
Old 05-13-2005, 03:09 AM   #1
Simon Bridge
Guru
 
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu 10.04
Posts: 9,196

Rep: Reputation: 190Reputation: 190
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 )
 
Old 05-13-2005, 03:23 AM   #2
jschiwal
Moderator
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,263

Rep: Reputation: 562Reputation: 562Reputation: 562Reputation: 562Reputation: 562Reputation: 562
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.
 
Old 05-13-2005, 06:06 AM   #3
baldy3105
Member
 
Registered: Jan 2003
Location: Cambridgeshire, UK
Distribution: SuSe 9.2 & 10, Gentoo, knoppix, DSL
Posts: 769

Rep: Reputation: 101Reputation: 101
Easy peasy, crossover ethernet cable =

1-3
2-6
3-1
6-2

If you don't know, pin one is on the left hand side if you hold an RJ45 plug with the pins upwards and facing you.
 
Old 05-13-2005, 07:58 AM   #4
Simon Bridge
Guru
 
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu 10.04
Posts: 9,196

Original Poster
Rep: Reputation: 190Reputation: 190
Ah yes ... there's no point sticking in to in and out to out to guys. Until there are more machines, I don't see the point of a hub/switch.
 
Old 05-13-2005, 08:47 AM   #5
jordanthompson
Member
 
Registered: Oct 2004
Posts: 115

Rep: Reputation: 15
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.)
 
Old 05-13-2005, 11:09 PM   #6
teckk
Senior Member
 
Registered: Oct 2004
Distribution: FreeBSD Arch
Posts: 1,410

Rep: Reputation: 104Reputation: 104
http://www.hardwarebook.net/
http://www.hardwarebook.net/cable/ne...crossover.html

If you want to make your own cables.
 
Old 05-14-2005, 06:24 AM   #7
Simon Bridge
Guru
 
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu 10.04
Posts: 9,196

Original Poster
Rep: Reputation: 190Reputation: 190
Quote:
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.
 
Old 05-19-2005, 05:59 AM   #8
Simon Bridge
Guru
 
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu 10.04
Posts: 9,196

Original Poster
Rep: Reputation: 190Reputation: 190
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!)
 
Old 05-19-2005, 06:53 AM   #9
scowles
Member
 
Registered: Sep 2004
Location: Texas, USA
Distribution: Fedora
Posts: 620

Rep: Reputation: 30
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?
 
Old 05-19-2005, 06:53 AM   #10
teckk
Senior Member
 
Registered: Oct 2004
Distribution: FreeBSD Arch
Posts: 1,410

Rep: Reputation: 104Reputation: 104
Are you trying to ping the other machine by Name or by IP address.
Code:
ping 192.168.1.15
Could be a DNS issue.

Also is your netword card configured correctly, correct module loaded or in kernel. What do you get with as root
Code:
ifconfig
Does your network card show up in as root
Code:
lspci
You may need to /sbin/lspci
 
Old 05-19-2005, 06:55 AM   #11
Simon Bridge
Guru
 
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu 10.04
Posts: 9,196

Original Poster
Rep: Reputation: 190Reputation: 190
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.
 
Old 05-19-2005, 07:04 AM   #12
Simon Bridge
Guru
 
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu 10.04
Posts: 9,196

Original Poster
Rep: Reputation: 190Reputation: 190
OK: the two machines are called "indigo-prime" (this one) and "hauora3" (other one)... the domain is "subether.net".

subether.net is 192.168.23.0, indigo-prime is 100 and hauora3 is 42. The netmask is the std class C: 255.255.255.0 ... am not using IPv6

The nics were set up via Red Hat's network interface control daemon ... which took ages, but it wrote /etc/hosts OK.

I just now set the route via:
# /route add -net 192.168.23.0 netmask 255.255.255.0 eth0

in both machines - this stopped the ping trying to use the modem, which is probably the default route.

...........
post edit

Huh - I had a load more info - but see the next post!

Last edited by Simon Bridge; 05-19-2005 at 07:41 AM.
 
Old 05-19-2005, 07:37 AM   #13
Simon Bridge
Guru
 
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu 10.04
Posts: 9,196

Original Poster
Rep: Reputation: 190Reputation: 190
Haha! I was wrong!

It was the firewall on hauora3 that was to blame!

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.
 
Old 05-20-2005, 01:29 AM   #14
Simon Bridge
Guru
 
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu 10.04
Posts: 9,196

Original Poster
Rep: Reputation: 190Reputation: 190
Right: got NFS file sharing going.

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 ...

This is fun
 
  


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Connecting two computers without a hub/switch/router? pilot1 Linux - Networking 8 07-15-2008 04:31 AM
How to detect whether a hub or switch is used ? antonypaul Linux - Networking 1 12-02-2005 08:47 AM
Error occurred when changing from hub to switch onionkn1ght Linux - Software 4 09-09-2004 04:05 PM
connect switch to hub? ody1 Linux - Networking 3 04-12-2004 08:42 AM
10/100 Mbps Hub/Switch Question WeNdeL Linux - Networking 4 01-13-2004 02:52 PM


All times are GMT -5. The time now is 01:14 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
Open Source Consulting | Domain Registration