Assign Static IP to kiosk

Here you can post about the issues related to modifications performed manually (not through the kiosk wizard). Example: swapped kernel, added 3rd party modules or files.
Please describe in detail what has been changed and hopefully other kiosk user will be able to help.
Porteus team wont resolve bugs posted in this category as we support only modifications made by the kiosk wizard.
Forum rules
Porteus Kiosk section of the forum is unmaintained now. Its kept in a 'read only' mode for archival purposes.
Please use the kiosk contact page for directing your queries: https://porteus-kiosk.org/contact.html
rh102801
Black ninja
Black ninja
Posts: 51
Joined: 21 Mar 2014, 14:02
Distribution: porteus 3.7 kiosk
Location: Chattanooga

Assign Static IP to kiosk

Post#1 by rh102801 » 09 Jul 2014, 13:49

Could someone point me in the right direction as to what file I need to modify to assign a static IP address as well as a unique hostname to each of my kiosks? Because of all the customizations I have done I don't want to use the Wizard.
I tried creating an rc.inet1.conf file and placing it in the rootcopy/etc/rc.d directory with the following information but it did not work:

# Config information for eth0:
IPADDR[0]="192.168.23.130"
NETMASK[0]="255.255.255.0"
USE_DHCP[0]=""
DHCP_HOSTNAME[0]="Testkiosk"


Thanks in advance

User avatar
fanthom
Moderator Team
Moderator Team
Posts: 5666
Joined: 28 Dec 2010, 02:42
Distribution: Porteus Kiosk
Location: Poland
Contact:

Re: Assign Static IP to kiosk

Post#2 by fanthom » 09 Jul 2014, 14:56

Hi Raul,

kiosk wont understand this config and you must do everything in commands. please add this code to /etc/rc.d/rc.local (make it executable) so it will run as last:

Code: Select all

#!/bin/sh

killall dhcpcd 2>/dev/null
ifconfig eth0 192.168.23.130 netmask 255.255.255.0
route add default gw gateway_IP eth0              #change gateway_IP to your gateway
hostname Testkiosk
Please add [Solved] to your thread title if the solution was found.

rh102801
Black ninja
Black ninja
Posts: 51
Joined: 21 Mar 2014, 14:02
Distribution: porteus 3.7 kiosk
Location: Chattanooga

Re: Assign Static IP to kiosk

Post#3 by rh102801 » 09 Jul 2014, 17:36

Thanks fanthom
As usual excellent instructions. I tested this and the IP address part worked great however the Hostname didn't take as it is still using the default "porteus" hostname.

Do you have any ideas as to why it is not recognizing that hostname?

Thanks

User avatar
fanthom
Moderator Team
Moderator Team
Posts: 5666
Joined: 28 Dec 2010, 02:42
Distribution: Porteus Kiosk
Location: Poland
Contact:

Re: Assign Static IP to kiosk

Post#4 by fanthom » 09 Jul 2014, 19:40

it works for me:
i have logged through ssh, ran 'hostname test' command and hostname changed from 'porteus' to 'test' immediately.
please make sure you have 'hostname some_name' and not 'Hostname some_name' in your rc.local.
Please add [Solved] to your thread title if the solution was found.

rh102801
Black ninja
Black ninja
Posts: 51
Joined: 21 Mar 2014, 14:02
Distribution: porteus 3.7 kiosk
Location: Chattanooga

Re: Assign Static IP to kiosk

Post#5 by rh102801 » 09 Jul 2014, 20:10

ok so I am a little confused.... I created a custom ISO using the wizard and installed in on a machine. I tried looking at the rc.local file to see how it was using the hostname provided during the wizard but there is no rc.local.

Would it use different files when using the Wizard?
I also tried creating an ISO from the Wizard and then modifying it with my NTP customization and local HTML files but when I mount the ISO I don't see the porteus directory I was expecting. I do see boot, docs, make_iso.sh, xzm. On version 3.0 I would see boot and porteus when mounting the ISO so work with it.

Is version 3.1 somehow different from 3.0 as far as what the ISO contains?

Sorry if this is a stupid question, I just didn't expect to see this when mounting the ISO

Thanks

rh102801
Black ninja
Black ninja
Posts: 51
Joined: 21 Mar 2014, 14:02
Distribution: porteus 3.7 kiosk
Location: Chattanooga

Re: Assign Static IP to kiosk

Post#6 by rh102801 » 09 Jul 2014, 20:11

Fanthom I just saw your last post... I'll install that image once again and double check... I have been trying different versions to see if I could figure it out.

I'll post again as soon as I've tested.

Thanks

User avatar
fanthom
Moderator Team
Moderator Team
Posts: 5666
Joined: 28 Dec 2010, 02:42
Distribution: Porteus Kiosk
Location: Poland
Contact:

Re: Assign Static IP to kiosk

Post#7 by fanthom » 10 Jul 2014, 08:52

I tried looking at the rc.local file to see how it was using the hostname provided during the wizard but there is no rc.local.
you have to create one. i'll add a blank rc.local to next release so people will know where to put their custom commands.
thanks
Is version 3.1 somehow different from 3.0 as far as what the ISO contains?
yes - kiosk 3.1 is a major upgrade over 3.0 and you should have a look on the changelog i posted:
http://porteus-kiosk.org/changelog-releases.html

please mind especially this part:
- Kiosk ISO content was simplified with three folders only: /boot, /docs and /xzm.
- PXE boot does not support /rootcopy functionality so this folder was removed. From now on all files must be kept in the xzm modules.
(no more /rootcopy).
Please add [Solved] to your thread title if the solution was found.

rh102801
Black ninja
Black ninja
Posts: 51
Joined: 21 Mar 2014, 14:02
Distribution: porteus 3.7 kiosk
Location: Chattanooga

Re: Assign Static IP to kiosk

Post#8 by rh102801 » 10 Jul 2014, 12:16

Thanks for the reply.... Sorry I admit I hadn't read what the changes were and I guess I should've started there.
rh102801 wrote:- Kiosk ISO content was simplified with three folders only: /boot, /docs and /xzm.- PXE boot does not support /rootcopy functionality so this folder was removed. From now on all files must be kept in the xzm modules.
This explains a lot... I kept thinking I had done something wrong with my ISO :)
I guess I'll read over the documentation when I get a chance to familiarize myself with all the changes.

Thanks Again

rh102801
Black ninja
Black ninja
Posts: 51
Joined: 21 Mar 2014, 14:02
Distribution: porteus 3.7 kiosk
Location: Chattanooga

Re: Assign Static IP to kiosk

Post#9 by rh102801 » 10 Jul 2014, 13:19

fanthom wrote:it works for me:
i have logged through ssh, ran 'hostname test' command and hostname changed from 'porteus' to 'test' immediately.
please make sure you have 'hostname some_name' and not 'Hostname some_name' in your rc.local.
I am not sure if we are on the same page.... I can run hostname TestKiosk on my system from ssh as well and it will change the name right away but I was expecting the name to be what I have on rc.local. See below for my system's config:

root@porteus:~# cat /etc/rc/d/rc.local
#!/bin/sh

ifconfig lo up
ntpdate pool.ntp.org
sh /etc/rc.d/rc.ntpd start

killall dhcpd 2>/dev/null
ifconfig eth0 192.168.23.130 netmask 255.255.255.0
route add default gw 192.168.23.1 eth0
hostname TestKiosk

I expected the system to show root@TestKiosk based on the entries above. If I manually change the hosname like you described earlier:
root@porteus:~# hostname TestKiosk
root@TestKiosk:~#

This is expected behaviour however this is a manual change from SSH and is not persistant as rebooting the machine will bring it back to root@porteus:~#

Does this make sense? I am not sure if I am conyeing my thoughts in the right way. My thought is that by entering the line hostname TestKiosk in the rc.local, the system would take that name on bootup however it is coming up as porteus:

root@porteus:~# hostname
porteus

Changing it manually from an ssh session won't be a persistent change and the system will default back to porteus on reboot.

I hope this makes sense

Thanks

User avatar
fanthom
Moderator Team
Moderator Team
Posts: 5666
Joined: 28 Dec 2010, 02:42
Distribution: Porteus Kiosk
Location: Poland
Contact:

Re: Assign Static IP to kiosk

Post#10 by fanthom » 10 Jul 2014, 13:55

yes - it makes sense :)
i wanted to check if changing hostname is working ok when done manually. you have a correct command in rc.local but a mistake in 'killing dhcpcd' line.
please use this:

Code: Select all

killall dhcpcd 2>/dev/null
also - please login through ssh and run 'ps' to make sure that dhcpcd is really killed.
Please add [Solved] to your thread title if the solution was found.

rh102801
Black ninja
Black ninja
Posts: 51
Joined: 21 Mar 2014, 14:02
Distribution: porteus 3.7 kiosk
Location: Chattanooga

Re: Assign Static IP to kiosk

Post#11 by rh102801 » 10 Jul 2014, 16:02

duh... Me and my typing skills :)

I have tried correcting the line and recreated the ISO but now the system is not booting..... I will try creating the ISO again and will let you know how it goes.


Thanks again for all your help

rh102801
Black ninja
Black ninja
Posts: 51
Joined: 21 Mar 2014, 14:02
Distribution: porteus 3.7 kiosk
Location: Chattanooga

Re: Assign Static IP to kiosk

Post#12 by rh102801 » 11 Jul 2014, 19:51

Ok, so I finally got around to working on this again. I corrected my typo and created a new ISO, installed it and when I boot the system, my homepage tells me cannot connect to the server. I figured out this is due to the fact that we killed dhcpcd and I have not defined a DNS server anywhere so I can't resolve webpages by name, they work if I use IP address. Would I define a DNS server on rc.local as well?

The other thing is even after correcting the typo on my rc.local entries, the hostname I defined is still not being used. Do you have any other ideas on this?

root@porteus:~# cat /etc/rc.d/rc.local
#!/bin/sh

ifconfig lo up
ntpdate pool.ntp.org
sh /etc/rc.d/rc.ntpd start

killall dhcpcd 2>/dev/null
ifconfig eth0 192.168.23.130 netmask 255.255.255.0
route add default gw 192.168.23.1 eth0
hostname TestKiosk

I think I might dedicate my weekend on trying to figure out how to port my ntp customizations to the new 3.1 kiosk (I am going to miss rootcopy) since I can use the wizard to create an image for any of the devices I have and would get rid of this problem easily although I still don't understand why it is not using the hostname at all.

Thanks

User avatar
fanthom
Moderator Team
Moderator Team
Posts: 5666
Joined: 28 Dec 2010, 02:42
Distribution: Porteus Kiosk
Location: Poland
Contact:

Re: Assign Static IP to kiosk

Post#13 by fanthom » 11 Jul 2014, 20:03

Would I define a DNS server on rc.local as well?
yes - please add this code at the begining of rc.local:

Code: Select all

echo 'nameserver 8.8.4.4' > /etc/resolv.conf
even after correcting the typo on my rc.local entries, the hostname I defined is still not being used. Do you have any other ideas on this?
i think it's still dhcpcd playing role so we could add some sleep before running 'hostname xxx' but it will be better to not start dhcpcd at all. please edit /etc/rc.d/rc.M and comment out these lines:

Code: Select all

# Initialize the networking hardware:
for x in `ls /sys/class/net | egrep -v 'sip|lo'`; do
    dhcpcd -L -t 0 $x >/dev/null 2>&1 &
done
now you can also drop 'killall dhcpcd 2>/dev/null' from your rc.local.

it must work now :)
Please add [Solved] to your thread title if the solution was found.

rh102801
Black ninja
Black ninja
Posts: 51
Joined: 21 Mar 2014, 14:02
Distribution: porteus 3.7 kiosk
Location: Chattanooga

Re: Assign Static IP to kiosk

Post#14 by rh102801 » 14 Jul 2014, 14:04

Thanks for the instructions. I looked at the rc.M file on my test system and this is what it has for the line you mentioned:

# Initialize the networking hardware:
[ -x /etc/rc.d/rc.inet1 ] && . /etc/rc.d/rc.inet1

Also I found this line:
# Set hostname:
hostname porteus

Could the hostname not be changed in this file instead?


Thanks

User avatar
fanthom
Moderator Team
Moderator Team
Posts: 5666
Joined: 28 Dec 2010, 02:42
Distribution: Porteus Kiosk
Location: Poland
Contact:

Re: Assign Static IP to kiosk

Post#15 by fanthom » 14 Jul 2014, 18:16

Could the hostname not be changed in this file instead?
probably it could. please do it and check (feel free to experiment with kiosk a bit).
Please add [Solved] to your thread title if the solution was found.

Locked