Actions

Difference between revisions of "USB to Ethernet"

From SharedSkies

 
Line 20: Line 20:
 
   nmcli con up usb-ethernet
 
   nmcli con up usb-ethernet
  
3.  Check that it is present
+
3.  Check that it is present with "ifconfig" or "ip a"
  
  ifconfig
+
If a message appears that there are other connections "usb-enthernet" and a uuid is provided, then re-issue the nmcli con up
 
+
 
   eth1  Link encap:Ethernet  HWaddr 00:05:1B:D0:88:E3 
+
   nmcli con up UUID
          inet addr:192.168.1.1  Bcast:192.168.1.255  Mask:255.255.255.
+
 
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
+
where "UUID" is the uuid that was echoed with the error message.
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
+
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
+
          collisions:0 txqueuelen:1000
+
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)
+
  
 
4.  Configure dnsmasq.conf with lines such as
 
4.  Configure dnsmasq.conf with lines such as

Latest revision as of 06:02, 8 October 2018

Typically a laptop or mini computer will have only one wired Ethernet connection (if that), and for using it to operate Ethernet interfaced hardware you would need an adapter through the USB3 connection on the laptop. We have found that that the StarTech ST3300GU3 adapter works nicely on a an HP Z-Book laptop to add 3 new USB3 ports and a network connection from a powered USB3 connection on the laptop. The device is recognized immediately by OpenSuse Leap 42.3. However, since a laptop usually is configured to use networkmanager in order to have wireless handled effectively, it is not going to configure the new network as a static device for use by instrumentation. The solution to this conundrum is first to use either wicked on the networkmanager command line interface nmcli to control the adapter, and then to use dnsmasq to use the adapter to provide services for the hardware.

We use dnsmasq to manage local area networks (LAN) from a second network device on telescope computers. Typically the device address is set to 192.168.0.1/24, or to 1.1/24 if there is another LAN operating. The configuration file for dnsmasq is set to point to the device, i.e. eth1, to which the switch is attached.

This works well if (a) there is a switch attached and turned on, and (b) the computer is running the wickedd manager which is the default in current Opensuse releases based on systemd. It is seeming not possible, or certainly not straightforward, to run a lan from a laptop which is configured with networkmanager.

To attach a networked instrument such as a camera to a laptop that by default is configured with network manager the options are

  • Attach the device to a switch which itself is integrated into a LAN with DHCP provided by another computer system.
  • Custom configure the wired network interface using nmcli.
  • Change the laptop networking to run wickedd instead of networkmanager.

The second method using the powerful console command line interface for Network Manager is the best solution but requires specific commands for each situation. A common problem has been network management when a device is to be attached to an Ethernet adapter on a USB3 connection. For example, we use a StarTech adapter that runs on a powered laptop port to provide both ethernet and additional USB3 connections to a camera and environmental sensors. The network connection has to be associated with dnsmasq to enable DHCP connections from cameras. With networkmanager on opensuse, this new device is not configurable through the YAST tools. The solution is

1. Boot the computer with the device installed so that it is recognized without an issue

2. As root create the connection and bring it up

 nmcli con add con-name "usb-ethernet" ifname eth1 type ethernet ip4 192.168.1.1/24
 nmcli con up usb-ethernet

3. Check that it is present with "ifconfig" or "ip a"

If a message appears that there are other connections "usb-enthernet" and a uuid is provided, then re-issue the nmcli con up

 nmcli con up UUID

where "UUID" is the uuid that was echoed with the error message.

4. Configure dnsmasq.conf with lines such as

 interface=eth1  
 dhcp-range=192.168.1.50,192.168.1.100,12h

and add a script such as our "show_dnsmasq" that will return the contents of the dnsmasq log

 cat /var/lib/misc/dnsmasq.leases


5. Enable and start dnsmasq in sysconfigure

These changes should remain in effect until removed, and a camera attached to the new network connection will be seen on the local "usb-ethernet",

The third option is the default for a desktop system. The disadvantage to the third option in the laptop world is that wickedd does not have the end-user support for wireless networking that networkmanager provides. Further, when switching from one system to another, there are inevitable configuration issues, particularly with the management of host resolution and the file /etc/resolv.conf.

The basic process is to use yast or yast2, select network device configuration, and change the manager to wickedd. This will allow editing the individual network devices. Set the static ip address for the device that will handle the LAN, edit the device entry, change it to "internal", and set it to activate on boot through the setting in the Global tab. Shutdown and reboot the system. The ethernet adapter must be inserted at boot time.

As superuser use "wicked show all" to see the status of the devices, or "wicked ifstatus eth1" to see the status of one network device. Each device has a configuration file in /etc/sysconfig/network/, such as ifcfg-eth1 for eth1. Within that file there should be a line which says

LINK_REQUIRED=no

As of Opensuse 42.3, this line is not inserted by the yast2 configurator, and consequently the network device will stall and wickedd will report "setup-in-progress". The simple solution is to enter this by hand if you see this error and need a second network active on power up.