WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Persistent Static IP  (Read 22026 times)

Offline ashok.das8

  • Newbie
  • *
  • Posts: 3
Persistent Static IP
« on: August 03, 2012, 01:17:05 AM »
Hi all,

I am very new to tiny core. It came into my attention when i tried to create a virtual network of computers inside vmware. I installed in HD in vmware and it works fine. I just wanted to know how do I keep the static IPs assigned to interfaces after reboot. This question may looks like stupid but for a newbie like me its do or die situation. I am experienced with Ubuntu and it took my cli skills away but now I am back to stick with cli. 

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11594
Re: Persistent Static IP
« Reply #1 on: August 03, 2012, 01:25:19 AM »
Hi ashok.das8
Open the control panel and click on the  Network button.  Enter your settings and click  Apply. A script called
/opt/eth0.sh will be created to setup your network connection. A line will be added to  /opt/bootlocal.sh  to
call that script every time you boot.

Offline ashok.das8

  • Newbie
  • *
  • Posts: 3
Re: Persistent Static IP
« Reply #2 on: August 03, 2012, 12:40:38 PM »
Thank you for the replay. I am sorry that I could not make myself clear. Actually I am using CLI version and i dont want to install any GUI. So how to achieve the same in CLI?

Offline tinypoodle

  • Hero Member
  • *****
  • Posts: 3857
Re: Persistent Static IP
« Reply #3 on: August 03, 2012, 12:54:15 PM »
"ifconfig <interface> <address>"
"Software gets slower faster than hardware gets faster." Niklaus Wirth - A Plea for Lean Software (1995)

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11594
Re: Persistent Static IP
« Reply #4 on: August 03, 2012, 01:00:48 PM »
Hi ashok.das8
Createan  /opt/eth0.sh  script containing:
Code: [Select]
#!/bin/sh
pkill udhcpc
ifconfig eth0 192.168.1.30 netmask 255.255.255.0 broadcast 192.168.1.255 up
route add default gw 192.168.1.1
echo nameserver 68.237.161.12 > /etc/resolv.conf
echo nameserver 71.243.0.12 >> /etc/resolv.conf
Change the addresses to match your system.
Make it executable like this:
Code: [Select]
sudo chmod 775 /opt/eth0.shThe  route  line is the gateway (your router) and the last two lines are name servers.
Add this to your  /opt/bootlocal.sh  file:
Code: [Select]
/opt/eth0.sh
« Last Edit: September 14, 2012, 08:47:33 AM by Rich »

Offline ashok.das8

  • Newbie
  • *
  • Posts: 3
Re: Persistent Static IP
« Reply #5 on: August 04, 2012, 08:32:38 AM »
Hi Rich
I did as you told but there is another thing, whenever i restart the system, the file eth0.sh is missing. I have /tce directory in /dev/sda1/tce. Now i think i am missing something in persistence. I have following in boot

kernel /boot/vmlinuz quiet tce=hda1

what could have gone wrong?


Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11594
Re: Persistent Static IP
« Reply #6 on: August 04, 2012, 08:41:05 AM »
Hi ashok.das8
That should be   kernel /boot/vmlinuz quiet tce=sda1

Offline sebus

  • Jr. Member
  • **
  • Posts: 96
Re: Persistent Static IP
« Reply #7 on: February 04, 2013, 03:33:03 PM »
One needs to edit /opt/.filetool.lst

and add

/opt/eth0.sh

Add above script to startup script /opt/bootlocal.sh

Edit /opt/shutdown.sh

#!/bin/sh
# put user shutdown commands here
/usr/bin/filetool.sh -b

Now static IP stays as expected

As per this tutorial
« Last Edit: February 04, 2013, 03:39:35 PM by sebus »

Offline Stef

  • Newbie
  • *
  • Posts: 1
Re: Persistent Static IP
« Reply #8 on: August 10, 2013, 05:37:03 PM »
Hi,

I'm new to Tiny Core linux, and I have the same problem as descibed here. I can't keep my IP setting after a reboot. I only have CLI, and trying all of the above doesn't help. All my modifications get erased, whatever I try. I'm running TC in a VM in VirtualBox to simulate hosts on a vlab.

Regards,
Stef

Offline gerald_clark

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 4254
Re: Persistent Static IP
« Reply #9 on: August 10, 2013, 09:00:20 PM »
You need a persistent tce directory so you can run backup to save your changes.
Please check the wiki.