Every time I connect my Raspberry Pi in my computer's a USB port I need always to set the connection that is creates to my Linux Mint computer as shared. I do it via Network manager as screenshot shows (UI In Greek):
That's somewhat tedious and every time to spend 2-3 minutes to set the connection as shared in order to ssh in it. So I want once a device is plugged in a shared connection to be automatically created, therefore I won't need every time I plug the raspberry pi into a USB port to configure the network interface through network manager.
Is there a way to do this. So far once I type lsusb
I get this result:
$ lsusb
Bus 002 Device 002: ID 05e3:0732 Genesys Logic, Inc. All-in-One Cardreader
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 003: ID 1a40:0101 Terminus Technology Inc. Hub
Bus 001 Device 002: ID 4e53:5407
Bus 001 Device 010: ID 0925:3881 Lakeview Research Saleae Logic
Bus 001 Device 009: ID 0525:a4a2 Netchip Technology, Inc. Linux-USB Ethernet/RNDIS Gadget
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
The device that is created once I plugin the USB is the:
Bus 001 Device 009: ID 0525:a4a2 Netchip Technology, Inc. Linux-USB Ethernet/RNDIS Gadget
One.
Also dmesg
shows the following:
[ 2015.792407] usb 1-3: new full-speed USB device number 8 using xhci_hcd
[ 2016.368398] usb 1-3: new high-speed USB device number 9 using xhci_hcd
[ 2016.517429] usb 1-3: New USB device found, idVendor=0525, idProduct=a4a2, bcdDevice= 5.10
[ 2016.517434] usb 1-3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 2016.517437] usb 1-3: Product: RNDIS/Ethernet Gadget
[ 2016.517441] usb 1-3: Manufacturer: Linux 5.10.63+ with 20980000.usb
[ 2016.518553] cdc_subset: probe of 1-3:1.0 failed with error -22
[ 2016.520510] cdc_ether 1-3:1.0 usb0: register 'cdc_ether' at usb-0000:00:14.0-3, CDC Ethernet Device, 12:e2:73:0a:fa:92
[ 2016.550226] cdc_ether 1-3:1.0 enp0s20f0u3: renamed from usb0
[ 2017.365925] [UFW BLOCK] IN=br-c2a79e951b81 OUT= MAC= SRC=fe80:0000:0000:0000:0042:f4ff:fe99:0011 DST=ff02:0000:0000:0000:0000:0000:0000:0001 LEN=89 TC=0 HOPLIMIT=1 FLOWLBL=617835 PROTO=UDP SPT=22161 DPT=161 LEN=49
[ 2017.532279] [UFW BLOCK] IN=br-c2a79e951b81 OUT= MAC= SRC=fe80:0000:0000:0000:0042:f4ff:fe99:0011 DST=ff02:0000:0000:0000:0000:0000:0000:0001 LEN=89 TC=0 HOPLIMIT=1 FLOWLBL=617835 PROTO=UDP SPT=22161 DPT=161 LEN=49
[ 2042.958713] IPv6: ADDRCONF(NETDEV_CHANGE): enp0s20f0u3: link becomes ready
[ 2216.944793] audit: type=1400 audit(1644678209.643:133): apparmor="DENIED" operation="capable" profile="/snap/snapd/14549/usr/lib/snapd/snap-confine" pid=10514 comm="snap-confine" capability=4 capname="fsetid"
[ 2220.764823] audit: type=1326 audit(1644678213.463:134): auid=4294967295 uid=1000 gid=1000 ses=4294967295 pid=10514 comm="telegram-deskto" exe="/snap/telegram-desktop/3544/usr/bin/telegram-desktop" sig=0 arch=c000003e syscall=314 compat=0 ip=0x7f353fbdc89d code=0x50000
[ 2223.187662] audit: type=1400 audit(1644678215.883:135): apparmor="DENIED" operation="open" profile="snap.telegram-desktop.telegram-desktop" name="/etc/openal/alsoft.conf" pid=10514 comm="telegram-deskto" requested_mask="r" denied_mask="r" fsuid=1000 ouid=0
[ 2224.579172] audit: type=1326 audit(1644678217.275:136): auid=4294967295 uid=1000 gid=1000 ses=4294967295 pid=10514 comm="telegram-deskto" exe="/snap/telegram-desktop/3544/usr/bin/telegram-desktop" sig=0 arch=c000003e syscall=203 compat=0 ip=0x7f3541bb26e1 code=0x50000
[ 2224.579181] audit: type=1326 audit(1644678217.275:137): auid=4294967295 uid=1000 gid=1000 ses=4294967295 pid=10514 comm="telegram-deskto" exe="/snap/telegram-desktop/3544/usr/bin/telegram-desktop" sig=0 arch=c000003e syscall=141 compat=0 ip=0x7f353fbd834b code=0x50000
[ 2224.579187] audit: type=1326 audit(1644678217.275:138): auid=4294967295 uid=1000 gid=1000 ses=4294967295 pid=10514 comm="telegram-deskto" exe="/snap/telegram-desktop/3544/usr/bin/telegram-desktop" sig=0 arch=c000003e syscall=203 compat=0 ip=0x7f3541bb26e1 code=0x50000
[ 2224.579224] audit: type=1326 audit(1644678217.275:139): auid=4294967295 uid=1000 gid=1000 ses=4294967295 pid=10514 comm="telegram-deskto" exe="/snap/telegram-desktop/3544/usr/bin/telegram-desktop" sig=0 arch=c000003e syscall=141 compat=0 ip=0x7f353fbd834b code=0x50000
[ 2224.579342] audit: type=1326 audit(1644678217.275:140): auid=4294967295 uid=1000 gid=1000 ses=4294967295 pid=10514 comm="telegram-deskto" exe="/snap/telegram-desktop/3544/usr/bin/telegram-desktop" sig=0 arch=c000003e syscall=203 compat=0 ip=0x7f3541bb26e1 code=0x50000
[ 2224.579352] audit: type=1326 audit(1644678217.275:141): auid=4294967295 uid=1000 gid=1000 ses=4294967295 pid=10514 comm="telegram-deskto" exe="/snap/telegram-desktop/3544/usr/bin/telegram-desktop" sig=0 arch=c000003e syscall=141 compat=0 ip=0x7f353fbd834b code=0x50000
[ 2224.579507] audit: type=1326 audit(1644678217.275:142): auid=4294967295 uid=1000 gid=1000 ses=4294967295 pid=10514 comm="telegram-deskto" exe="/snap/telegram-desktop/3544/usr/bin/telegram-desktop" sig=0 arch=c000003e syscall=203 compat=0 ip=0x7f3541bb26e1 code=0x50000
[ 2224.579515] audit: type=1326 audit(1644678217.275:143): auid=4294967295 uid=1000 gid=1000 ses=4294967295 pid=10514 comm="telegram-deskto" exe="/snap/telegram-desktop/3544/usr/bin/telegram-desktop" sig=0 arch=c000003e syscall=203 compat=0 ip=0x7f3541bb26e1 code=0x50000
[ 2224.579551] audit: type=1326 audit(1644678217.275:144): auid=4294967295 uid=1000 gid=1000 ses=4294967295 pid=10514 comm="telegram-deskto" exe="/snap/telegram-desktop/3544/usr/bin/telegram-desktop" sig=0 arch=c000003e syscall=203 compat=0 ip=0x7f3541bb26e1 code=0x50000
[ 3121.350145] usb 1-5: new high-speed USB device number 10 using xhci_hcd
[ 3121.498265] usb 1-5: New USB device found, idVendor=0925, idProduct=3881, bcdDevice= 0.01
[ 3121.498271] usb 1-5: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[ 3122.347647] [UFW BLOCK] IN=br-c2a79e951b81 OUT= MAC= SRC=fe80:0000:0000:0000:0042:f4ff:fe99:0011 DST=ff02:0000:0000:0000:0000:0000:0000:0001 LEN=89 TC=0 HOPLIMIT=1 FLOWLBL=617835 PROTO=UDP SPT=22161 DPT=161 LEN=49
[ 3122.513998] [UFW BLOCK] IN=br-c2a79e951b81 OUT= MAC= SRC=fe80:0000:0000:0000:0042:f4ff:fe99:0011 DST=ff02:0000:0000:0000:0000:0000:0000:0001 LEN=89 TC=0 HOPLIMIT=1 FLOWLBL=617835 PROTO=UDP SPT=22161 DPT=161 LEN=49
[ 3122.680261] [UFW BLOCK] IN=br-c2a79e951b81 OUT= MAC= SRC=fe80:0000:0000:0000:0042:f4ff:fe99:0011 DST=ff02:0000:0000:0000:0000:0000:0000:0001 LEN=89 TC=0 HOPLIMIT=1 FLOWLBL=617835 PROTO=UDP SPT=22161 DPT=161 LEN=49
[ 3122.880905] [UFW BLOCK] IN=enp3s0 OUT= MAC= SRC=fe80:0000:0000:0000:1be3:4633:095f:d015 DST=ff02:0000:0000:0000:0000:0000:0000:0001 LEN=64 TC=0 HOPLIMIT=1 FLOWLBL=663885 PROTO=UDP SPT=8612 DPT=8612 LEN=24
[ 3122.880917] [UFW BLOCK] IN=enp3s0 OUT= MAC= SRC=fe80:0000:0000:0000:1be3:4633:095f:d015 DST=ff02:0000:0000:0000:0000:0000:0000:0001 LEN=64 TC=0 HOPLIMIT=1 FLOWLBL=837265 PROTO=UDP SPT=8612 DPT=8610 LEN=24
[ 3122.880928] [UFW BLOCK] IN=br-c2a79e951b81 OUT= MAC= SRC=fe80:0000:0000:0000:0042:f4ff:fe99:0011 DST=ff02:0000:0000:0000:0000:0000:0000:0001 LEN=64 TC=0 HOPLIMIT=1 FLOWLBL=255464 PROTO=UDP SPT=8612 DPT=8612 LEN=24
[ 3122.880938] [UFW BLOCK] IN=br-c2a79e951b81 OUT= MAC= SRC=fe80:0000:0000:0000:0042:f4ff:fe99:0011 DST=ff02:0000:0000:0000:0000:0000:0000:0001 LEN=64 TC=0 HOPLIMIT=1 FLOWLBL=341915 PROTO=UDP SPT=8612 DPT=8610 LEN=24
[ 3122.880946] [UFW BLOCK] IN=vethc930aa4 OUT= MAC= SRC=fe80:0000:0000:0000:0814:60ff:fee9:705f DST=ff02:0000:0000:0000:0000:0000:0000:0001 LEN=64 TC=0 HOPLIMIT=1 FLOWLBL=674828 PROTO=UDP SPT=8612 DPT=8612 LEN=24
[ 3122.880953] [UFW BLOCK] IN=vethc930aa4 OUT= MAC= SRC=fe80:0000:0000:0000:0814:60ff:fee9:705f DST=ff02:0000:0000:0000:0000:0000:0000:0001 LEN=64 TC=0 HOPLIMIT=1 FLOWLBL=1048135 PROTO=UDP SPT=8612 DPT=8610 LEN=24
[ 3122.880960] [UFW BLOCK] IN=enp0s20f0u3 OUT= MAC= SRC=fe80:0000:0000:0000:1eaf:0969:516b:39cb DST=ff02:0000:0000:0000:0000:0000:0000:0001 LEN=64 TC=0 HOPLIMIT=1 FLOWLBL=326809 PROTO=UDP SPT=8612 DPT=8612 LEN=24
And the distribution that I run is Linux Mint 19. I suppose udev
is the approach I must follow, but I do not know how.
But what I want is once I plugin my raspberry pi in Gadget mode to set the connection as
Edit 1
For now, I managed to set a udev rule in order to have a name to it:
SUBSYSTEM=="net", ACTION=="add", ATTRS{idVendor}=="0525", ATTRS{idProduct}=="a4a2", NAME="rpi0"
But what I did I managed to rename the interface from usb0
to rpi0
. But I am stuck on how I can specify to the netowkr manager to have specific settings for the interface I plugin.
What I want it once I plugin the raspberry pi not to attempt to autoconnect by creating the file /etc/NetworkManager/conf.d/rpi0.conf
[main]
no-auto-default=rpi0
But still every time I try to connect a new network connection is created.
Is there a way to share my connection and bypass network manager as a whole?