New function: Static and DHCP IP settings

226 views
Skip to first unread message

Kai

unread,
Jul 23, 2012, 6:48:28 AM7/23/12
to webc-...@googlegroups.com
Hello Group,

because I needed webconverger to get an IP via static configuration and
DHCP I edited the script /etc/web/network-up.d/resolvconf in this way:

#!/bin/bash

source /etc/webc/webc.conf

`cmdline_has ip`
if [ $? -eq 0 ]; then
IP=$(cmdline_get ip)
MASK=$(cmdline_get netmask)
GATEWAY=$(cmdline_get gateway)
echo "
auto eth0 lo
iface lo inet loopback

iface eth0 inet static
address $IP
netmask $MASK
gateway $GATEWAY" > /etc/network/interfaces
fi

cmdline_has dns || exit 0

cat /etc/resolv.conf | sed '/nameserver/d' > /etc/resolv.conf.tmp

for i in $(cmdline_get dns)
do
IFS=,; for dns in $i
do
echo nameserver $dns
done
done >> /etc/resolv.conf.tmp

mv -f /etc/resolv.conf /etc/resolv.conf.old
mv -f /etc/resolv.conf.tmp /etc/resolv.conf
chmod 644 /etc/resolv.conf

Now it's possible for me to use ip, netmask, gateway, dns as boot
parameters and without these DHCP is used. Perhaps this is interesting
for someone and perhaps Kai Hendry wants to insert it into webconverger.
This changes require a change of system startup so now they are
S04resolvconf, S05networking and S06timezone. No changes for other
services.

With best regards,
Kai

Kai Hendry

unread,
Jul 31, 2012, 10:01:39 AM7/31/12
to webc-...@googlegroups.com
Hi there Kai,

What a beautiful name... :)


I'm keen not to duplicate code for setting up a static IP. A use case
I constantly ask myself, why do people use these inflexible static IP
setups?

We have dns= support already and I've been experimenting with
re-enabling live-boot and its ip= interface which should do the trick:
http://webconverger.org/networking/

It's not perfect, though my proposal falls back onto tested (you would
think) Debian code.

WDYT?

Kind regards,

Kai

unread,
Aug 1, 2012, 4:15:01 AM8/1/12
to webc-...@googlegroups.com
Hi Kai,

I agree that duplicate code is not desirable. On the one hand I think
using Debian Live code for this use case whould be better but on the
other hand it's not really easy to read and use. So would it be possible
that you create a converter "ip=XX netmask=XX gateway=XX" to Debian Live
format?

My use case is that I have to create one image for several universities
and hospitals with different DHCP and static IP configurations. Therefor
I created a boot menu with entries for each institute.

Kind regards
Kai

Arnd Behring

unread,
Aug 1, 2012, 5:17:26 AM8/1/12
to webc-...@googlegroups.com
Hello Kai,

On Tue, 31 Jul 2012 16:01:39 +0200
Kai Hendry <hen...@webconverger.com> wrote:
> I'm keen not to duplicate code for setting up a static IP. A use case
> I constantly ask myself, why do people use these inflexible static IP
> setups?

I did not quite follow the discussion on the technical side, but I
wanted to give a short input on the topic of why people (might) use
static IP configurations:

As you mentioned many times before, static IP addresses are inflexible
and not desirable for client PCs in most of the cases. The problem is
that you don't always have control over the network environment in which
you need to deploy the kiosk system. Therefore, you don't always have
the option to deploy a DHCP server along with your kiosk.

An example: Shortly before a five day conference it turned out that the
conference venue did not have any WiFi access and no public internet
terminals either. The venue did not allow us to bring our own WiFi
access point or anything similar. After long-winded discussions it was
settled that it was okay for us to bring two PCs with a kiosk system
that only allowed web access. Since their network ran a static IP
configuration with no DHCP server, I had to modify Webconverger to
accommodate this scenario. Setting up our own DHCP server would have
been off limits.

TL;DR: Not everybody uses Webconverger in their own network and
therefore might need static IPs.

Regards
Arnd

--
"When cryptography is outlawed, bayl bhgynjf jvyy unir cevinpl."
-- Anonymous

Kai Hendry

unread,
Aug 1, 2012, 6:31:41 AM8/1/12
to webc-...@googlegroups.com
On 1 August 2012 10:15, Kai <webcon...@wff-gaming.de> wrote:
> it's not really easy to read and use. So would it be possible that you
> create a converter "ip=XX netmask=XX gateway=XX" to Debian Live format?

I guess so, though the API ip= would obviously conflict with ip= of
live-boot's functionality and I'm not that convinced it's "easier to
use". If something is left out, it will be a problem. It also
pollutes/clutters the busy cmdline.

IIUC live-boot tries to implement the "mimick official kernel
boot param specification". I'm not sure where this specification
actually lives.

http://live.debian.net/gitweb?p=live-boot.git;a=blob_plain;f=manpages/en/live-boot.7
is the latest doc. Which is hard to read unless run through troff,
like so:

ip=[DEVICE]:[CLIENT_IP]:[SERVER_IP]:[GATEWAY_IP]:[NETMASK]:[HOSTNAME]:[AUTOCONF]
Let you specify the name(s) and the options of the
interface(s) that should be configured at boot time. Do
not specify this if you want to use dhcp (default). It
will be changed in a future release to mimick official
kernel boot param specification (e.g.
ip=10.0.0.1::10.0.0.254:255.255.255.0::eth0,:::::eth1:dhcp).

The example is misleading. I'm not sure what AUTOCONF means. Anyway it
would be good try use this instead and let us know where it falls
down, functionality wise.

> My use case is that I have to create one image for several universities and
> hospitals with different DHCP and static IP configurations. Therefor I
> created a boot menu with entries for each institute.

Understood.


Thanks for the input!

Kai

unread,
Aug 3, 2012, 4:31:57 AM8/3/12
to webc-...@googlegroups.com
Am 01.08.2012 12:31, schrieb Kai Hendry:
> On 1 August 2012 10:15, Kai <webcon...@wff-gaming.de> wrote:
>> it's not really easy to read and use. So would it be possible that you
>> create a converter "ip=XX netmask=XX gateway=XX" to Debian Live format?
> I guess so, though the API ip= would obviously conflict with ip= of
> live-boot's functionality and I'm not that convinced it's "easier to
> use". If something is left out, it will be a problem. It also
> pollutes/clutters the busy cmdline.
I agree with that except that it not easier to use. I think "ip=XX
netmask=XX gateway=XX" is much easier than
"ip=[DEVICE]:[CLIENT_IP]:[SERVER_IP]:[GATEWAY_IP]:[NETMASK]:[HOSTNAME]:[AUTOCONF]".
If the user only have to press Enter to boot the system it makes no
difference of course.
>
> IIUC live-boot tries to implement the "mimick official kernel
> boot param specification". I'm not sure where this specification
> actually lives.
>
> http://live.debian.net/gitweb?p=live-boot.git;a=blob_plain;f=manpages/en/live-boot.7
> is the latest doc. Which is hard to read unless run through troff,
> like so:
>
> ip=[DEVICE]:[CLIENT_IP]:[SERVER_IP]:[GATEWAY_IP]:[NETMASK]:[HOSTNAME]:[AUTOCONF]
> Let you specify the name(s) and the options of the
> interface(s) that should be configured at boot time. Do
> not specify this if you want to use dhcp (default). It
> will be changed in a future release to mimick official
> kernel boot param specification (e.g.
> ip=10.0.0.1::10.0.0.254:255.255.255.0::eth0,:::::eth1:dhcp).
>
> The example is misleading. I'm not sure what AUTOCONF means. Anyway it
> would be good try use this instead and let us know where it falls
> down, functionality wise.
>
I'll try it in a free minute.
Reply all
Reply to author
Forward
0 new messages