LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices

Reply
 
Search this Thread
Old 09-12-2004, 09:41 PM   #1
monkeyman2000
Member
 
Registered: Oct 2003
Posts: 68

Rep: Reputation: 15
Network interface: kernel keeps calling it 'eth0'


Hi,

I'm using Knoppix 3.4. I want my first network interface to be named eth-port.

I set up my /etc/network/interfaces like so:

===========clip==========
auto lo eth-port
iface lo inet loopback

iface eth-port inet static
address 192.168.0.110
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
gateway 192.168.0.1

===========clip==========


I set up the "start" section in my /etc/init.d/networking file to run nameif:

===========clip==========
.
.
.
start)
doopt spoofprotect yes
doopt syncookies no
doopt ip_forward no

# my additon - run nameif to get consistent interface names
# if /etc/mactab exists then set up the named interfaces
if [ -e /etc/mactab ]
then
nameif
fi
# end of my addition

echo -n "Configuring network interfaces..."
ifup -a
echo "done."
;;
.
.
.

===========clip==========


and I set up /etc/mactab as nameif wanted:

===========clip==========
#built in ethernet
eth-port 00:E0:HW:ADR:SS

===========clip==========


As you can see there is nothing called 'eth0' anywhere.


I have been able to get the interface to be called eth-port by running nameif manually.... but on boot, the kernel always names it eth0. Furthermore, it sets up the eth0 interface with the old static IP info I had been using previously.

Why does the kernel continue to name the interface eth0? And how does it "retain" the old static IP info for that interface? I deleted it completely from the /etc/network/interfaces file and am flumoxed as to where it gets that information from. I have searched the init scripts to no avail. If someone can help me figure that out I might be able to get nameif working....

Thanks for any help you can provide!
 
Old 09-12-2004, 10:36 PM   #2
odious1
Member
 
Registered: Jun 2003
Location: Virginia, USA
Distribution: Slackware
Posts: 252

Rep: Reputation: 30
I know of no way to circumvent the naming of that nic as eth0. Just as the first hard drive is hda and the first tape drive is st0. eth0 and so on are device driver files tha must be called in order for a device to function. I suppose you could set up a sym link to these files but the kernel will always call the standard driver.

Why do you want to rename your interface anyway?
 
Old 09-13-2004, 01:11 AM   #3
monkeyman2000
Member
 
Registered: Oct 2003
Posts: 68

Original Poster
Rep: Reputation: 15
I'm sorry, but you are mistaken. There are numerous ways to do what I want to do. It's in the official debian manuals; you can refer to section 10.9 here to get a better understanding:

http://www.debian.org/doc/manuals/re...ateway.en.html

You can also read about the nameif command if you want to learn about this method of renaming network interfaces. This has nothing to do with symlinks to device files.

Renaming network interfaces is not cosmetic, it is essential for consistency if you have multiple, dynamic interfaces. Read the debian manual if you want to learn about this.

I am seeking someone who has had experience doing this or knowlege in this area who can help me get over the issues I have been having. I have followed the debian manual instructions but had no luck. If anyone in this forum can provide help, I would appreciate it. Any information on where the kernel is getting the static IP setup info for the card would help.




Quote:
Originally posted by odious1
I know of no way to circumvent the naming of that nic as eth0. Just as the first hard drive is hda and the first tape drive is st0. eth0 and so on are device driver files tha must be called in order for a device to function. I suppose you could set up a sym link to these files but the kernel will always call the standard driver.

Why do you want to rename your interface anyway?
 
Old 09-13-2004, 06:10 PM   #4
monkeyman2000
Member
 
Registered: Oct 2003
Posts: 68

Original Poster
Rep: Reputation: 15
OK, I solved my interface renaming issue. I'm putting what I found out here to try to help others who might have similar problems. I am running a hard drive install of knoppix 3.4.

Basically I had 2 problems: /etc/init.d/knoppix-autoconfig was running pump and bringing up the built in interface too soon, before nameif could rename it; and that the other interface, which is a pcmcia card, needed to have nameif run after it was inserted but before cardmgr brought it up. I did this by modifying the /etc/pcmcia/network.opts file.

Here is a more detailed report on solving the problem:

My laptop has a built in ethernet interface and (sometime) a
pcmcia wireless ethernet interface. When it boots, the kernel
would name them eth0 and eth1. It wasn't consistent which would
be named which; if I booted without the pcmcia card inserted
and put it in later it would call the built in eth0, otherwise
it would be eth1.

Some research indicated that nameif might be the solution.
I tried installing it but it didnt seem to work. I had to
remove the laptop-net package first (that was interfereing
with ifupdown on the built in port). I also had to edit my
lilo.conf file to set the kernel boot options to nodhcp
and nopcmcia. These are knoppix options that just cancel
those sections in the /etc/init.d/knoppix-autoconfig file.
This file gets run prior to the other init.d scripts and
was starting the interfaces before nameif could run properly.

In order to rename an interface, nameif must run with the interface
installed but not up. This was a bit of a challenge for the pcmcia
interface since it gets brought up imediately after being inserted.

The total solution was as follows:

First, I edited my lilo.conf to add the kernel options as mentioned... these
just affect the knoppix-autoconfig file. The point was to stop
it from bringing up the eth0 interface with DHCP, and running the
pcmcia cardmg, and let the /etc/init.d/networking and /etc/pcmcia/network
scripts do it later on with the modifications I had made.

After modifying lilo.conf I had to run 'lilo' of course to make the changes
take effect.

/etc/lilo.conf changes (added nodhcp nopcmcia):
================================
image=/boot/vmlinuz
label="Linux"
initrd=/boot/initrd.img
append="ramdisk_size=100000 init=/etc/init lang=us acpi=off apm=on apm=power-off nomce quiet nodhcp nopcmcia desktop=kde"
================================


Set up /etc/network/interfaces as follows:
================================
auto lo eth-port
iface lo inet loopback

iface wifi inet static
address 192.168.0.50
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
gateway 192.168.0.1

iface eth-port inet static
address 192.168.0.108
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
gateway 192.168.0.1
================================


Set up /etc/mactab as follows:
================================
#built in ethernet
eth-port 00:HW:ADR:01:01

#wifi card
wifi 00:30:BBB:AD:EA
================================


Edited the 'start' section of /etc/init.d/networking to run nameif:
================================
case "$1" in
start)
doopt spoofprotect yes
doopt syncookies no
doopt ip_forward no


# if /etc/mactab exists then set up the named interfaces
if [ -e /etc/mactab ]
then
nameif
fi


echo -n "Configuring network interfaces..."
ifup -a
echo "done."
;;
================================


Edited the /etc/pcmcia/network.opts file. I added a case section
to match my pcmcia card's mac address to run nameif after its
inserted before bringing it up. Also to add a WEP key.

================================
case "$ADDRESS" in
*,*,*,'00:30:BBB:AD:EA')
/sbin/nameif
log /sbin/ifup wifi
;;
*,*,*,*)
INFO="Sample private network setup"
.
.
.

================================


Now, the laptop interfaces work correctly:

#ifconfig
eth-port Link encap:Ethernet HWaddr 00:HW:ADR:01:01
inet addr:192.168.0.108 Bcast:192.168.0.255 Mask:255.255.255.0
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:102 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 b) TX bytes:6120 (5.9 KiB)
Interrupt:11 Base address:0x7000

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:658 errors:0 dropped:0 overruns:0 frame:0
TX packets:658 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:174894 (170.7 KiB) TX bytes:174894 (170.7 KiB)

wifi Link encap:Ethernet HWaddr 00:30:BBB:AD:EA
inet addr:192.168.0.50 Bcast:192.168.0.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:25657 errors:3 dropped:3 overruns:0 frame:0
TX packets:19756 errors:213 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:32200866 (30.7 MiB) TX bytes:7447465 (7.1 MiB)
Interrupt:3 Base address:0x100
#

References:

Naming Network Interfaces
http://www.linuxfromscratch.org/hint...les/nameif.txt


10.9 Dealing with inconsistent naming of interfaces by the kernel
http://www.debian.org/doc/manuals/re...ateway.en.html

Last edited by monkeyman2000; 09-13-2004 at 06:14 PM.
 
Old 09-14-2004, 12:56 AM   #5
odious1
Member
 
Registered: Jun 2003
Location: Virginia, USA
Distribution: Slackware
Posts: 252

Rep: Reputation: 30
Well thats why I subscribed to this thread. I wanted to see if it could be done. Now how on earth was I mistaken; I said I knew of no way to do this. In no way did I say it could not be done.
 
Old 10-16-2004, 02:16 PM   #6
arafye
LQ Newbie
 
Registered: Oct 2004
Posts: 4

Rep: Reputation: 0
I edited lilo.conf to add the nodhcp option and in the /etc/network/interfaces i added the following code

iface eth0 inet static
address 192.168.1.150
netmask 255.255.255.0
gateway 192.168.1.1

and rebooted the machine. however i'm still getting a dhcp addy for some reason. any ideas?
 
Old 10-16-2004, 04:53 PM   #7
monkeyman2000
Member
 
Registered: Oct 2003
Posts: 68

Original Poster
Rep: Reputation: 15
Quote:
Originally posted by arafye
I edited lilo.conf to add the nodhcp option and in the /etc/network/interfaces i added the following code

iface eth0 inet static
address 192.168.1.150
netmask 255.255.255.0
gateway 192.168.1.1

and rebooted the machine. however i'm still getting a dhcp addy for some reason. any ideas?

What else have you tried? What is your distro & setup?
 
Old 10-16-2004, 05:38 PM   #8
arafye
LQ Newbie
 
Registered: Oct 2004
Posts: 4

Rep: Reputation: 0
knoppix install on a hard drive and its dell optiplex gx-150. i followed the previous post except for the renaming portions because that doesn't matter to me. i didn't put in the network and broadcast lines of iface because i wasn't sure what they did or what they should be.
 
Old 10-18-2004, 02:46 PM   #9
monkeyman2000
Member
 
Registered: Oct 2003
Posts: 68

Original Poster
Rep: Reputation: 15
When you do a knoppix hard drive install there are still some special knoppix init scripts that get run when you boot (at least that is the case in the version I installed). In my case there is a file /etc/init.d/knoppix-autoconfig that was running pump (which does configures your interfaces with DHCP). Check if this is the case with your system as well. Using the nodhcp flag should prevent this from running but you might want to do some experiments to confirm that, like commenting out the pump lines.

If this doesn't solve the problem, you can try to track it down by watching the boot process and trying to figure out when DHCP is being run. You could modify some of the init scripts to print out messages (eg echo "---->point A<---") to help track it down.

Post back your results if you need more help or your solution to help others.
 
Old 10-19-2004, 08:28 AM   #10
arafye
LQ Newbie
 
Registered: Oct 2004
Posts: 4

Rep: Reputation: 0
ok. i put an echo command in and pump is running and being called by knoppix-autoconfig like you suspected. however, i had previously edited lilo.conf and placed into the append line nodhcp. obviously something is wrong since this should call the knoppix-autoconfig and bypass pump. the line change in lilo.conf is:

append="ramdisk_size=100000 init=/etc/init lang=us apm=power-off nomce q
uiet nodhcp"

the lines in knoppix-autoconf are:

echo "**********************************************************"
echo entering dhcp broadcast for ip address
echo "**********************************************************"

# Fat-Client-Version: DHCP Broadcast for IP address
if checkbootparam "nodhcp"; then
echo " ${BLUE}Skipping DHCP broadcast/network detection as requested on boot commandline.${NORMAL}"
echo " PUMP IS SKIPPED"
else
NETDEVICES="$(awk -F: '/eth.:|tr.:/{print $1}' /proc/net/dev 2>/dev/null)"
for DEVICE in $NETDEVICES
do
echo -n " ${GREEN}Network device ${MAGENTA}$DEVICE${GREEN} detected, DHCP broadcasting for IP.${NORMAL}"
trap 2 3 11
pump -i $DEVICE >/dev/null 2>&1 &
trap "" 2 3 11
sleep 1
echo " ${BLUE}(Backgrounding)${NORMAL}"
done
echo "PUMP IS NOT SKIPPED"
fi

i am seeing the message pump is not skipped. i'm not quite sure where to proceed from here. any suggestions? thanks.
 
Old 10-19-2004, 08:45 PM   #11
monkeyman2000
Member
 
Registered: Oct 2003
Posts: 68

Original Poster
Rep: Reputation: 15
Well, the nodhcp should make that section get skipped, obviously something isn't working. Possibly you have another boot image section set up in lilo that is set as the default, possibly you forgot to run the "lilo" command to install the boot loader with the updated lilo.conf settings ( you need to run "lilo" whenever you change lilo.conf).Maybe you are using grub and not lilo?

If these suggestions dont help and you get tired of fooling around with figuring out lilo you can just comment out the pump section in the knoppix-autoconfig file.
 
Old 10-20-2004, 02:48 AM   #12
arafye
LQ Newbie
 
Registered: Oct 2004
Posts: 4

Rep: Reputation: 0
well, i rebooted the machine and thought that would do it. if my assumption is wrong please let me know. in lilo.conf there are three different images and i have nodhcp in each of them. if i am using grub (i don't think but i'll check) is there a grub.conf or something like that i should be looking for. i know i could just hard code the pump skip, i would just hate to do that since obviously something is wrong and fixing it here (like that) could just move the problem to another place. thanks for your help so far.
 
Old 10-20-2004, 06:10 PM   #13
monkeyman2000
Member
 
Registered: Oct 2003
Posts: 68

Original Poster
Rep: Reputation: 15
Quote:
Originally posted by arafye
well, i rebooted the machine and thought that would do it. if my assumption is wrong please let me know.
Your assumption is wrong. If you don't run lilo, changing /etc/lilo.conf will do nothing. That is probably your problem right there.

Quote:
i know i could just hard code the pump skip, i would just hate to do that since obviously something is wrong and fixing it here (like that) could just move the problem to another place. thanks for your help so far.
I agree, better to do it right.

Note that you should be somewhat cautious messing around with lilo if you don't know exactly what you are doing since mistakes could potentially prevent your system from booting. There are various ways to set up lilo, to do dual-booting (e.g. several operating systems on one machine), etc. It's good to have a boot disk that you can use to boot the system to rescue it if you make a mistake.

You probably just need to run the command 'lilo' as root and reboot for everything to work. But it would be good to have a boot disk to recover just in case.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Bringing up interface eth0 Delaying eth0 initialization. [ FA bansal_ashok Linux - Networking 4 05-27-2005 10:09 AM
FC3 fails in bringing up or down interface eth0, network unreachable a_cmmn Linux - Networking 4 03-10-2005 04:10 PM
Lost network interface after upgrading kernel tripwire45 Suse/Novell 2 02-25-2005 12:15 PM
Bringing up interface eth0: determining ip information for eth0... failed ralphethomas Linux - Networking 0 01-24-2004 05:33 PM
kernel 2.2.20 with RTL8139too network card dropping interface ccn Linux - Networking 0 10-06-2003 10:57 PM


All times are GMT -5. The time now is 04:19 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration