Ethernet connection from Maya to Pi

Questions about Wi-Fi and other network devices, file sharing, firewalls, connection sharing etc
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
rjg

Ethernet connection from Maya to Pi

Post by rjg »

I have Linux Mint Maya running on my home machine. It has a wireless connection using dhcp to my ISP's router. The connection was detected automatically when I installed Maya, and works. The router is pingable on 192.1681.254, and is visible via traceroute google.com. It generally allocates address 192.168.1.65 to the Maya machine.

I have a Raspberry Pi. Initially I connected it via ethernet to the ISP router, and it also worked. I have now connected it to the machine running Maya, using Ethernet. I set the ethernet connection on the Pi to 192.168.2.2, mask /24, gateway 192.168.2.1. I set the ethernet connection on the Maya machine using

ifconfig eth0 192.168.2.1

This allows me to ssh to the Pi, but the configuration is lost when I reboot the Maya machine.

When I ssh to the Pi, I can ping 192.168.2.1 and 192.168.1.65, but nothing else.

I would like to extend the capabilities of the ethernet connection. I cannot find a combination of settings in "Network Connections" in the Control Centre which brings eth0 up automatically on boot, nor which allow the Pi to ping anything more distant.

After some reading around, I saw advice that /etc/sysctl.conf under Maya should have net.ipv4.ip_forward=1 . I have set it, and it remains set after rebooting.

I have read some a few posts here and elsewhere about this type of problem, but I have not been able to find anything that I can understand which obviously solves the problem. Apologies for posting a query which doubtless has an answer somewhere here.
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
billmc

Re: Ethernet connection from Maya to Pi

Post by billmc »

To begin with, I have no idea what a Pi is, but that shouldn't matter because this is an IP question.
I also do not understand why you want to directly connect the Pi gizmo directly to your Maya box, rather than allwoing the Pi to connect to the router and access Maya via the network.

You are going to have to educate yourself on using IPTABLES. What you have described, to me, sounds like your Maya box has 2 networks setup. A 192.168.1.xxx network, via wireless to your router (wlan0) and a second network 192.168.2.xxx via eth0. It also sounds as if you are using a crossover cable between the Maya box and the Pi, which would be correct. The Maya box, can see and knows where each of its 2 networks are located. Via dchp, it has been assigned and address and a default route (via your router, 192.168.1.254) to access any other network it does not know about. If you ping the 192.168.2.x network, it knows it has to go out the eth0 connection, any other address will send it out the wlan0 connection to the router and let the router figure out where it needs to go from there.

In the Pi, a similar thing is happeneing, it sees everything on the 192.168.2.x network, and lacking any other directions, will go out the 192.168.2.x connection trying to find what its looking for. The problem is that it stops when it hits the Maya box. You need to set the Maya box up as a router, that's what net.ipv4.ip_forward=1 is doing. But more than that needs to be done, this is accomplished via IPTABLES, to forward, accept, and reject packets.

I'm gonna take a guess at why you're going directly from one to the other, rather than through the router; I'll guess its speed, 1 Gbps vs 300 Mbps. If that's the case, plug both boxes directly into your router via a cable, they'll both be on the same network, can see each other, and will acquire their routing information from the router via dhcp. (I've had problems with both my wlan and eth cards connecting to the same network at the same time. It sometimes gets confused as to which is the default, thus causing long periods of time to elaspe before making its mind up which way to go, so I've stopped using both. It can be done, I'm just to lazy to put the effort into doing it.)

Bottom line, if you want the Pi to be connected to the Maya box, then to connect to any other network, you'll need to config the Maya box as a router using IPTABLES.
Locked

Return to “Networking”