Internal and External networks swapped/not working

From LinuxMCE
Jump to: navigation, search
Version Status Date Updated Updated By
710 Unknown N/A N/A
810 Unknown N/A N/A
1004 Unknown N/A N/A
1204 Unknown N/A N/A
1404 Unknown N/A N/A
Usage Information

In some circumstances, and usually with particular motherboards/NICs, Linux may not initialise your network cards in a way that makes LMCE easy to get working.

How to check if this has happened

Use ethtool to determine your NIC names. For LMCE to work smoothly, the External network (typically connected to your existing home network and/or directly to your broadband router) should be called eth0. The Internal network (this is the new, dedicated LMCE network that all your telephony, media, security, Media Directors, Home Automation, etc devices are on) should be called eth1. There are different ways of configuring LMCE, but this is the default and easiest.

If ethtool shows you have eth0 and eth2, or eth1 and eth2 or even eth0 and eth1 the wrong way around in some circumstances, then you have this problem.

What if it is wrong?

LMCE will assume that your external network is out of eth0 and internal out of eth1, so it will send traffic in the wrong directions, not plug and play properly, not be able to access your media, disrupt your external network DHCP, etc.

What to do

If the interface names are simply swapped, you can try swapping the cables around, or using the "swap" option in the web admin. Most of the time, this is all that is wrong.

If you have a DHCP server enabled on the external network (you should never have one enabled on the internal network, LMCE provides that functionality), you should see in the web admin that the external interface has got an IP address from that server, and the subnet mask, gateway, etc are all configured correctly. On the internal interface LMCE should automatically assign the static IP address of 192.168.80.1. Devices on the internal network should be able freely to get IP addresses from the DHCP server on that interface. If both of these are true, then your core is correctly networked.

If the names are wrong and the IP addresses are not set up as above then you need to name the interfaces correctly. Follow the steps below:

  1. You can use the ethtool command to flash the LEDs on each card in turn - do this and note precisely the MAC address (also from ethtool) of the interface that is connected to your external network. Do the same for the internal network.
  2. You can now create a udev rule to force the names.
    • I use the text file editor, Joe. Use whichever editor you prefer - to install Joe from a terminal:
      1. sudo apt-get install joe
  3. Create a text file called /etc/udev/rules.d/70-persistent-net.rules (or edit it if it already exists):
  4. sudo joe /etc/udev/rules.d/70-persistent-net.rules
  5. Now add these 2 lines:
    KERNEL=="eth*", SYSFS{address}=="aa:bb:cc:dd:ee:ff", NAME="eth0"
    KERNEL=="eth*", SYSFS{address}=="aa:bb:cc:dd:ee:ff", NAME="eth1"
    • Substitute aa:bb:cc:dd:ee:ff for the appropriate MAC address - the first one is the MAC address you noted for your external network, the second one for your internal network. NOTE: these are case sensitive, and all letters must be lower case.
    • If there were already entries in this file, you will need to use your commonsense to determine whether they conflict. If they do, replace those conflicting entries with the ones above.
  6. Save and exit the file.
  7. Reboot.

You should now see in the web admin that all the IP addresses are correctly assigned and you can route both internally and externally.

The udev rules listen to kernel messages, filter them based on whether they are ethernet interface naming events, and then override the names assigned with the correct ones.