B4J Question Solved: Raspberry on multiple networks

udg

Expert
Licensed User
Longtime User
Hi all,

generally my RasPI is on private LAN with address 192.168.1.xx where xx is a fixed static address.
From time to time I have to move it to a different LAN that uses 192.168.178.xx address.

I tried the alias scheme on interface eth0 but it did'nt work (the board is unreachable).

I can't use the DHCP protocol, so I need to set the config file in a way that on RasPI boot it is assigned the right address for the LAN it is on at that time.
Only one address will be active at any time.

Have you any hint?

TIA

Umberto
 

udg

Expert
Licensed User
Longtime User
Ok, it seems I solved the problem.

I had to avoid the eth0:0 aliasing technique and go with a newer way to config the network interfaces.
So now my /etc/network/interfaces config file looks something like the following:

B4X:
auto lo
iface lo inet loopback

auto eth0
allow-hotplug eth0

iface eth0 inet static
address 192.168.1.77
netmask 255.255.255.0
gateway 192.168.1.1

iface eth0 inet static
address 192.168.178.77
netmask 255.255.255.0

I hope you may find the above useful.

Umberto
 
Upvote 0
Top