0

I tried to create a network so that I can see my pi's output anywhere from within the network.

One pi has the data/ output.

I tried to send the data to another pi which acts as a router(connection via ethernet).

Initially, I could access my first pi's data through an already established network.

Now, I created a new network using another pi, but still when I connect the two pi's via ethernet I could not access the output of first pi and I could not even connect to the network i created.

I'm new to raspbian. So far, what I have done? I did it by following some tutorials.

Please help me how to connect two pi's: one which acts as router and other acts as source of information I want to access.

  • Punctuation is mandatory! – Milliways Jul 12 '18 at 9:40
  • There is one pi working as router, will name it pi-router and there is a pi-host. pi-router is connected via wifi to your internet router and has access to the internet, isn't it? pi-host is connected to pi-router with an ethernet cable. Shall pi-host have access to the internet? – Ingo Jul 16 '18 at 21:27
1

I'm only doing this as an answer because there's not enough room in a comment.

You need to give us a little more detail on how you configured the network interfaces on your 2 Pis; "connected via ethernet" just describes mechanical/electrical linkages. So let's start there: are the Pis directly connected to each other? If so, it's a near-certainty you will need what is called a crossover cable. If they are both plugged into a switch/hub, then normal cables will work.

How are the Pis getting their IP addresses assigned to them? Static or DHCP? If DHCP do you have a DHCP server configured and running? Etc., etc.

To see what state things are in, start by typing "ifconfig" at a command prompt. I'm running Pi 3b+'s so I have wired and wireless interfaces. The output (edited for brevity) looks like this:

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.0.18  netmask 255.255.255.0  broadcast 192.168.0.255
        inet6 fe80::fa16:d1bc:af35:efbd  prefixlen 64  scopeid 0x20<link>
        ether b8:27:eb:61:0b:4e  txqueuelen 1000  (Ethernet)

wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.0.19  netmask 255.255.255.0  broadcast 192.168.0.255
        inet6 fe80::12ae:3de8:6f41:b6ce  prefixlen 64  scopeid 0x20<link>
        ether b8:27:eb:34:5e:1b  txqueuelen 1000  (Ethernet)

Things to notice:

  1. We will ignore the lo interface that also is displayed, that's just loopback and all machines have it.

  2. The flags for both interfaces include "UP", which means they are configured and active.

  3. The inet line a) exists, and b) shows the IPv4 address. Note that eth0 (the wired interface) and wlan0 (the WiFi interface) have different IPv4 addresses. No 2 interfaces on any given network can have the same IP address; that only leads to tears.

  4. The inet6 line shows the IPv6 address. Again, all addresses must be different. (I'm an Old Guy, so I mostly focus on IPv4.)

So you a) need to have different IP addrs for each interface, b) they need to be on the same network, in this case 192.168.0.x, c) they need to be "UP".

If those three things are true on each Pi, try typing ping <IP addr> on one machine and see if it works. Then go to the other machine and try to ping the first one. If both pings work, then you're good. If either or both fail, then you have some work to do.

Now you need to answer all of the above questions before we can begin to tell you why you Pis aren't talking to each other.

Oh, one last thing: you talk about using 1 Pi as a router. Routers, by definition, need 2 interfaces to different networks. Pis only have 1 wired connection, so ... are you planning on using WiFi to connect to your other net? You can worry about that later; first you have to deal with all of the above kerfuffle.

| improve this answer | |
  • crossover cables never required nowadays. All interfaces are able to negotiate this. Your configuration example shows eth0 and wlan0 being on the same network. Routing will not work with this. – Ingo Jul 13 '18 at 9:52
  • @Ingo - Yes, I know my 2 interfaces are on the same network. That's because the ifconfig dump is from a property automation server, not a router. I also don't assume that an RJ45 supports Auto MDI-X. It's nice when they do, but you can tear your hair out if they don't and you don't know about this. – Peter Rowell Jul 13 '18 at 16:44
  • We are talking about Raspberry Pi and they do support Auto MDI-X :-) Never had problems connecting it direct to my laptop and to the switch using the same ethernet cable. So for a newbie it may be confusing worrying about cross over he doesn't need. – Ingo Jul 13 '18 at 21:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.