Opened 4 years ago
debirf should be able to use kernel parameters to preconfigure network
|Reported by:||dkg||Owned by:||jrollins|
Pavel Piatruk writes:
I suggest to write init-script which will parse /proc/cmdline and
will create /etc/network/interfaces with founded IP address, netmask and
gateway. Then we should put this init-script before /etc/init.d/networking.
So kernel could be booted like this
vmlinuz eth0-ip=192.168.20.20 eth0-gateway=192.168.20.1 \ eth0-netmask=255.255.255.0 eth0-dns=192.168.20.1:192.168.20.1
I think that recompilation of whole image to adjust these network settings (in
case there is no dhcp) is expensive operation.
This seems like a useful feature to me, because it would let administrators share a debirf image across a range of hosts which they would rather not use DHCP for.
I wonder whether it would be more useful to prebuild /etc/network/interfaces or to simply use /bin/ip to configure the given interface directly. Using /bin/ip would enable a more compact CIDR notation for address/netmask.
and i think the DNS setting (and maybe the gateway?) should be NIC-independent.
So my vision of a parseable /proc/cmdline might look like:
vmlinuz ip-addr-eth0=192.168.20.20/24 ip-gateway=192.168.20.1 dns-nameserver=192.168.20.1
which would translate into the following commands at boot:
ip addr add 192.168.20.20/24 dev eth0 ip route add default via 192.168.20.1 echo "nameserver 192.168.20.1" >> /etc/resolv.conf