ifdown usb0 edit file
ifup wlo1 Will avoid the need to reboot. You can use mapping lines to achieve the same thing. mapping eth0 script /usr/local/sbin/map-scheme iface eth0_home inet static address 192.168.1.3 netmask 255.255.255.0 gateway 192.168.1.254 iface eth0_work inet dhcp and the map-scheme script needs to output eth0_home or eth0_work depending on where the machine thinks it is. (In this case I'd ping the home gatwway to detect. $1 will be eth0 in the script) On my laptop I have: mapping intwlan0 script /usr/local/sbin/map-scheme.wlan map 88:03:55:E0:AC:7F Brandon EE-kbfcwm map B4:FB:E4:4D:28:4B MarshamCourt MarshamCourt map 78:8A:20:2A:BE:C6 MarshamCourt MarshamCourt map any unknown Avanti_Free_WiFi map any hotel BWGarstangCountryHotel and my script looks for access points to connect to. This was written way back in the dark ages where real men used the console - but it still works today :-) On Sat, 19 Mar 2022, Stella Ashburne wrote:
Hi There are instances in which my machine is connected to a mobile hotspot. And in some situations, it's connected to a smartphone via USB tethering. And when I'm in the office, I may connect it to a LAN cable. Below are the contents of my /etc/network/interfaces file: # 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 # The primary network interface #allow-hotplug enx61s07 #iface enx60a4b79d7f48 inet static # address 192.168.1.35/24 # gateway 192.168.1.1 # dns-* options are implemented by the resolvconf package, if installed # dns-nameservers 1.1.1.1 8.8.8.8 # The primary network interface for USB tethering allow-hotplug usb0 iface usb0 inet dhcp static address 192.168.42.35 gateway 192.168.42.1 # dns-* options are implemented by the resolvconf package, if installed dns-nameservers 1.1.1.1 8.8.8.8 # The primary network interface for wireless connections #allow-hotplug wlo1 #iface wlo1 inet dhcp static # wpa-ssid Osia27 # wpa-psk string-of-alphanumberice-characters # address 192.168.43.28 # gateway 192.168.43.1 # dns-nameservers 1.1.1.1 8.8.8.8 Questions: 1. At the moment, if I wish to change to using a mobile hotspot from USB tethering, I'll edit the /etc/network/interfaces file, uncomment the applicable lines under #The primary network interface for wireless connections and place a # in front of all the lines under #The primary network interface for USB tethering Instead of carrying out the above steps, is there a neater and simpler way? 2. What is the command to type in a terminal after I have made changes to the /etc/network/interfaces file without rebooting my machine? Best regards. Stella