Ethernet connection from Maya to Pi

Questions about cabled networking
Forum rules
Before you post please read how to get help

Ethernet connection from Maya to Pi

Postby rjg on Mon Dec 24, 2012 10:55 am

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.
rjg
Level 1
Level 1
 
Posts: 1
Joined: Mon Dec 24, 2012 10:50 am

Linux Mint is funded by ads and donations.
 

Re: Ethernet connection from Maya to Pi

Postby billmc on Sun Dec 30, 2012 3:23 pm

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.
billmc
Level 1
Level 1
 
Posts: 40
Joined: Sat Dec 29, 2012 7:22 pm


Return to Ethernet

Who is online

Users browsing this forum: No registered users and 6 guests