WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: [SOLVED] Ip address is not permanent?  (Read 4619 times)

Offline plug

  • Newbie
  • *
  • Posts: 29
[SOLVED] Ip address is not permanent?
« on: November 18, 2014, 12:07:50 PM »
Sorry if I post the same post already revived, but unfortunately I find myself in the same situation as many and seamless.

After I configure the PC with TCL, for example:

- Ifconfig eth0 192.168.10.1 netmask 255.255.255.0 broadcast 192.168.10.255 up
- Route add default gw 192.168.10.1;

.. Network is seen in the PC with the command 'ping'.

Unfortunately, this does not remain after rebooting the PC.
I do not know how to solve it, and if anyone knows the solution can help me?

Thanks to the solution.
« Last Edit: November 24, 2014, 01:52:03 PM by plug »

Offline gerald_clark

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 4254
Re: Ip address is not permanent?
« Reply #1 on: November 18, 2014, 12:14:50 PM »
If you use the Network program from cpanel, the configuration will be added to bootlocal.sh and saved at backup time.
If you want to do it yourself then you need to add it to bootlocal.sh yourself also.

Offline plug

  • Newbie
  • *
  • Posts: 29
Re: Ip address is not permanent?
« Reply #2 on: November 18, 2014, 12:40:00 PM »
Hi Gerald,

how do I backup? I've never had a way to use it

Offline gerald_clark

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 4254
Re: Ip address is not permanent?
« Reply #3 on: November 18, 2014, 12:46:04 PM »

Offline plug

  • Newbie
  • *
  • Posts: 29
Re: Ip address is not permanent?
« Reply #4 on: November 21, 2014, 10:12:31 AM »
I wrote in bootlocal.sh manual configuration:
sudo ifconfig eth0 192.168.10.1 netmask 255.255.255.0 broadcast 192.168.10.255 up
sudo route add default gw192.168.10.1

I did backup in cpanel is now everything !!!

Thanks Gerald

Offline xyz-worx

  • Jr. Member
  • **
  • Posts: 69
Re: Ip address is not permanent?
« Reply #5 on: November 21, 2014, 10:32:45 AM »
Hi plug,

as fas as I know, commands in bootlocal.sh are executed with root access permission.
'sudo' should not be necessary.

regards
   xyz-worx

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 7183
    • My Community Forum
Re: Ip address is not permanent?
« Reply #6 on: November 21, 2014, 10:37:36 AM »
I wrote in bootlocal.sh manual configuration:
sudo ifconfig eth0 192.168.10.1 netmask 255.255.255.0 broadcast 192.168.10.255 up
sudo route add default gw192.168.10.1

You are missing /etc/resolv.conf
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."

Offline plug

  • Newbie
  • *
  • Posts: 29
Re: Ip address is not permanent?
« Reply #7 on: November 22, 2014, 12:43:01 PM »
thanks xyz-worx and bmarkus,

already done...but i have a huge problem:
it isn't permanent the file /etc/hosts.
I written the file bootlocal.sh the content of file hosts but .. nothing. It it is not written.

I attempted with also with root privilege, but nothing ....know how to do this?

Thanks

Offline gerald_clark

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 4254
Re: Ip address is not permanent?
« Reply #8 on: November 22, 2014, 01:20:39 PM »
We can't identify the problem when you don't show us what you have done.
Show us your bootlocal.sh.
Instead of writing files in bootlocal.sh, why not add the modified files to .filetool.lst and do a backup ?

Offline plug

  • Newbie
  • *
  • Posts: 29
Re: Ip address is not permanent?
« Reply #9 on: November 22, 2014, 01:40:05 PM »
ok,

bootlocal.sh
------------------------
#!/bin/sh
ifconfig eth0 192.168.10.1 netmask 255.255.255.0 broadcast 192.168.10.255 up
route add default gw 192.168.10.1

echo pc1 > /etc/hostname
echo 127.0.0.1 localhost localhost.local > /etc/hosts
echo 192.168.10.1 pc1 > /etc/hosts
echo 192.168.10.2 pc2 > /etc/hosts

echo nameserver 192.168.10.1 > /etc/resolv.conf

/opt/eth0.sh &

Offline gerald_clark

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 4254
Re: Ip address is not permanent?
« Reply #10 on: November 22, 2014, 01:55:04 PM »
Your echo stuff > /etc/hosts overwrites the file.
Just include

echo 192.168.10.1 pc1 >> /etc/hosts
echo 192.168.10.2 pc2 >> /etc/hosts

And leave the original contents alone.
Note the use of >> instead of >.

Unless you have configured a nameserver on this machine, you cannot have it be its own nameserver.

Why are you manually setting the IP address and then running /opt/eth0 ?

Offline plug

  • Newbie
  • *
  • Posts: 29
Re: Ip address is not permanent?
« Reply #11 on: November 24, 2014, 01:19:48 PM »
ok, i deleted /opt/eth0 and it is the same for the script.

Sorry, i don't understand the meaning of '>>' Can you explain to me better on symbol, gerald?

 

Offline gerald_clark

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 4254
Re: Ip address is not permanent?
« Reply #12 on: November 24, 2014, 01:26:37 PM »
It is very basic.
http://linux.die.net/man/1/ash  lookup redirections

Also Linux basics
http://rute.2038bug.com/index.html.gz

Offline plug

  • Newbie
  • *
  • Posts: 29
Re: Ip address is not permanent?
« Reply #13 on: November 24, 2014, 01:50:34 PM »
in the meantime, I solved.
The PCs are seen in the network with the use of ping.

thanks gerald