Mon 28 March 2016

Filed under Linux Networking

Tags Linux Networking

New hardware for BufferUpr has arrived! I'm working on adding Wifi capability into the product and with new hardware comes new challenges.

Challenge: Find a simple way to list all the network interfaces in the system, including the PCIe slot and MAC address for each.

Solution:

find /sys/devices/pci0000* \
-wholename "*net/*/address" \
-printf "%h/%f " \
-exec cat '{}' \;

This depends on a proper find, of course, so Busybox won't do.

Example output:

/sys/devices/pci0000:00/0000:00:03.0/0000:03:00.0/net/p3p0/address 90:e2:ba:7f:97:00
/sys/devices/pci0000:00/0000:00:03.0/0000:03:00.1/net/p3p1/address 90:e2:ba:7f:97:01
/sys/devices/pci0000:00/0000:00:03.0/0000:03:00.2/net/p3p2/address 90:e2:ba:7f:97:02
/sys/devices/pci0000:00/0000:00:03.0/0000:03:00.3/net/p3p3/address 90:e2:ba:7f:97:03
/sys/devices/pci0000:00/0000:00:19.0/net/em1/address 88:88:88:88:87:88

Notice from the path to the address files that some of the interfaces on this system are named according to their PCI BDF (bus/device/function) identifiers. For example, the p3p2 interface is bus 3, device 0, function 2.

From these BDF numbers, we can guess that there is a 4-port card in PCIe slot 3. However, it may not be easy to tell which physical connector on the motherboard maps to slot 3. It might even involve screwdrivers and dust... shudder.

There are some more examples and a better explanation of device naming rules over there.

If the disappearance of eth0 is news to you and you're frustrated that nobody asked you whether you wanted interface naming fixed, you might want to read about why this change was made.

The Xen wiki has a good page on BDF numbers and Wikipedia has more detail.


Wed 01 April 2015

Filed under Howto

Tags Linux Networking

Sometimes there is good reason to talk to yourself. You might be doing a sound check, for example.

Likewise, it can be useful to route IP packets between two interfaces on the same machine using an external path. One reason to do this is to test other network devices like …

Read More

Sat 27 September 2014

Filed under Linux Networking

Tags Linux Networking

I received some encouraging comments on G+ from Jesper Dangaard Brouer about my previous post on DSCP, Linux and VLAN priorities. Those comments and the work linked to (here and here) points to a few long-standing (but minor) issues with the way DSCP priorities are handled in Linux.

  1. Some DSCP …
Read More

Wed 17 September 2014

Filed under Linux Networking

Tags Linux Networking

I recently discovered a flaw in the VLAN implementation I did at work. It seemed that the normal TCP traffic had the correct VLAN priorities applied, but audio streaming UDP traffic did not.

This was due to DSCP being applied to the streaming audio and the fact that the VLAN …

Read More

Tue 12 August 2014

Filed under Linux Networking

Tags Linux Networking

This concerns the proliferation of netlink libraries and a lack of direction and documentation.

Background:

I've configured a router with netem (see Bandwidth Throttling with NetEM Network Emulation and netem example rules) to test Tieline devices under various delay and loss network conditions.

It's not really feasible for the tester …

Read More

rationali.st © Andrew Cooks