EmonPI set static IP address.

Hi.

I need to give static IP address to my EmonPI, I want to configure the IP, Netmask, Gateway and DNS server myself.

I was thinking that this kind options would appear on the web interface since I don't want mess with the command line if possible, but there is a lack of network configuration on the web interface.

Should I configure the networking based on the Raspbian methods?

I also noticed that the rasp-config (or something like that) command gives errors on some settings, like to one to extend the file system to the card size (my card is 8Gb). Can't I do this and other configs that give errors?

Best Regards.

 

Robert Wall's picture

Re: EmonPI set static IP address.

Is not the IP address allocated by your router, and it's there that you make it static?

Paul Reed's picture

Re: EmonPI set static IP address.

As Robert has said, go to your router configuration and set up a fixed IP address from there.
What precisely is the error reported when you try to expand the file system?

Paul

CidiRome's picture

Re: EmonPI set static IP address.

Hi

My Router is a Linux server and I can assign a static IP address if I want, but on the EmonPI side it will still being a dynamic IP address received by DHCP.

I want to configure the EmonPI so it has always the same IP address even when the Router is not available so it can still communicate with other computers on the network.

It is so basic that I can't believe that the option isn't available.

Best Regards.

CidiRome's picture

Re: EmonPI set static IP address.

About the expand problem: I get that the root partition is not the last one (or something like that)

Best Regards.

pb66's picture

Re: EmonPI set static IP address.

The warnings you get from raspi-config are due to the 3rd "data" partition, raspi-config is only geared up to handle a basic 2 partition system and doesn't know how to proceed with the additional partition. Aside from a lot of other possible decisions, the foremost one is apportioning the available space. This is a decision you will need to make yourself and adjust the split as you see fit.

To "expand" the filesystem you will need to do it manually using fdisk or gparted from the command line or if using a graphical desktop on the Pi the gparted gui is easy to use. Basically you need to

1) create a 4th partition,

2) Copy the 3rd partition to the 4th partition

3) Delete the 3rd partition

4) Reboot so that the "new" partition that was 4 is now recognized as 3.

See "RaspB+ and SD card Extend" for step by step info and/or if you need more info on sizing I will help if I can.

Setting the Pi to use static IP settings is extensively documented on the web, I don't think you can do it through the emoncms wifi module, but most of the actual configuration is just writing it into /etc/network/interfaces once you figure out what it is exactly you want, which a gui wouldn't do anyway. so using a command line editor shouldn't be much of a hurdle once you figure out the rest.

Paul

 

Bill Thomson's picture

Re: EmonPI set static IP address.

Is not the IP address allocated by your router, and it's there that you make it static?

That's one way. That'll give you what's termed a static DHCP address. To assign the Pi a static address, modify /etc/network/interfaces like so:

auto eth0

iface eth0 inet static

address 192.168.x.x
netmask 255.255.255.0
gateway 192.168.y.y

Substitute the desired IP adress for x.x and your gateway address for y.y

 

CidiRome's picture

Re: EmonPI set static IP address.

Thank you for your replies.

Basically I must configure it like I would configure a pure Raspbian.

It is no problem for me to do that, my problem was the possibility that the configuration could be controlled by emonCMS somewhere I couldn't find and in the end I could have my own configuration overwritten by it like other integrated systems do (I believed that FreePBX for Rasp does that).

I will configure it my way.

About the partitions:
Can I mount the SD card elsewhere and do the resize offline?

Best Regards.

Paul Reed's picture

Re: EmonPI set static IP address.

Can I mount the SD card elsewhere end do the resize offline?

Yes, no problem doing that, I used a Debian 'live disk' on my Windows laptop, and made changes with the SD card directly on the laptop using the graphical interface.

Paul

CidiRome's picture

Re: EmonPI set static IP address.

Hi.

I just wasted a lot of time because the root file system is configured as Read-Only.

Obviously this denies password changes and most other configuration changes since /etc seems to be in the same file system.

In order to be able to accomplish the configurations the above instruction must be preceded with:

sudo mount -rw -o remount /

I believe that most errors I was getting while making configurations with raspi-config where also related with this configuration of EmonPi

Best Regards.

stevenma's picture

Re: EmonPI set static IP address.

Hi CidiRome,

Dependent upon your router's interface you can often 'reserve' a DHCP IP address so that the device (e.g. EmonPi) that has xyz MAC address always gets your chosen IP address.  Take a look at this link which is how I did it in my Billion 7800n router:

http://www.billion.uk.com/esupport/index.php?/Knowledgebase/Article/View/268/14/how-do-i-configure-my-7800-series-router-to-assign-a-static-ip-to-a-computer-via-dhcp

You should choose an IP address that's outside of the DHCP range, in my case 192.168.1.100-250 and avoid the gateway which might typically be 192.168.1.1 or .254 and any other fixed / static IP device addresses of course.  

You can usually find your MAC address in the DHCP table of devices in your router.

I use this facility on my SONOS speakers as they don't have a management interface and I've found that the connection is more stable if I assign a static IP address based on the speaker's MAC address.

I hope that helps.

Regards,

Steve 

CidiRome's picture

Re: EmonPI set static IP address.

Thank you for the information.

I know that... but...

If enomPI is started when the router is unavailable it won't have IP address since the router/dhcp server isn't there to attribute it.

Note: I use the term router but, as I said, it is a Linux (not that it stops being a router because it is a Linux), and the Linux is far more powerful that most/any commercial router.

Best Regards.

pb66's picture

Re: EmonPI set static IP address.

Hi CidiRome, 

All the emonSD images are purposely configured as read-only to avoid accidental or unauthorised/wanted editing of system files, so yes any form of editing on a "read-only" filesystem will require a "switch to write-mode" (ie remounting) so all the images have the "rpi-rw" and "rpi-ro" commands to facilitate easy "switching".

Most raspi-congig settings will complain about the read-only filesystem with a "unauthorised" or "unable to access/write to" type message unless rpi-rw is used first eg

rpi-rw

sudo raspi-config

 .... make adjustments and exit

rpi-ro

a little easier than remounting the partition, however this will not alter the issue you specifically raised about raspi-config, the rootfs is not the last partition, the RW "data" partition is the 3rd partition and raspi-config is written to deliberately not attempt any changing of partitions unless very basic, we have seen it many times hence the other threads.

Paul

CidiRome's picture

Re: EmonPI set static IP address.

Hi.

Thank you for the information, is really useful.

I haven't analyzed what goes into each partition, so this question may be pertinent.

The raspi-config will enlarge the 3rd partition, in the case on EmonPi system is it still the 3rd partition the one we should enlarge? Is it still there that are stored the information like the MysqlDB/MariaDB and the logs?

Best Regards.

pb66's picture

Re: EmonPI set static IP address.

Partition 1 is the standard "/boot" partition, 2 is the main Raspbian "root" filesystem, normally this is read & write, but on an emonSD image it is doctered to be read-only and therefore the "data" files ie emoncms/emonhub conf file, SQL tables php data feeds etc all get written to a newly added 3rd partition and the "extra" partition count makes raspi-config unsure how to proceed so it does nothing. No you cannot use it on the 3rd partition either.

the image is usually around 4gb and of that 1gb is the data partition (and ~58mb for partition 1 ) going upto an 8gb SDcard gives you an extra 4gb, how you dispense that is up to you, if you are not using the emonPi for anything else but logging data then the filesystem won't grow much wre as the data probally will, by how much depends on how frequently you record, hoe many nodes/sensors you have and the number of feeds etc.

I would probably split the extra 50/50 for simplicity and even distribution etc. so your 3rd "data" partition would be the last 3gb and the root file system partition could be increased to fill the gap ~5gb and then the actual filesytem itself expanded to fill the 5gb partition.

The linked thread guides you through the "add 4th partition and delete 3rd" command line method and if doing that you must make sure you crate the same type etc. If you have access to a linux desktop you can mount the sdcard to or a keyboard and screen you can use on the Pi I would recommend using the gparted gui tool, you can literally "see" the partion size and position, then just edit it to the size and position you want and gparted will do all the work behind the scenes when changes are commited. it is so much easier and insightful so in future you can visualise it in your mind and do it via the command line easier.

Paul

CidiRome's picture

Re: EmonPI set static IP address.

Hi.

Thanks for the details.

I'm used to do that kind of operations, usually on windows.

I will test if AOMEI Partition editor (or other ones I usually use on windows) can deal with Linux partitions, and if not I will use Gparted.

Best Regards

CidiRome's picture

Re: EmonPI set static IP address.

Hi.

I've done the partition resizing using a VBox with a live linux and GParted, very easy.

I tried with AOMEI but got unsure about the partitions, but I belive it could also work.

Best Regards.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.