HOME ESR EXPERIMENTS LABS etc
overview Control System beam optics AP-network Vacuum NORTH ARC SOUTH ARC COOLER LINE TARGET LINE INJECTION
  AP/ESR internal privat network, Page 1 of 1  Not logged in ELOG logo
ID Date Author Category Subject
  6   Thu Jan 28 10:12:21 2021 JanGeneraldebain10: static name for USB device
When using USB/serial ports for slow control, it is advisable to manually bind a certain device to a certain device name.
This is the procedure:

1. connect the device and check the current assignment:
sudo dmesg
the device might be connected as /dev/ttyUSB0 or similar

2. check the device attributes:
udevadm info --name=/dev/ttyUSB0 --attribute-walk
note unique attributes, e.g., ATTRS{idVendor}=="XXXX" and ATTRS{idProduct}=="YYYY" or ATTRS{serial}=="ZZZZ" and others

3. add a new local rule:
sudo nano /etc/udev/rules.d/10-local.rules
add the a line as:
ACTION=="add", ATTRS{idVendor}=="XXXX", ATTRS{idProduct}=="YYYY", SYMLINK+="my_device_name"

4. reload the rules:
sudo udevadm trigger

5. check and reset usb:
lsusb
check again your device, look for PRODUCT_ID:VENDOR_ID, then reset:
usbreset PRODUCT_ID:VENDOR_ID

5. verify
udevadm info /dev/ttyUSB0
this should show at the end:
E: DEVLINKS=/dev/my_device_name
and probably some more DEVLINKS in the same line
so
udevadm info /dev/my_device_name
should also work
  5   Wed Jan 27 11:30:07 2021 JanGeneraldebian10: useful network commands
< ip a > 
overview on netwerk devices, ip-add etc

< ifdown usb_eth0 > & < ifup usb_eth0 >
unload and reload network settings for device "usb_eth0"

< nmap -sn 192.168.0.0/24 >
scan the local network for active hosts
  4   Wed Jan 27 10:44:45 2021 JanGeneraldebian10: USB-ethernet adapter
Currently we are using 
LINKSYS USB ETHERNET ADAPTER - GIGABIT USB 3.0 (Model-Nr. USB3GIG-EJ)
These work as plug-and-play with debian10. 

To assign a permanent name for the network adapter (e.g. as listed by 'ip a' command) one needs to edit/create
the file 
/etc/udev/rules.d/70-persistent-net.rules 
and add for each adapter:
SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="XX.XX.XX.XX.XX.XX", NAME="usb_eth0"

Then reload the rules with:
sudo udevadm control --reload-rules

The device with the given MAC address will now always be loaded as "usb_eth0".
  3   Wed Jan 20 11:24:25 2021 Jan GloriusGeneralatpnuc004: network settings
The current network settings on atpnuc004 are documented here.

network devices (see 'interfaces' in the attachment)
eno1 - 140.181.90.221 - GSI-network
usb_eth0 - 192.168.0.1 - ESR-network

port forwarding (see 'interfaces' in the attachment):
telnet to PowerNodes {GSI: atpnuc004:992[0-3] - ESR: 192.168.0.2[0-3]:23}
Attachment 1: interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

auto eno1
iface eno1 inet dhcp

# USB-ethernet
auto usb_eth0
#iface usb0 inet dhcp
iface usb_eth0 inet static
      address 192.168.0.1
      netmask 255.255.255.0
      broadcast 192.168.0.255

# port forwarding GSI-LAN -> ESR_LAN
#
# telnet 
# PowerNode1 - [ESR-LAN: 192.168.0.20:23 - GSI-LAN: atpnuc004:9920]
post-up iptables-legacy -t nat -A PREROUTING -i eno1 -p tcp --dport 9920 -j DNAT --to-destination 192.168.0.20:23
post-up iptables-legacy -A FORWARD -p tcp -d 192.168.0.20 --dport 23 -j ACCEPT
post-up iptables-legacy -A POSTROUTING -t nat -s 192.168.0.20 -o eno1 -j MASQUERADE
# PowerNode2 - [ESR-LAN: 192.168.0.21:23 - GSI-LAN: atpnuc004:9921]
post-up iptables-legacy -t nat -A PREROUTING -i eno1 -p tcp --dport 9921 -j DNAT --to-destination 192.168.0.21:23
post-up iptables-legacy -A FORWARD -p tcp -d 192.168.0.21 --dport 23 -j ACCEPT
post-up iptables-legacy -A POSTROUTING -t nat -s 192.168.0.21 -o eno1 -j MASQUERADE
# PowerNode3 - [ESR-LAN: 192.168.0.22:23 - GSI-LAN: atpnuc004:9922]
post-up iptables-legacy -t nat -A PREROUTING -i eno1 -p tcp --dport 9922 -j DNAT --to-destination 192.168.0.22:23
post-up iptables-legacy -A FORWARD -p tcp -d 192.168.0.22 --dport 23 -j ACCEPT
post-up iptables-legacy -A POSTROUTING -t nat -s 192.168.0.22 -o eno1 -j MASQUERADE
# PowerNode4 - [ESR-LAN: 192.168.0.23:23 - GSI-LAN: atpnuc004:9923]
post-up iptables-legacy -t nat -A PREROUTING -i eno1 -p tcp --dport 9923 -j DNAT --to-destination 192.168.0.23:23
post-up iptables-legacy -A FORWARD -p tcp -d 192.168.0.23 --dport 23 -j ACCEPT
post-up iptables-legacy -A POSTROUTING -t nat -s 192.168.0.23 -o eno1 -j MASQUERADE
  2   Wed Jan 20 11:19:03 2021 Jan GloriusComponentsList of components/IPs
This is a list of network components and their reserved IP addresses inside the private network.


IP               component
192.168.0.1      atpnuc004 (gateway)

192.168.0.20     E127 PowerNode1 (Gude Power Control 8031)
192.168.0.21     E127 PowerNode2 (Gude Power Control 8031)
192.168.0.22     dN=0 PowerNode3 (Gude Power Control 8031)
192.168.0.23     soon: PowerNode4 (Gude Power Control 8031)

192.168.0.40     RaspberryPi LN2-control
192.168.0.41     CAEN HV for HPGe detectors
  1   Wed Jan 20 11:16:00 2021 Jan GloriusGeneralGATEWAY
The gateway to the privat network is at the moment: atpnuc004

One can login using 'stoe_exp' or 'litv-exp' users.
Please do not use this machine for any experiment control or change the network settings!
ELOG V3.1.5-fc6679b