1

I'm trying to activate ip forwarding at boot-time on my ubuntu core image. I can run the command:

sudo sysctl -w net.ipv4.ip_forward=1

It works. Then I reboot the machine, the forwarding is gone. On ubuntu server I can update the file /etc/sysctl.conf .

This file is "read only" in ubuntu-core.

What is the "prefered" way to add ip forwarding in ubuntu core?

// Micke

2 Answers 2

2

If you have superuser permissions you can edit any file with any permissions. Open /etc/sysctl.conf with your favourite editor (vi, nano etc) find string #net.ipv4.ip_forward=1, remove the leading # symbol, save the changes. And run sudo sysctl -p.

Also, you can reboot your machine to make sure the changes are in place.

2

Configuration files in /etc/sysctl.d/ are available for read-write on recent Ubuntu Core.

On Ubuntu Core 18, I just tested adding a line here - sudo vi /etc/sysctl.d/10-snapd-network.conf :

# manually adding ip forwarding
net.ipv4.ip_forward=1

-> that does the trick.

Note: It would probably be neater to be able to snap set system network.ipv4-ip-forward=true, like one can for example snap set system network.ipv6-disable=true

But that doesn't seem to be possible at the moment.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .