Static IP and DNS on RaspberryPi with lora gateway os


#1

Hey guys,

trying to set static ip and dns for eth0 on Raspberry Pi3 with lora full Gateway os installed.
I managed to set the ip via ifconfig but it’s always lost after rebooting the PI.

I also edited the “interfaces file” under /etc/Network with:

from Default iface eth0 inet dhcp
to:

iface eth0 inet static
adress xx.xx.xx.xx
netmask xx.xx.xx.xx
network xx.xx.xx.xx
gateway xx.xx.xx.xx

But it wont work.

Is there another config file for doing this or do i have to activate the interface file?

Greetings and thanks

freedom67


#2

Hi,

FYI: https://www.raspberrypi.org/forums/viewtopic.php?t=221060


#3

More specifically: https://www.raspberrypi.org/forums/viewtopic.php?t=221060#p1357512


#4

Thank you but the regular ways wont work as the Gateway OS Runs on an older Version of Linux.
But we found a way by adding a bash script to the System Startup:

#!/bin/sh
DESC=“FIX NETWORK”

case “$1” in
start)
echo “Starting $DESC”
ifconfig eth0 “ip” netmask “mask” up
;;
stop)
echo “Stopping $DESC”
do_stop
;;
restart|force-reload)
echo “Restarting $DESC”
do_stop
sleep 1
do_start
;;
*)
echo “Usage: $0 {start|stop|restart|force-reload}” >&2
exit 1
;;
esac

exit 0

CLI:
raspberrypi3:/etc/init.d# ./network start
Starting FIX NETWORK
raspberrypi3:/etc/init.d# sysctl
raspberrypi3:/etc/init.d# chmod 755 network
raspberrypi3:/etc/init.d# update-rc.d network defaults
Adding system startup for /etc/init.d/network.
raspberrypi3:/etc/init.d# ll /etc/init.d/network

FYI ! This topic can get closed.