Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place! |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
12-13-2013, 09:18 PM
|
#1
|
LQ Newbie
Registered: Oct 2013
Posts: 10
Rep: 
|
how to change the script at the network-script so not to waste time
Hello,
I was wondering if one can substitute quickly scripts. I am setting up a simple network and want to be able to have preconfigured scripts. For instance the /etc/sysconfig/network-scripts/ifcfg-eth0. This at the end could be changed quickly. I mean the path to the ifcfg-eth0 would maybe have another name or something. Or do I have to go in and change the vi file?
Take care,
Albert
|
|
|
12-14-2013, 02:52 AM
|
#2
|
LQ Veteran
Registered: Sep 2003
Posts: 10,532
|
I'm not at all sure what you are asking.
- If you want/need to edit a script/file you can use vi (or any other editor you like),
- You can also use awk or sed (just 2 examples) to change a file/script (no need for an editor in this case).
Without knowing exactly what it is you want I cannot help you any further.
|
|
|
12-14-2013, 06:49 AM
|
#3
|
Member
Registered: Mar 2013
Distribution: Rocky, Fedora, Ubuntu
Posts: 541
Rep: 
|
Not sure what you want..
For example, if you want to change IP quickly, then
Code:
# ifconfig eth0 192.168.122.50 netmask 255.255.255.0 up
OR
# ip addr add 192.168.122.50/24 dev eth0
# ifup eth0
But these changes are not permanent. IP will default to the one in ifcfg-eth0 after reboot.
You can also set soft link to ifcfg-eth0 file from your home folder..
Code:
# ln -s /etc/sysconfig/network-scripts/ifcfg-eth0 eth0
# ls -l eth0
lrwxrwxrwx. 1 root root 41 Dec 14 18:18 eth0 -> /etc/sysconfig/network-scripts/ifcfg-eth0
# vi eth0
You can also try CDPATH.
Last edited by Madhu Desai; 12-14-2013 at 07:00 AM.
|
|
|
12-14-2013, 08:03 AM
|
#4
|
LQ Newbie
Registered: Oct 2013
Posts: 10
Original Poster
Rep: 
|
Thanks,
I guess one can not swap out the ifcfg-eth0 file with another...say ifcfg-eth02 or any other name. I guess the permanent change is not that important for the ip address because it can be change quickly as noted.
Thanks again,
Albert
|
|
|
12-14-2013, 08:19 AM
|
#5
|
LQ Veteran
Registered: Sep 2003
Posts: 10,532
|
Quote:
Originally Posted by albert0147
I guess one can not swap out the ifcfg-eth0 file with another...say ifcfg-eth02 or any other name. I guess the permanent change is not that important for the ip address because it can be change quickly as noted.
|
There's a little bit more info in your reply.
Is this what you want: Have multiple ifcfg-eth0 files, each with their own unique properties inside?
If that is the case: The scripts that control bringing up the network devices look for a specific name pattern, if you use a different name it will not be used. Example ifcfg-eth0 will be used, _ifcfg-eth0 will not be used.
In the /etc/sysconfig/network-scripts/ directory you can create files like this:
_ifcfg-eth0.cfg1
_ifcfg-eth0.cfg2
_ifcfg-eth0.cfg3
etc.
The only thing you now need to to is to copy (not move) the correct file to the name that will be used:
Code:
cp _ifcfg-eth0.cfg2 ifcfg-eth0
Restart the network and cfg2 will be used.
|
|
|
12-14-2013, 08:30 AM
|
#6
|
LQ Newbie
Registered: Oct 2013
Posts: 10
Original Poster
Rep: 
|
Yes perfect.
Got it.
Thanks, I need to improve my question asking abilities.
Cheers,
Albert
|
|
|
12-14-2013, 09:11 AM
|
#7
|
LQ Veteran
Registered: Sep 2003
Posts: 10,532
|
You're welcome.
BTW: Can you put up the [SOLVED] tag.
- above the first post -> Please Mark this thread as solved if you feel a solution has been provided.
- -or- -
- first post -> Thread Tools -> Mark this thread as solved
|
|
|
12-14-2013, 09:44 AM
|
#8
|
Member
Registered: Mar 2013
Distribution: Rocky, Fedora, Ubuntu
Posts: 541
Rep: 
|
Quote:
Originally Posted by albert0147
I guess one can not swap out the ifcfg-eth0 file with another...say ifcfg-eth02 or any other name.
|
Is this you want... Here, for example i have changed eth0 interface to bart-simpson
Code:
# ll /etc/sysconfig/network-scripts/ifcfg-*
-rw-r--r--. 1 root root 192 Dec 14 20:40 /etc/sysconfig/network-scripts/ifcfg-bart-simpson
-rw-r--r--. 1 root root 254 Dec 14 21:00 /etc/sysconfig/network-scripts/ifcfg-lo
# ifconfig bart-simpson
bart-simpson Link encap:Ethernet HWaddr 52:54:00:73:0F:F5
inet addr:192.168.122.204 Bcast:192.168.122.255 Mask:255.255.255.0
inet6 addr: fe80::5054:ff:fe73:ff5/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:309 errors:0 dropped:0 overruns:0 frame:0
TX packets:137 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:34208 (33.4 KiB) TX bytes:16876 (16.4 KiB)
# ifdown bart-simpson
# ifup bart-simpson
Determining IP information for bart-simpson... done.
|
|
|
12-15-2013, 05:16 PM
|
#9
|
LQ Newbie
Registered: Oct 2013
Posts: 10
Original Poster
Rep: 
|
Druuna,
I can not find that [solved]
Albert
|
|
|
12-16-2013, 02:56 AM
|
#10
|
LQ Veteran
Registered: Sep 2003
Posts: 10,532
|
Quote:
Originally Posted by albert0147
Druuna,
I can not find that [solved]
Albert
|
Have a look at the attached screenshot.
|
|
|
All times are GMT -5. The time now is 03:40 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|