LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   mac addresses swapped between built-in eth0 and pci eth1 in output of ifconfig -a (https://www.linuxquestions.org/questions/slackware-14/mac-addresses-swapped-between-built-in-eth0-and-pci-eth1-in-output-of-ifconfig-a-713950/)

globaltree 03-23-2009 11:10 PM

mac addresses swapped between built-in eth0 and pci eth1 in output of ifconfig -a
 
Hi all:

This problem is occurring on a fresh install of 12.2 from cd onto a Dell Dimension 8100. I configured the built-in ethernet interface when setup asked me if I wanted to configure my network, and when setup was finished, I used vi to edit /mnt/etc/rc.d/rc.inet1.conf and I configured the realtek pci ethernet interface by providing the relevant values. When I was finished, the relevant sections looked like this:

Code:

# Config information for eth0:
IPADDR[0]="my.static.public.ip"
NETMASK[0]="255.255.252.0"
USE_DHCP[0]=""
DHCP_HOSTNAME[0]=""

# Config information for eth1:
IPADDR[1]="172.22.22.44"
NETMASK[1]="255.255.255.0"
USE_DHCP[1]=""
DHCP_HOSTNAME[1]=""

After booting up for the first time, and admiring the random text patterns that were displayed when it set up ssh, and logging in as root, I thought I would check to make sure I had internet, so I pinged my isp's nameserver (one of the one's listed in /etc/resolv.conf):

Code:

root@spot:~# ping my.isp.ns.1
PING my.isp.ns.1 (my.isp.ns.1) 56(84) bytes of data.
From my.static.public.ip icmp_seq=2 Destination Host Unreachable
From my.static.public.ip icmp_seq=3 Destination Host Unreachable

So then I verified that the interface was up and running and had an ip address:

Code:

root@spot:~# ifconfig -a
eth0      Link encap:Ethernet  HWaddr 00:40:f4:ae:91:ee 
          inet addr:my.static.public.ip  Bcast:my.static.broad.cast 
          Mask:255.255.252.0
          inet6 addr: fe80::240:f4ff:feae:91ee/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:611 errors:0 dropped:0 overruns:0 frame:0
          TX packets:58 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:58286 (56.9 KiB)  TX bytes:3588 (3.5 KiB)
          Interrupt:10 Base address:0xec00

eth1      Link encap:Ethernet  HWaddr 00:b0:d0:07:06:d8 
          inet addr:172.22.22.44  Bcast:172.22.22.255  Mask:255.255.255.0
          inet6 addr: fe80::2b0:d0ff:fe07:6d8/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:154 errors:0 dropped:0 overruns:1 frame:0
          TX packets:385 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:9855 (9.6 KiB)  TX bytes:60317 (58.9 KiB)
          Interrupt:11 Base address:0xa400

lo        Link encap:Local Loopback 
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:36 errors:0 dropped:0 overruns:0 frame:0
          TX packets:36 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:3464 (3.3 KiB)  TX bytes:3464 (3.3 KiB)

It looked right to me. I pinged a machine on the local network, and was successful. Then I went to that machine and ssh'd back to spot, so I could copy and paste the results of those commands into these code blocks and not have to retype.

The built-in ethernet is plugged into a bridge that runs openbsd, so I also ssh'd into this bridge and checked to see if the bridge noticed that a new machine was plugged into it, and it had:

Code:

sudo brconfig -a
bridge0: flags=41<UP,RUNNING>
        priority 32768 hellotime 2 fwddelay 15 maxage 20 holdcnt 6 proto rstp
        bge1 flags=3<LEARNING,DISCOVER>
                port 2 ifpriority 0 ifcost 0
        bge0 flags=3<LEARNING,DISCOVER>
                port 1 ifpriority 0 ifcost 0
        Addresses (max cache: 100, timeout: 240):
                00:11:43:0e:70:e3 bge1 1 flags=0<>
                00:01:96:26:82:9f bge0 1 flags=0<>
                00:b0:d0:07:06:d8 bge1 0 flags=0<>
$

The last address doesn't appear until the new machine is booted up. This is when I noticed that the mac address listed here, 00:b0:d0:07:06:d8 corresponded to the addesss listed for eth1. But it is eth0 that is plugged into this bridge, so this is weird.

Knowing that these interface names are created by udev (I've read alien's wiki) I checked /etc/udev/rules.d/70-persistent-net.rules

Code:

# PCI device 0x10ec:0x8139 (8139too)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:40:f4:ae:91:ee",
ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

# PCI device 0x10b7:0x9200 (3c59x)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:b0:d0:07:06:d8",
ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"

Hear I see that the first device is using the realtek (8139too) driver and the second device is using the 3com (3c59x) driver. This second device has the address that was detected by the bridge.

It appears that udev named the interfaces backwards, and called the built-in interface eth1 and the pci slot interface eth0.

But why am I able to ping my local network, and connect to the local network through the pci card interface, if it was given my public ip?

At this point, I'm at a loss, and I hope someone can help.

globaltree 03-23-2009 11:29 PM

solved
 
Ok... I solved it simply by correcting the rules in /etc/udev/rules.d/70-persistent-net.rules so that the second device was eth0 and the first eth1, and after I rebooted, it was working.

Still, it seems like udev did something weird, and I hope it is working ok.


All times are GMT -5. The time now is 11:41 AM.