Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #246447

Re: Under each of these scenarios, what is the neatest and simplest way to manipulate the /etc/network/interfaces file?

From Tim Woodall <debianuser@woodall.me.uk>
Newsgroups linux.debian.user
Subject Re: Under each of these scenarios, what is the neatest and simplest way to manipulate the /etc/network/interfaces file?
Date 2022-03-19 08:20 +0100
Message-ID <E2Bxv-2JtR-5@gated-at.bofh.it> (permalink)
References <E2wRb-2GzG-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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
>
>

Back to linux.debian.user | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Under each of these scenarios, what is the neatest and simplest way  to manipulate the /etc/network/interfaces file? Stella Ashburne <rewefie@gmx.com> - 2022-03-19 03:20 +0100
  Re: Under each of these scenarios, what is the neatest and simplest  way to manipulate the /etc/network/interfaces file? Tim Woodall <debianuser@woodall.me.uk> - 2022-03-19 08:20 +0100
    Re: Under each of these scenarios, what is the neatest and simplest  way to manipulate the /etc/network/interfaces file? Stella Ashburne <rewefie@gmx.com> - 2022-03-19 13:10 +0100
  Re: Under each of these scenarios, what is the neatest and simplest  way to manipulate the /etc/network/interfaces file? Eduardo M KALINOWSKI <eduardo@kalinowski.com.br> - 2022-03-19 12:20 +0100
    Re: Under each of these scenarios, what is the neatest and simplest  way to manipulate the /etc/network/interfaces file? Stella Ashburne <rewefie@gmx.com> - 2022-03-19 13:10 +0100
      Re: Under each of these scenarios, what is the neatest and simplest  way to manipulate the /etc/network/interfaces file? Eduardo M KALINOWSKI <eduardo@kalinowski.com.br> - 2022-03-19 13:30 +0100
        Re: Under each of these scenarios, what is the neatest and simplest  way to manipulate the /etc/network/interfaces file? "hdv@gmail" <hdv.jadev@gmail.com> - 2022-03-19 13:30 +0100
  Re: Under each of these scenarios, what is the neatest and simplest  way to manipulate the /etc/network/interfaces file? David Wright <deblis@lionunicorn.co.uk> - 2022-03-20 15:40 +0100
    Re: Under each of these scenarios, what is the neatest and simplest  way to manipulate the /etc/network/interfaces file? Tim Woodall <debianuser@woodall.me.uk> - 2022-03-21 07:10 +0100
      Re: Under each of these scenarios, what is the neatest and simplest  way to manipulate the /etc/network/interfaces file? David Wright <deblis@lionunicorn.co.uk> - 2022-03-22 03:00 +0100
    Re: Under each of these scenarios, what is the neatest and simplest  way to manipulate the /etc/network/interfaces file? Stella Ashburne <rewefie@gmx.com> - 2022-03-23 13:40 +0100
      Re: Under each of these scenarios, what is the neatest and simplest  way to manipulate the /etc/network/interfaces file? David Wright <deblis@lionunicorn.co.uk> - 2022-03-23 16:30 +0100
    Re: Under each of these scenarios, what is the neatest and simplest  way to manipulate the /etc/network/interfaces file? Stella Ashburne <rewefie@gmx.com> - 2022-03-24 03:20 +0100
      Re: Under each of these scenarios, what is the neatest and simplest  way to manipulate the /etc/network/interfaces file? David Wright <deblis@lionunicorn.co.uk> - 2022-03-25 03:20 +0100
        Re: Under each of these scenarios, what is the neatest and simplest  way to manipulate the /etc/network/interfaces file? Stella Ashburne <rewefie@gmx.com> - 2022-03-25 07:40 +0100
          Re: Under each of these scenarios, what is the neatest and simplest  way to manipulate the /etc/network/interfaces file? David Wright <deblis@lionunicorn.co.uk> - 2022-03-26 05:50 +0100
            Re: Under each of these scenarios, what is the neatest and simplest  way to manipulate the /etc/network/interfaces file? Curt <curty@free.fr> - 2022-03-26 10:20 +0100
            Re: Under each of these scenarios, what is the neatest and simplest  way to manipulate the /etc/network/interfaces file? Greg Wooledge <greg@wooledge.org> - 2022-03-26 13:50 +0100
              Re: Under each of these scenarios, what is the neatest and simplest  way to manipulate the /etc/network/interfaces file? David <bouncingcats@gmail.com> - 2022-03-27 01:10 +0100
              Re: Under each of these scenarios, what is the neatest and simplest  way to manipulate the /etc/network/interfaces file? Andy Smith <andy@strugglers.net> - 2022-03-27 04:30 +0200

csiph-web