Stop Motorola Radio to Steal Default Routes

During some experiments with programming my DP3600 I experienced issues with my network connection when the radio’s programming cable is plugged to the USB port. This was also reported by Andreas, DL5APR when he plugged his DM series mobile radio in. The result is that no internet or local LAN connections are possible any more. Analyzing this reveals that it registers a new network device on my Ubuntu 16.04 host operating system. For some reason it claims the same IPv4 address as my eth0 device. That results in a broken routing table and all network stuff is interrupted.

When the device is plugged in it is recognized by the kernel and the cdc_ether kernel module is loaded. After that NetworkManger configures the device with IP addresses. That looked like this on my system:

$ ip addr show

[...]

2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 00:1c:c0:f6:a1:28 brd ff:ff:ff:ff:ff:ff
    inet 169.254.0.10/24 brd 169.254.0.255 scope global dynamic eth0
       valid_lft 77764sec preferred_lft 77764sec
    inet6 2001:42:e5c:3c99:21c:c0ff:fee3:762b/64 scope global noprefixroute dynamic 
       valid_lft 14398sec preferred_lft 1798sec
    inet6 fe80::21c:c0ff:fee3:762b/64 scope link 
       valid_lft forever preferred_lft forever

[...]

5: enp0s29u1u7u1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN group default qlen 1000
    link/ether 0a:00:3e:9d:85:4d brd ff:ff:ff:ff:ff:ff
    inet 169.254.0.10/24 brd 169.254.0.255 scope global enp0s29u1u7u1
       valid_lft forever preferred_lft forever
    inet6 fe80::800:3eff:fe9d:854d/64 scope link 
       valid_lft forever preferred_lft forever

The network device in question is named enp0s29u1u7u1 however.

So to stop the Linux system to use this device I thought about blacklisting the module cdc_ether. But that would probably lead to the situation that other devices that use the same module would not work any more, e.g. mobile phones with USB connection.

So I decided to prevent NetworkManager from configuring the device. That can be done by editing the config file /etc/NetworkManager/NetworkManager.conf and adding a keyfile section. Additionally “keyfile” must be listed among the plugins of the main section. But in my case it was already there so that I only added the section “[keyfile]“. It looks like this:

[main]
plugins=ifupdown,keyfile,ofono
dns=dnsmasq

[ifupdown]
managed=false

[keyfile]
unmanaged-devices=mac:0a:00:3e:9d:85:4d

So the list of unmanaged devices is created from their MAC addresses. The MAC address of the device can be found with a simple “ip link show” command:

$ ip link show dev enp0s29u1u7u1
7: enp0s29u1u7u1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/ether 0a:00:3e:9d:85:4d brd ff:ff:ff:ff:ff:ff

So you just add the MAC to the list of unmanaged devices and restart NetworkManager with

$ sudo service network-manager stop
$ sudo service network-manager start

and after that the network device of the Motorola radio should stay unconfigured.