LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
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 11-18-2017, 09:35 AM   #1
NotionCommotion
Member
 
Registered: Aug 2012
Posts: 789

Rep: Reputation: Disabled
Network between two computers


I have a Raspberry Pi and have connected a USB Ethernet. I configured it to use my LAN and plugged it into my router, and can ping and SSH using the connection from other machines on my LAN.

Now that I know it is working, I am trying to do my end goal, and connect to it from another machine (either Ubuntu or Windows, and ideally ability to do with both) without a router. While I've read that a crossover cable is not required with most modern hardware, I am using one "just in case".

I've tried configuring the RPi network to both be on my LAN and on a different LAN and have met no success.

Please provide recommendations. Thank you
 
Old 11-18-2017, 10:07 AM   #2
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195

Rep: Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043
You should be more specific.

Does the Pi have more than one IP address now?
Is it on different subnets? (like 192.168.20.10 and 192.168.300.10)?
What are the subnet masks used on the Pi and all other machine which you try to connect?
What are the IP's of the other machines on the "different" subnet?
Is there anything like a firewall between the Pi and the hosts you are using?

A crossover cable is not required. You say your had already communication.
Why do you use a USB<->eth. I though (almost) all Pi's have ethernet. Or does this model not?

jlinkels

Edit: did you connect all ethernet cables to a router, or to a switch? Note that routers like your ADSL modem often have 4 ethernet ports on the LAN end which act as a switch.

Last edited by jlinkels; 11-18-2017 at 10:09 AM.
 
Old 11-18-2017, 10:46 AM   #3
NotionCommotion
Member
 
Registered: Aug 2012
Posts: 789

Original Poster
Rep: Reputation: Disabled
Hi jlinkels,

My home network is: Coax-----Modem-----Router1 (10.120.11.1)------Router2 (192.168.1.1)

The Pi's on-board Ethernet (eth0) has a static IP of 10.120.11.30 (I recognize my submask is likely not idea) and is connected to one of the 4 Ethernet ports of Router1. This part is not relevant.

If I set up the Pi's USB Ethernet (eth1) to use static IP of 192.168.1.222 and connect it to one of Router2's switches, I can connect to it from any machine connected to Router2's other switches.


Code:
michael@rpi:~ $ ip route
default via 10.120.11.1 dev eth0  metric 202
default via 192.168.1.1 dev eth1  metric 203
10.120.11.0/24 dev eth0  proto kernel  scope link  src 10.120.11.30  metric 202
192.168.2.0/24 dev eth1  proto kernel  scope link  src 192.168.1.222  metric 203
michael@rpi:~ $ ifconfig -a
eth0      Link encap:Ethernet  HWaddr b8:27:eb:77:55:11
          inet addr:10.120.11.30  Bcast:10.120.11.255  Mask:255.255.255.0
          inet6 addr: fe80::ab8c:e035:53c4:84c9/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:4483 errors:0 dropped:0 overruns:0 frame:0
          TX packets:3956 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:760719 (742.8 KiB)  TX bytes:678749 (662.8 KiB)

eth1      Link encap:Ethernet  HWaddr 00:05:1b:b1:2c:45
          inet addr:192.168.1.222  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::b867:2c83:b71b:3a6d/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:704 errors:0 dropped:0 overruns:0 frame:0
          TX packets:88 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:160548 (156.7 KiB)  TX bytes:17502 (17.0 KiB)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

michael@rpi:~ $ cat /etc/dhcpcd.conf
clientid
persistent
option rapid_commit
option domain_name_servers, domain_name, domain_search, host_name
option classless_static_routes
option ntp_servers
require dhcp_server_identifier
slaac private
nohook lookup-hostname

interface eth0
static ip_address=10.120.11.30/24
static routers=10.120.11.1
static domain_name_servers=10.120.11.1

interface eth1
static ip_address=192.168.1.222/24
static routers=192.168.1.1
static domain_name_servers=192.168.1.1

michael@rpi:
Code:
michael@michael-HP-EliteBook-2570p:~$ ping 192.168.1.222
PING 192.168.1.222 (192.168.1.222) 56(84) bytes of data.
64 bytes from 192.168.1.222: icmp_seq=1 ttl=64 time=1.02 ms
64 bytes from 192.168.1.222: icmp_seq=2 ttl=64 time=4.13 ms
^C
Now, I wish to disconnect the Pi's USB Ethernet from router2 and use an Ethernet cable to go directly between the Pi's USB Ethernet and some other machine's Ethernet connection. The IPs and masks can be whatever is desired.

Thanks for your help.
 
Old 11-18-2017, 10:57 AM   #4
NotionCommotion
Member
 
Registered: Aug 2012
Posts: 789

Original Poster
Rep: Reputation: Disabled
Hello again jlinkels, I just made the RPi 192.168.2.222 and the other machine 192.168.2.220, and now it works perfect. I must have just typed something wrong.
 
Old 11-18-2017, 11:02 AM   #5
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,702

Rep: Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895
Typically the network adapters are configured using DHCP so that when connected to a LAN the router automatically assigns an IP address.

However when connected directly together you have to assign a static IP address on each machine which means every time you switch networks you need to reconfigure everything.

A second option is using zeroconf link local addressing which hopefully Ubuntu and Windows still configures by default. When the DHCP client can not find a server it will default to assigning an address in the 169.254.0.0/16 subnet. So by just connecting the computers together they will "automatically" be networked. No reconfiguration necessary when plugged back into your router.

You should be able to configure zeroconf on the Pi by installing avahi.

https://www.raspberrypi.org/forums/v...ic.php?t=34860

While the Ubuntu PC should have avahi installed and be able to browse you will need to configure the windows PC for local name resolution.
https://blogs.technet.microsoft.com/...me-resolution/
 
Old 11-18-2017, 11:46 AM   #6
NotionCommotion
Member
 
Registered: Aug 2012
Posts: 789

Original Poster
Rep: Reputation: Disabled
Thanks michaelk, Just installed iTunes on Windows, and all works perfect!

https://learn.adafruit.com/bonjour-z...linux/overview describes installing:
Code:
sudo apt-get install avahi-daemon
https://www.raspberrypi.org/forums/v...ic.php?t=18207 describes installing which will also install avahi-daemon:
Code:
sudo apt-get install libnss-mdns
I might have installed this in the past and forgot as both were already installed. Or maybe they come by default with Rasputian? Looks like https://packages.debian.org/jessie/libnss-mdns would have been required if not already installed.
 
Old 11-18-2017, 06:18 PM   #7
Shadow_7
Senior Member
 
Registered: Feb 2003
Distribution: debian
Posts: 4,137
Blog Entries: 1

Rep: Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874
Unless you setup dhcp server stuff you have to setup several parts manually.

1) the IP of the local interface
2) the gateway / routing (the ip of the remote interface)
3) DNS entries (/etc/resolv.conf in most cases for linux)

With various equivalent and probably more difficult to get to parts in other OSes. Where dhcp would probably work out of the box and handle all that for you.

If you have two networking interfaces and want to forward them you also need to change /proc/sys/net/ipv4/ip_forward to 1 (default is 0) to enable it. And without functional bridging you need to masquerade the connection in iptables / netfilter for the WAN facing interface.

As I look at my networking setup with the ISP to an asus rt-n12. Most everything else within hands reach etherneted to a micro 5 port switch attached to a banana pi m3, which does the wifi to the rt-n12. This gives me 4 usable ethernets within arms reach (1 of 5 is used by the BPi m3). Only 10/100 ports in this case, but the ISP is pretty slow. The rough equivalent of client_bridge with ddwrt that I used to do on an asus rt-n16 (which I gave to my dad).
 
  


Reply



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
why AM I seeing other computers that are not in my network? Vincent13 Linux - Networking 5 08-21-2014 10:59 PM
Can not see other computers, network storage drive & printer on the network vinitp Linux - Networking 2 10-13-2013 09:21 PM
computers on network ashishag Linux - Networking 2 12-16-2006 08:53 AM
how to network 2 computers glena General 7 07-03-2006 01:47 AM
How to see other computers on the network Hevener Linux - Newbie 2 11-14-2002 04:39 PM

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

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