1

I'm looking for a convenient and easy way to switch between network configurations under Linux. I would prefer something that would work on Raspberry PI OS, but I'm open to other distributions.

I would like to create several network profiles similar to the following:

Profile 1: One adapter active, get address via DHCP, use default route.

Profile 2: One adapter active, fixed IP address, running dhcpd to hand out address.

Profile 3: One ethernet adapter (DHCP, default route), one WiFi adapter running hostapd, dhcpd. Route WiFi client up to default route, possibly with NAT.

Profile 4: Bridge two ethernet adapters.

These are just some examples. My options seem to be: 1) Make multiple copies of all network configuration files and copy them in/out as needed and restart the network. 2) Disable all system control of the network and have scripts that manually configure links and start daemons.

Neither of these seem all that elegant. I'm hoping for something better.

1 Answer 1

0

Lets start with a question: how to choose which option is needed right now?

In general, I would just write a script setting up the network in a desired way, and on demand execute the necessary one.

2
  • I'm thinking this might be an option. But there is some housekeeping involved. The scripts will need to track what daemons, dhcpd/hostapd for instance, they start. Either the script stays running and kills daemons with a trap. Or a second shutdown/stop script will be needed. Commented Apr 16, 2021 at 1:27
  • Yes, but the 'network shutdown script' can be just one script. Something like 'check the daemon is running - shut it, go to next daemon/interface'. And the setup scripts would just call this global shutdown script before setting whatever is needed. Commented Apr 16, 2021 at 13:03

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.