Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
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.
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.
There is less than 24 hours left to vote in the 2015 LinuxQuestions.org Members Choice Awards. Click here to go to the polls. Vote now and make sure your voice is heard!
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
Debian doesn't use that network config file. I'm not sure how to do it in debian, but I believe the corresponding config file for debian is /etc/network/interfaces. The syntax is different than ifcfg-eth0 and I'm not sure how to edit it. However, you don't want to set it to static. You may try posting on the debian forum; I'm sure someone there can help you.
dhcp is run as a daemon; you can shut it down like any daemon
(on RH : /etc/rc.d/init.d/dhcpd stop
or /sbin/service dhcpd stop )
That's for the current session, to make that permanent use chkconfig (or an equivalent graphical tool like SysV-Init Editor on RH).
I would suggest setting dhcpd off permanently and when needed re-start it for the session only using the service command..
Hmmm... Sorry, my fault... didn't explain myself well enough:
I'm using my laptop in three different places (home, work, university) where I use DHCP-client to configure my network; this DHCP-client runs when Linux load. Yet, in other places I have no network at all - when linux load in these places I need to wait a minute for the DHCP-client to fail.
My ideal solution would be to have sort of a startup menu (before Linux starts) where I can choose between loading linux with network, or without network. My guess was that this should be done by passing parameter to the kernel before it load (using GRUB in my case).
I know about 'static' and 'dhcp' in interfaces (Debian, by the way, don't have /etc/sysconfig), but these are permanent changes. I wan't to be able to determine wheter or not using dhcp before linux loads, and not after.
There are at least two problems with your script, dubman:
1. Debian doesn't have the /etc/sysconfig directory, and it does NOT have an ifcfg-eth0 file (read the above posts!!!!!)!
2. Your script doesn't take into account if he wants a static IP on boot. It just leaves eth0 disabled otherwise.
It *might* work (don't hold me to this if I'm wrong) to have another copy of /etc/network/interfaces (you could call it /etc/network/interfaces.static or something similar) and go into rc.local and find where it references /etc/network/interfaces . You could then add something like the above if statement, except you'd also need an else statement (I'm not that familiar with shellscript, just C/C++).
There are at least two problems with your script, dubman:
1. Yes, I realize this. Just trying to give some ideas as to how this issue can be solved with some simple shell scripting.
2. my mistake, script should read as follows:
read -p "Do you want to enable dhcp? [y,n]" enable_dhcp
if [ $enable_dhcp -eq "y" ]; then
elif [ $enable_dhcp –eq “n” ]; then;
read –p “Do you want to set a static IP Address? [y,n]” enable_static
if [ $enable_static –eq “y” ]; then
read –p “What IP address would you like to set?” ipaddress
ifconfig eth0 $ipaddress
I could go even further to error check the input, and prompt for the interface, etc, but I think the idea is clear.
Having multiple profiles could work also but, I think a simple shell script is easier than moving and copying files around, and you would still need an ifup once the profiles are copied.
Don't know if this will work but here's something simple you can try. Edit your /etc/network/interfaces file by commenting out the eth0 line. You do this by putting a "#" in front of the line. That should stop the network from coming up on boot.
When you plug into the network, you might be able to bring it up by running:
# ifup eth0
Try it; if it works fine, if not uncomment the line to be back where you started.
My mistake ! On my old gear dhcpcd, the client part of dhcp , is run like a daemon (daemons are not necessarily network servers !). But i admit that my solution was rather naive since the script had already started the daemon ,you can only shut it down.
I think that everything must be attempted before seducing people into messing their startup scripts up.
As i can gather dhcp-client uses dhclient.conf as config file.
There are several ways to tweak how the client is started (check the dhclient man pages). At, http://www.risc.uni-linz.ac.at/syste...g/index_3.html
i found an interesting idea :
set first timeout very low to speed booting up
but use a retry after a long delay
I'm no expert in these matters , you could go to the linux-debian-laptop newsgrp . There is also a dhcp client newsgroup!