Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
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.
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.
It does, however it is pretty slow. It took almost a minute for it to show that it was back up. That is not acceptable for what I want to do with it. I am trying to set up my laptop to not wait for a dhcp lease on startup when the eth0 cable is unplugged. If anyone else has an idea, I am all ears.
--------------------------------------------------------------------------------------
I am trying to set up my laptop to not wait for a dhcp lease on startup when the eth0 cable is unplugged. If anyone else has an idea, I am all ears.
--------------------------------------------------------------------------------------
I just turned off start network at boot (Mandrake Control Center ->Network and Internet -> DrakConnect -> Expert mode -> Configure LAN -> started on boot: no)
boot time is much faster since it doesn't look for dhcp and when you need net access just click on Activate (same location as above)
Checking the messages isn't really what I am after. I want to be able to run some kind of command that will check. Then, I will use that command in my startup script to not start that device if the ethernet cord is not plugged in.
tang: not everyone runs mandrake my friend. I run slackware. I appreciate your input though.
didn't think about that it erks me sometimes when i read a post that mentions 'go to blah and do blah' without explaining how to get to blah in the first place (assuming if you're posting cause you don't know how to fix something, you probably don't know how to get to where you're supposed to fix it)
you as in anyone, not you-you
will pay more attention to what i'm posting, thanks for the tip
hope you find what you're looking for
perhaps you could reduce the amount of time the dhcp client will wait for a reply from your dhcp server so that even with no ethernet cable your startup time will not greatly increase.
think theres a timeout setting in /etc/dhclient.conf or thereabouts.
Actually, mii-tool was not quite what I was looking for. It did not provide an option (that I could see) that would allow me to just run the command and then look at the return value to see what was returned.
However, mii-tool is actually derived from mii-diag which did provide the option i was looking for (by passing -s as an argument). So, here is my rc.inet1 (slackware network start up script):
rsyring@dell:~$ cat /etc/rc.d/rc.inet1
#! /bin/sh
# /etc/rc.d/rc.inet1
# This script starts up the base networking system.
#
# Version:
# @(#)/etc/rc.d/rc.inet1 8.1 Tue May 28 15:27:39 PDT 2002 (pjv)
# Edit these values to set up your first Ethernet card (eth0):
IPADDR="127.0.0.1" # REPLACE with YOUR IP address!
NETMASK="255.255.255.0" # REPLACE with YOUR netmask!
# Or, uncomment the following lines to set up eth0 using DHCP:
USE_DHCP=yes
# If using DHCP, do media check first to prevent slow start-ups:
MEDIA_CHECK=yes
# If your provider requires a DHCP hostname, uncomment and edit below:
#DHCP_HOSTNAME="CCHOSTNUM-A"
# Edit these values to set up your second Ethernet card (eth1),
# if you have one. Otherwise leave it configured to 127.0.0.1,
# or comment it out, and it will be ignored at boot.
IPADDR2="127.0.0.1" # REPLACE with YOUR IP address!
NETMASK2="255.255.255.0" # REPLACE with YOUR netmask!
# Or, uncomment the following lines to set up eth1 using DHCP:
USE_DHCP2=yes
# If using DHCP, do media check first to prevent slow start-ups,
MEDIA_CHECK2=yes
# If your provider requires a DHCP hostname, uncomment and edit below:
#DHCP_HOSTNAME2="CCHOSTNUM-A"
# Edit the next line to point to your gateway:
GATEWAY="" # REPLACE with YOUR gateway!
# You shouldn't need to edit anything below here.
# Set up the loopback interface:
/sbin/ifconfig lo 127.0.0.1
/sbin/route add -net 127.0.0.0 netmask 255.0.0.0 lo
#set-up a variable so DHCP does not run when eth0 media is not ready
MEDIA_STATUS=OK
if [ "$MEDIA_CHECK" = "yes" -a "$USE_DHCP" = "yes" ]; then # do media check
echo "Getting status of eth0 interface..."
/sbin/mii-diag -s eth0 >/dev/null 2>&1
if [ ! $? = 0 ]; then # eth0 is not ready for DHCP
MEDIA_STATUS="NOT_OK"
echo "DHCP will not run on eth0 because the media is not ready!"
fi
fi
# Set up the eth0 interface:
if [ "$USE_DHCP" = "yes" -a "$MEDIA_STATUS" = "OK" ]; then # use DHCP to set everything up:
echo "Attempting to configure eth0 by contacting a DHCP server..."
# Add the -h option to the DHCP hostname:
if [ ! "$DHCP_HOSTNAME" = "" ]; then
DHCP_HOSTNAME="-h $DHCP_HOSTNAME"
fi
/sbin/dhcpcd -t 10 ${DHCP_HOSTNAME} -d eth0
elif [ ! "$IPADDR" = "127.0.0.1" -a ! "$IPADDR" = "" ]; then # set up IP statically:
# Determine broadcast and network addresses from the IP address and netmask:
BROADCAST=`/bin/ipmask $NETMASK $IPADDR | cut -f 1 -d ' '`
NETWORK=`/bin/ipmask $NETMASK $IPADDR | cut -f 2 -d ' '`
# Set up the ethernet card:
echo "Configuring eth0:"
echo "ifconfig eth0 ${IPADDR} broadcast ${BROADCAST} netmask ${NETMASK}"
/sbin/ifconfig eth0 ${IPADDR} broadcast ${BROADCAST} netmask ${NETMASK}
# If that didn't succeed, give the system administrator some hints:
if [ ! $? = 0 ]; then
echo "Your eth0 card was not initialized properly. Here are some reasons why this"
echo "may have happened, and the solutions:"
echo "1. Your kernel does not contain support for your card. Including all the"
echo " network drivers in a Linux kernel can make it too large to even boot, and"
echo " sometimes including extra drivers can cause system hangs. To support your"
echo " ethernet, either edit /etc/rc.d/rc.modules to load the support at boot time,"
echo " or compile and install a kernel that contains support."
echo "2. You don't have an ethernet card, in which case you should run netconfig"
echo " and configure your machine for loopback. (Unless you don't mind seeing this"
echo " error...)"
fi
fi # set up eth0
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.