Press "Enter" to skip to content

Linux Quickie: Persistent Static IP Address on Tiny Core Linux

Roberto Leon 0

For most of my labs, I use Tiny Core Linux VMs, which is a popular option because it’s a very small, fast, and easy Linux box to power-on and get on with your testing without wasting much time. Specifically, I like to use a custom OVA built by Maciej Jedrzejczyk called yVM, you can read more about it on his post. He also has a step-by-step post explaining how to do it yourself right here, but I’m lazy, so I just have the OVA laying around on my vCenter Content Library. The OVA is based on an old Tiny Core Linux version, but for quick labs, it more than enough.

However, setting up a persistent static IP address on this little box it’s a bit different from other Linux distributions because it boots directly to RAM and does not have the most common networking packages installed. So, let’s make a quick script with the basic tools available and make it persistent.

  1. Create the script file vi /opt/eth0.sh and input the following:
#!/bin/sh

# Kill the micro dhcp client (μDHCPc)
pkill udhcpc

# Set your IP address, gateway, and name server
ifconfig eth0 192.168.1.5 netmask 255.255.255.0 broadcast 192.168.1.255 up
route add default gw 192.168.1.1
echo nameserver 1.1.1.1 >> /etc/resolv.conf

  1. Set permissions and make it executable sudo chmod 775 /opt/eth0.sh (I just used the same permissions applied to the other files on the same directory.)
  1. Add the new script to the following two(2) files:
sudo echo '/opt/eth0.sh' >> /opt/.filetool.lst
sudo echo '/opt/eth0.sh &' >> /opt/bootlocal.sh
  1. Backup/save your new configuration to make it persistent:
filetool.sh -b

If I missed or you have any questions for something I didn’t cover, please comment below.

Reference: Tiny Core Linux Forums


Subscribe to get notified of new content!

Processing…
Success! You're on the list.

[Disclaimer]

The views and opinions expressed on this site are my own and do not reflect the views and opinions of my employer. Roberto Leon is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com.

About Author

Leave a Reply

Your email address will not be published. Required fields are marked *