I'm doing some remastering of Lubuntu 14.04 LiveCD, and need to run the following command at startup:
/sbin/ifconfig eth0 10.10.10.1 netmask 255.255.0.0
First, I tried modifying rc.local as follows:
#!/bin/sh -e # # rc.local /sbin/ifconfig eth0 10.10.10.1 netmask 255.255.0.0 exit 0
Execution bit was set via:
chmod +x /etc/rc.local
That didn't work, so I tried writing this bash script (which I set to executable) and placing it in /usr/bin/
#!/bin/bash /sbin/ifconfig eth0 10.10.10.1 netmask 255.255.0.0
In conjunction with the above action, I modified rc.local thus:
#!/bin/sh -e # # rc.local /usr/bin/myscript exit 0
Didn't work. Keeping the bash script in /usr/bin/, I edited /etc/xdg/lxsession/Lubuntu/autostart with this line:
This, too, failed to produce the desired result. Have I made a mistake with something I've tried, or is there something else I should be doing?
I've been unable to figure out how to utilize the casper parameters mentioned in Elder Greek's answer. Any further help on that front would be greatly appreciated.
The comments in the link he/she posted turned out to be helpful, though. One commenter pointed out that the bash script located at /usr/share/initramfs-tools/scripts/casper-bottom/23networking can be edited to assign a static ip to eth0.
The commenter also mentions editing the /etc/network/interfaces file, which is what I did. It works, but at a price: a lengthy delay at bootup while waiting on the network to configure. Here are the relevant bits:
auto eth0 iface eth0 inet static address 10.xxx.xxx.xxx netmask 255.255.255.0 gateway 10.xxx.xxx.xxx
default live label live say Booting an Ubuntu Live session... kernel /casper/vmlinuz append file=/cdrom/preseed/ubuntu.seed boot=casper initrd=/casper/initrd.lz quiet splash ip=frommedia --
In my experience, what normally happens is that, regardless of what changes you make to the network/interfaces file, when the LiveCD boots, it's forced to a default state by the 23networking bash script I mentioned prior. The ip=frommedia edit at the end of isolinux.cfg forces the script to use whatever is present in the network/interfaces file.
As the commenter mentioned, the 23networking script can be edited to set a static ip. If anyone can help me with that (not so good with bash scripting), that would be great.