Linux - Networking This 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.
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.
|
 |
09-05-2013, 05:21 AM
|
#1
|
Senior Member
Registered: Apr 2010
Posts: 2,288
|
Linux Ifconfig
hi guys when i type the command, cat /etc/network/interfaces it will show this result:
Quote:
root@xxgo:/home/cxs# cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The primary network interface
auto eth1
iface eth1 inet static
address 192.168.1.13
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.254
auto eth0
iface eth0 inet static
address 192.168.1.12
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
|
but when i type ifconfig -a it has a different result:
Quote:
root@xxgo:/home/cxs# ifconfig -a
eth2 inet addr:192.168.1.146 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1544 errors:0 dropped:0 overruns:0 frame:0
TX packets:243 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:143669 (140.3 KiB) TX bytes:30573 (29.8 KiB)
Interrupt:23 Base address:0x2000
|
any ideas guys, why the eth0 and eth1 does not appear on ifconfig -a?
why the eth2 comes into play when there is already a static IP defined?
thank you for any input. 
|
|
|
09-05-2013, 05:40 AM
|
#2
|
Member
Registered: Jan 2013
Location: EU
Distribution: Debian
Posts: 269
Rep:
|
Do you have only one ethernet device? Did you happen to replace the network card recently?
|
|
|
09-05-2013, 06:18 AM
|
#3
|
Senior Member
Registered: Oct 2004
Distribution: Debian Squeeze x86_64
Posts: 1,748
|
Please provide the output of /etc/udev/rules.d/70-persistent-net.rules.
Just a hint. Maybe try the ip binary. It like it far better than ifconfig.
ip link - shows all interfaces
ip addr - shows ip addres of all interfaces
ip route - shows active rules
man ip - well the man page.
|
|
|
09-05-2013, 06:55 AM
|
#4
|
Senior Member
Registered: Apr 2010
Posts: 2,288
Original Poster
|
only one interface on the pc.
I recently clone a server and restore the image on a pc.
I don't know whether turning off the DHCP on linux will help. I'm using Ubuntu.
|
|
|
09-05-2013, 07:11 AM
|
#5
|
LQ Veteran
Registered: Sep 2003
Posts: 10,532
|
Quote:
Originally Posted by JJJCR
only one interface on the pc.
I recently clone a server and restore the image on a pc.
|
Cloning a machine will cause this (very common in Virtual Machines).
Udev is the reason this will happen, provide the output of:
- cat /etc/udev/rules.d/70-persistent-net.rules
- ip link list
- dmesg | grep "eth[0-9]: addr"
|
|
|
09-05-2013, 11:51 AM
|
#6
|
Member
Registered: Jan 2013
Location: EU
Distribution: Debian
Posts: 269
Rep:
|
Let me try to explain. UDEV is a program on your linux that tries to keep the name of your network interfaces consistent. It does this by reading the NIC's mac address and creates a rule inside /etc/udev/rules.d/70-persistent-net.rules file. So next time a computer boots it will read this file and set the interface names accordingly. Each time a new network device is detected, a new name will be generated for it. Since you cloned the OS, the udev detected that a new hardware is present, thus giving the NIC a new name - eth2. The interfaces eth0 and eth1 are locked to their mac addresses. Of course these interfaces will not be present ever again, but udev doesn't know that.
So the solution for you is to edit out the /etc/udev/rules.d/70-persistent-net.rules file, and remove any references to eth0 and eth1. Finally rename the 3rd entry from eth2 to eth0 and reboot.
|
|
1 members found this post helpful.
|
09-07-2013, 05:12 AM
|
#7
|
Senior Member
Registered: Apr 2010
Posts: 2,288
Original Poster
|
there is no /etc/udev/rules.d/70-persistent-net.rules
i can't find it
any ideas guys? where to find eth2 and put back eth0 interface?
|
|
|
09-07-2013, 06:07 AM
|
#9
|
Senior Member
Registered: Apr 2010
Posts: 2,288
Original Poster
|
hi druuna, this not a latest version of Ubuntu.
It's Feisty Ubuntu 7.04, actually, i created manually the 70-persistent-net.rules but no joy.
The original server, I had checked also it doesn't have this 70-persistent-net.rules.
Where does Linux keeps it new find hardware devices? is there some sort of a conf file that it keeps its data for newly find devices such as NIC?
Thanks for any input. 
|
|
|
09-07-2013, 06:20 AM
|
#10
|
LQ Veteran
Registered: Sep 2003
Posts: 10,532
|
Quote:
Originally Posted by JJJCR
hi druuna, this not a latest version of Ubuntu.
It's Feisty Ubuntu 7.04
|
It might have been a good idea to mention that you are using a 6 year old, unsupported distro.......
Underlying problem is still the same though: Hardware address of the network interface was changed due to cloning.
I don't have a clue how (very) old Ubuntu version might have handled this.
|
|
|
09-07-2013, 06:33 AM
|
#11
|
Senior Member
Registered: Apr 2010
Posts: 2,288
Original Poster
|
thanks for the reply, new version is handled by 70-persistent-net.rules.
But for sure, 6 year old distro has a way of handling it. But might just be in a different way.
One thing I have in mind, is to rename the info on /etc/network/interfaces because the info on /etc/network/interfaces is still the old info from the clone server.
while i'm typing this, something cross my mind. The MAC on /etc/network/interfaces is still the old MAC of the server.
But I had shutdown the machine so I can't connect remotely but hope this idea will work.
If you have any ideas on mind guys, please spit it out and help me.
Thanks for any ideas.
I will update this post if changing the MAC on /etc/network/interfaces will help. 
|
|
|
09-07-2013, 07:47 AM
|
#12
|
LQ Addict
Registered: Dec 2011
Location: UK
Distribution: Debian Sid AMD64, Raspbian Wheezy, various VMs
Posts: 7,680
|
If it's a VM couldn't you change the MAC of the virtual network card to match what it was on the old instance, or am I missing something?
|
|
|
09-07-2013, 07:09 PM
|
#13
|
Senior Member
Registered: Apr 2010
Posts: 2,288
Original Poster
|
hi 273, i restored it to a PC.
what i mean by changing the MAC, i'm not changing the MAC physically on the NIC itself. But what I mean is is change the text file on /etc/network/interfaces.
I don't know whether this will work, or how does the old distro or Linux remember different NIC?
Because everyone is talking about 70-persistent-net.rules, which the old distro don't have.
There should be some sort of a database file (if that's the right term) on Linux, when the NIC is change or any hardware.
System is smart to remember different hardware and will use different name.
Like the NIC for example since it's a different NIC and eth0, eth1 was used by the old machine, and on the machine in which I restored the distro Linux change to eth2 since it's a different hardware and eth0 and eth1 was used before already.
And I presume if I will load back this image to the original machine, the NIC will automatically change to eth0 since the distro is able to detect the original hardware.
Last edited by JJJCR; 09-07-2013 at 10:32 PM.
Reason: edit
|
|
|
09-09-2013, 08:34 PM
|
#14
|
Senior Member
Registered: Apr 2010
Posts: 2,288
Original Poster
|
Quote:
root@xxgo:/home/cxs# cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The primary network interface
auto eth1
iface eth1 inet static
address 192.168.1.13
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.254
auto eth0
iface eth0 inet static
address 192.168.1.12
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
|
it wasn't that complicated after all, in /etc/network/interfaces I just change eth1 to eth3 and eth0 to eth2 and it works.
Thanks for all the help guys 
|
|
|
All times are GMT -5. The time now is 01:26 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
|
|