What is the necessary hardware to connect two computers in a LAN configuration?
Linux - HardwareThis forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?
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.
If you want to let the machines connect with each other you have to know the IPs for those machines. So you either have to tell the router that the specific machines always get the same IPs from its DHCP server or you use static IPs for those machines.
In my network (about 16 machines) I use a mixed approach, the Windows machines of my friends get their IPs from the DHCP server of the router, since they don't have the need to let their machines communicate (except with the file-server). My machines (all Linux) have static IPs.
I don't use aliases or something similar, just plain static IPs, set up with NetworkManager on the Slackware systems and /etc/network/interfaces on the CLI-only Debian machine.
If you want to let the machines connect with each other you have to know the IPs for those machines. So you either have to tell the router that the specific machines always get the same IPs from its DHCP server or you use static IPs for those machines.
In my network (about 16 machines) I use a mixed approach, the Windows machines of my friends get their IPs from the DHCP server of the router, since they don't have the need to let their machines communicate (except with the file-server). My machines (all Linux) have static IPs.
I don't use aliases or something similar, just plain static IPs, set up with NetworkManager on the Slackware systems and /etc/network/interfaces on the CLI-only Debian machine.
OK. I use (or my ISP uses) DHCP. But the ISP only provides dynamic IPs. Can dynamic IPs work in my case?
nice to know it, but is a bit late for me (I needed wireless anyway - bought mine in a supermarket WallMart-like nearby my home, in a non-business day :P)
Distribution: Ubuntu 11.4,DD-WRT micro plus ssh,lfs-6.6,Fedora 15,Fedora 16
Posts: 3,233
Rep:
Quote:
Originally Posted by stf92
OK. I use (or my ISP uses) DHCP. But the ISP only provides dynamic IPs. Can dynamic IPs work in my case?
what your ISP does in this instance is irrelevant, as that simply provides your INTERNET facing address
a typical home setup would look something like this
Code:
+-
| {ISP}
|external |
|(public /
|facing IP) |
| <coax>[modem]<ethernet>
+- (DHCP ASSIGNED) |{dhcp server, or pass-through dhcp from ISP}
| |
| |{router obtains dhcp from modem or ISP)
| |
|internal | {dhcp server in router firmware}
|(private network) <wan>[router (with built-in switch]<sw1><sw2><sw3><sw4><wifi>
|(separate IP address from public network) | | | ^(wifi signal)
| | | |
| [PC1] [PC2][game console]
|
| (wifi signal) v v
| [Laptop] [tablet]
+- {devices obtain dhcp from router}
(yes a typical hous probably wouldn't have THAT many devices, but that's just an illustration)
in this case, the IP your computer(s) has is separate from the one your ISP hands you and the communication between the internet and your devices is handled by the router, this is referred to as a NAT (network address translation)
this also has the added benefit of preventing any unwanted traffic from entering your network (as any inbound traffic has to be explicitly assigned a computer before it is allowed in) (this is called port-forwarding)
granted a significant portion of households are more like
Code:
<ISP>---/---<modem>---[PC]
where the pc would perhaps get it's IP from either the modem or the ISP directly, but the trend is moving more and more towards the above as people have more than one internet connected device (pcs, tablets, laptops, game consoles, blu-ray players etc...
Thanks a lot. For the moment I prefer simplicity over effectiveness. So, the hardware conditions are now:
A question: what is, or how do I do an alias of the type eth0:0 192.168.1.1. From the man page for ifconfig, I can do 'ifconfig eth0 <some address>'. Do you mean the alias builtin command?
there is example from my old rc.alias file
#!/bin/sh
#setting up IP alias interfaces
echo "Setting 172.16.41.2, 172.16.41.3, 172.16.41.x IP Aliases ..."
/sbin/ifconfig lo 127.0.0.1
/sbin/route add -net 127.0.0.0 netmask 255.0.0.0 lo
/sbin/ifconfig eth0 up
/sbin/ifconfig eth0 172.16.41.2
if you can do net aliase, you can write string similar this ( for your situation) in /etc/rc.d/rc.local file. after restart it can be done setting aliase.
PS aliases not using "in security reasons" - contrary, configuration with cable modem and local machines in one switch is some insecure way to do all. for security networks must be separated and filtereed throught iptables with correct rules.
aliases is used for assign more than one ip address to one ethernet interface. sometimes it be need...
For the moment I prefer simplicity over effectiveness
A router, instead of a switch, is "dead-simple" to setup: it comes with a step-by-step guide very easy to follow (and cam be a wifi-router, providing a Access Point to any wireless device, like nowadays phones and tablets)
Distribution: Ubuntu 11.4,DD-WRT micro plus ssh,lfs-6.6,Fedora 15,Fedora 16
Posts: 3,233
Rep:
interesting, however i fail to see where interface aliases has ANYTHING to do with the OP's question, the answer is a simple,
modem-router/switch-pc1/2, done
maybe one or both machines need static IP address, but still each machine needs only ONE IP address per machine, interface aliases here would be superfluous.
Quote:
Originally Posted by WiseDraco
there is example from my old rc.alias file
#!/bin/sh
#setting up IP alias interfaces
echo "Setting 172.16.41.2, 172.16.41.3, 172.16.41.x IP Aliases ..."
/sbin/ifconfig lo 127.0.0.1
/sbin/route add -net 127.0.0.0 netmask 255.0.0.0 lo
/sbin/ifconfig eth0 up
/sbin/ifconfig eth0 172.16.41.2
if you can do net aliase, you can write string similar this ( for your situation) in /etc/rc.d/rc.local file. after restart it can be done setting aliase.
PS aliases not using "in security reasons" - contrary, configuration with cable modem and local machines in one switch is some insecure way to do all. for security networks must be separated and filtereed throught iptables with correct rules.
aliases is used for assign more than one ip address to one ethernet interface. sometimes it be need...
interesting, however i fail to see where interface aliases has ANYTHING to do with the OP's question, the answer is a simple,
modem-router/switch-pc1/2, done
maybe one or both machines need static IP address, but still each machine needs only ONE IP address per machine, interface aliases here would be superfluous.
and what way then, one of machines can be in the same time get internet via cable modem ( connect to computer via ethernet) and connection to another local computer? without aliases or buying second NIC for that computer?
DESCRIPTION
host is a simple utility for performing DNS lookups. It is normally used to convert names to IP addresses and vice versa. When no arguments or options
are given, host prints a short summary of its command line arguments and options.
name is the domain name that is to be looked up. It can also be a dotted-decimal IPv4 address or a colon-delimited IPv6 address, in which case host
will by default perform a reverse lookup for that address. server is an optional argument which is either the name or IP address of the name server
that host should query instead of the server or servers listed in /etc/resolv.conf.
Distribution: Ubuntu 11.4,DD-WRT micro plus ssh,lfs-6.6,Fedora 15,Fedora 16
Posts: 3,233
Rep:
Quote:
Originally Posted by WiseDraco
and what way then, one of machines can be in the same time get internet via cable modem ( connect to computer via ethernet) and connection to another local computer? without aliases or buying second NIC for that computer?
think about what you're asking for a moment.
you can't plug more than one device into ONE physical port, no matter how many aliases that port HAS, you need a switch.
a router can hand numbers via DHCP and has a built in switch, which covers BOTH requirements, both machines talk to each other, AT LEAST one has internet.. note the original verbiage was AT LEAST ONE, not ONLY ONE.
anyone who says anything about interface aliases are over-complicating the matter for someone who already admits to being a novice.
the next step would be to learn to flash DD-WRT or openwrt on the router and learn how to use iptables to DENY internet access to the other one, but that's a project perhaps for the future.. get the simplest setup working FIRST, then make it more complicated.
OK. I have just called (not trying to contradict anyone) my technician and he says: with the modem and the switch you can do the following: communicate one computer to the other, with one of them enjoying internet (or even the other one too if I remember well). But the machine with internet must be on all the time. That is, if I turn it off, I can't use the other.
Let that be so. Then I do not need anything else. Every time I enter the room with the computers, I just turn "the one" on, and voila! Now, how to set up the software to do it, is something I do not know yet, but methinks it must be extremely easy.
... But the machine with internet must be on all the time. That is, if I turn it off, I can't use the other.
...
that is why people usually buy a cheap low-power wifi-router (so they dont have to keep their expensive pc on 24/7 and burn electricity).
as far as software goes maybe if you post the output of lspci, ifconfig, ifconfig -a ... of the pc sharing the internet connection maybe someone can suggest a method of getting online on both pc's (the link i provided in my first response to this thread details what i did to get my blu-ray player (netflix/ pandora) to work thru my htpc).
Distribution: Ubuntu 11.4,DD-WRT micro plus ssh,lfs-6.6,Fedora 15,Fedora 16
Posts: 3,233
Rep:
Quote:
Originally Posted by stf92
OK. I have just called (not trying to contradict anyone) my technician and he says: with the modem and the switch you can do the following: communicate one computer to the other, with one of them enjoying internet (or even the other one too if I remember well). But the machine with internet must be on all the time. That is, if I turn it off, I can't use the other.
Let that be so. Then I do not need anything else. Every time I enter the room with the computers, I just turn "the one" on, and voila! Now, how to set up the software to do it, is something I do not know yet, but methinks it must be extremely easy.
to be more clear, the little Linksys routers you buy off the shelf are in fact nothing more than heavily customized, purpose built computers, designed to do one task and one only, and that is to provide communication between one network (the computers in your house) and another (the internet in this case), but at their most fundamental they are a computer, the advantage though is they are cheaper, and consume far less power than a PC, and require far less configuration than a general purpose computer as most of the work has been done by the manufacturer of the device.
most home routers are just plug and go and should work sufficiently out of box to satisfy the average home user, with that, you can have BOTH machines plugged into the router
the reason for this being, as the technician said, the modem is
Quote:
Originally Posted by technician
with the modem and the switch you can do the following: communicate one computer to the other, with one of them enjoying internet
enter the router, which i already told you was a computer, it acts as a middle man between the router and your other computers, like a person in a bucket brigade, the computer hands the router the data, which then forwards it on to the modem, which then hands the reply to the router, which is forwarded to the proper computer.
essentially the router talks to the modem and 'hides' the rest of rest of the computers behind insofar as the modem thinks there is only one computer in your house as the modem can only see the router, it can't see past the router.
they talk to each other, and both talk to the internet.
you can have one or both on as long as the router and modem have power you have internet.
simple as that.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.