IFSCHEME(8)

πŸ“¦ version 1.7, in ubuntu jammy, ubuntu noble

πŸ’– IFSCHEME(8) πŸ’–

okay so bestie, welcome to ifscheme, a page from the Commands corner of the manual. it's a scheme control for network interfaces, and yes it is exactly as iconic as it sounds. let's get into it πŸŽ€


✨ NAME ✨

ifscheme β€” scheme control for network interfaces πŸ¦‹


🌸 SYNOPSIS 🌸

ifscheme [-v] [[-s] newscheme]

mapping <interface> script ifscheme-mapping

πŸ’… DESCRIPTION πŸ’…

so ifscheme lets you switch between network configuration schemes, or just ask which scheme you're currently on. it plays nice with ifup(8) and interfaces(5). like, imagine you're on a laptop and you want a "home" scheme and a "work" scheme for one network device. then when you move between home and work, one little command and boom πŸ’₯ your networking is reconfigured. main character energy fr fr.

if you run it with no parameters at all, it will just tell you what the current network scheme is. vibe check, but for your network. πŸ‘‘

the ifscheme-mapping utility is the little helper that tells the ifup and ifdown utilities about the current scheme. it's giving backstage crew. 🫢


πŸ”₯ OPTIONS πŸ”₯

  • -v, --verbose β€” run in verbose mode. this also gets passed in to the ifup and ifdown programs, so everyone hears the tea. πŸ—£οΈ
  • -l, --list β€” list all the schemes available/defined in /etc/network/interfaces. the full roster, no cap. πŸ“‹
  • newscheme, -s newscheme, --scheme newscheme β€” change to a new network configuration scheme. when the scheme changes, network interfaces that were using the old scheme get taken down and brought back up so they use the new configuration scheme. πŸ’«
⚠️ okay important: -s or --scheme are mandatory if newscheme begins with a -. otherwise it'll get confused and think your scheme name is a flag, and nobody wants that.

🌈 CONFIGURATION 🌈

for the program to actually do anything useful when a scheme is selected, you have to edit /etc/network/interfaces and add a mapping for the interface (or interfaces) that get controlled per-scheme. it's giving "you have to do your part, bestie".

suppose you want to control eth0 this way. you might already have an existing eth0 configuraton in there, like:

auto eth0

iface eth0 inet static
     address 192.168.1.5
     netmask 255.255.255.0
     gateway 192.168.1.1

to change this so you can chose between static routing and dhcp, replace it with the following (and honestly, it helps to ifdown the interface first):

auto eth0

mapping eth0
     script ifscheme-mapping

iface eth0-home inet static
     address 192.168.1.5
     netmask 255.255.255.0
     gateway 192.168.1.1

iface eth0-work inet dhcp

so now if you run ifscheme home and then ifup the interface, you'll get the eth0-home configuration stanza. ✨ if you run ifscheme work, it gets changed to the eth0-work stanza. you can add more stanzas as you desire, but the label must always be of the form <hardware interface>-<scheme name>. periodt.

and if you have a second interface (maybe a wireless network card on eth1)? you can duplicate all of the above for that interface, changing the eth0 and the configuration details as appropriate. but remember πŸ’€ β€” you gotta add an iface stanza for every scheme name for that second interface too. no skipping.


πŸŽ€ FILES πŸŽ€

  • /etc/network/interfaces β€” the interfaces definition file πŸ—‚οΈ
  • /etc/network/run/scheme β€” the current scheme ⭐
  • /etc/network/run/ifstate β€” a record of the current state of the interfaces, managed by ifup and ifdown πŸ“

πŸ’€ BUGS πŸ’€

  • all schemed interfaces will have the same scheme. 😭
  • any schemed interface which does not have an entry for the current scheme and is not configured when the scheme is changed will not be successfully configured when it is brought up. that's just how it is, bestie.

πŸ‘€ SEE ALSO πŸ‘€

interfaces(5) ifup(8) ifdown(8)


πŸ“œ DISTRIBUTION πŸ“œ

redistribution is subject to the GNU public license. 🫢


πŸ’œ AUTHORS πŸ’œ

Joey Hess <joey@kitenet.net>, Peter Wilson <pwilson@cs.hmc.edu>


okay that's the whole thing! this was ifscheme(8) from the Commands section of the manual β€” same page name at the top and at the bottom, no date on this one, so that's all the metadata we've got. go configure your little heart out bestie, you ate πŸ’…πŸŒˆβ­

πŸ“¦ where this page comes from