Score:0

How to change Ubuntu network setting by editing/creating config file?

cz flag

In Ubuntu 20.04 desktop, there is a GUI network tool in All Settings -> Network.

If I set a static IP to some network adapter, there will be a config file generated in /etc/NetworkManager/system-connections

But the file is generated by GUI only if it's configured before. If I only have ssh access to a Ubuntu, how to set a static IP to another network adapter?

the config file is like:

[connection]
id=Wired connection 1
uuid=e5b1ad45-b127-3590-bfd3-99a4c39c9c16
type=ethernet
autoconnect-priority=-999
interface-name=eno1
permissions=
timestamp=1629423741

[ethernet]
mac-address-blacklist=

[ipv4]
address1=192.168.1.30/16,192.168.1.1
dns=192.168.1.1;
dns-search=
ignore-auto-dns=true
method=manual

[ipv6]
addr-gen-mode=stable-privacy
dns-search=
method=auto

[proxy]

If I copy the config file, which part should I change? I guess I need to change interface-name=eno1 at least, should I also change uuid and id? Is uuid any random uuid?

In some device, I also see mac address in the config file (to my surprise, this config file does not have it), if mac is present, should I also put the same mac as I get from ifconfig?

cn flag
see `nmcli` for the command line equivalent https://developer-old.gnome.org/NetworkManager/stable/nmcli.html
N0rbert avatar
zw flag
Or `nmtui` maybe an option too.
Score:0
cz flag

nmtui is the tool I wish I had known a month ago, which is actually already installed in my remote Ubuntu.

Felix Xu avatar
cz flag
I also wish all gnome GUI operations have companying text based ui like nmtui (maybe it's already the truth?) so that I only need ssh and will never need a software like remote vnc.
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.