Score:0

Using netplan to setup a shared connection

ng flag

Is it possible to set up a shared connection (DHCP server) on an interface using just the netplan configuration? I can use NetworkManager as follows to set up a shared connection:

sudo nmcli c add con-name <name> type ethernet ifname <iface> ipv4.method shared ipv6.method ignore ipv4.addresses <ip>

However, I was wondering if I could do this through the netplan yaml file and I wouldn't have to do it manually.

Another requirement I have is to be able to switch the interface to be a DHCP client or DHCP server, for example, when user presses a button. So is this kind of configuration possible to setup through netplan, or do I just have to manually change the interface to be a DHCP client vs server using nmcli.

Thanks

Score:0
us flag

This is not possible. Netplan restricts itself to managing the network and DNS configuration of the host that it is running on; configuring and launching additional services such as a DHCP server is out of scope for the present design. If you need this functionality from NetworkManager, you should manage it directly through NM using nmcli or the like as above, not using netplan.

Alternatively, you can manage the network configuration with netplan and manually configure a DHCP server and configure iptables (or nftables) for NAT; but if your expectation is a push-button solution like the NetworkManager option, this will be a disappointing experience.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.