Mods - can the thread title be changed? I think the present title is no longer appropiate.
Hi,
Thanks for all the inputs.
This is what I came up with.
Of the three scripts -
/etc/sysconfig/network-scripts/ifcfg-eth0
/etc/sysconfig/networking/devices/ifcfg-eth0
/etc/sysconfig/networking/profiles/default/ifcfg-eth0
The one located under network-scripts did not help. I just changed that and restarted my network to find the network just reverts to its original.
By changing the ifcfg-eth0 under devices did the trick. By restarting the network all ifcfg-eth0 scripts are changed to reflect what I want.
That solved the ip. But I still needed to change the dns (/etc/resolv.conf). That was easy.
My script -
if [ $1 == 1 ]
then
echo "Changing to local ip"
cp lan.ifcfg-eth0 /etc/sysconfig/networking/devices/ifcfg-eth0
cp lan.resolv.conf /etc/resolv.conf
else
echo "Changing to isp"
cp isp.ifcfg-eth0 /etc/sysconfig/networking/devices/ifcfg-eth0
cp /etc/isp.resolv.conf /etc/resolv.conf
fi
echo "Restarting network"
/sbin/service network restart
Now about the grud and network profile.
I started of by creating multiple profiles by using the network config gui. BIG MISTAKE.
That ended up creating links of the default folder under profile. I change anything in any file, all the files with the same name in all the other profiles gets changed.
So i used
cp -R /etc/sysconfig/networking/profiles/default /etc/sysconfig/networking/profiles/PROFILENAME
Then I changed the ifcfg-eth0 and resolv.conf in each different profile.
I changed grub at /boot/grub/grub.conf
Added netprofile=PROFILENAME at grub kernel.
default=0
timeout=10
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title Fedora Core Lan
root (hd0,0)
kernel /vmlinuz-2.6.15-1.2054_FC5 ro root=/dev/VolGroup00/LogVol00 rhgb quiet netprofile=lan
initrd /initrd-2.6.15-1.2054_FC5.img
title Fedora Core Isp
root (hd0,0)
kernel /vmlinuz-2.6.15-1.2054_FC5 ro root=/dev/VolGroup00/LogVol00 rhgb quiet netprofile=isp
initrd /initrd-2.6.15-1.2054_FC5.img
But after reboot the lan settings become what is set in default.
I am completely stumped.
What am I doing wrong?
Thanks again for all the help. I wouldnt have come this far without it.
Regards
Mods - can the thread title be changed? I think the present title is no longer appropiate.
I have checked the contents of /etc/init.d and /etc/sysconfig/network-scripts for any reference to /etc/sysconfig/networking and see none for both FC5 and FC6.
However, it looks like system-config-network creates them, that's probably why editing the files in /etc/sysconfig/network-scripts directly didn't work with you.
Interesting post, I didn't know about that profile feature. More information can be found on it here.
On another note,
The reason why "lan" is the default is because you have set
which makes grub use entry number 0 in grub.conf, namely the "lan" one. Set default to 1 and you should get it defaulting to your ISP.Code:default=0
FYI, I tried using system-config-network and the files were copied, not linked, from the network-scripts directory.
here.
Thanks for the link.
On another note,
The reason why "lan" is the default is because you have set .... which makes grub use entry number 0 in grub.conf, namely the "lan" one. Set default to 1 and you should get it defaulting to your ISP
Actually -
My default net profile is that of my isp. Casue that is what I use mostly. But sometimes I connect to the internet through my desktop and use it as a gateway for my laptop. So I alternate between two static ips, one given by my ISP for connecting to their network through which I get connect to the net, and my home ip 192.168.0.x.
In trying to make this transition smoother I wanted to write a script. The result of which is above.
But then Compunut showed me the grub settings.
The default netprofile has not been deleted. But I have two fedora kernel settings in grub.conf both having netprofile. Inspite of me choosing LAN profile during boot - I end up with my isp setting. Not only that, the files upder /etc/.../profiles/lan changes to default settings.
And my gui is still creating links if i use it. Am I missing some patches or something.
I gotto solve this problem.
I have to plug into various networks because of work. Having network profiles will really solve me a lot of problems.
Regards
I tried the link on my system at home. I think the key to your problem is near the bottom of the link page.
These commands should force the copy of your settings from /etc/sysconfig/networking/profiles/default and /etc/sysconfig/networking/profiles/lan to /etc/sysconfig/network-scripts where the system will search for interface settings on boot up.
Selecting the profile from the grub boot menu just gives you the option of selecting one on demand but won't change which of the two are selected at boot time.Code:system-config-network-cmd -a -p lan system-config-network-cmd -a -p default
You may want to create an entry like this, which will use the default settings given by the system-config-network-cmd command.
Study the output of theCode:kernel /vmlinuz-2.6.15-1.2054_FC5 ro root=/dev/VolGroup00/LogVol00 rhgb quiet initrd /initrd-2.6.15-1.2054_FC5.img title Fedora Core Defaultwithout any arguments and it will show which of the two is the true default. The command also sticks an entry in /etc/sysconfig/network, but I am not sure whether this is just informational for the user or whether the system actually uses it during boot time.Code:system-config-network-cmd
Bookmarks