I have a bunch of Ubuntu machines on my work ethernet LAN and I need to modify the default gateway.
I'd rather not traipse round, interrupt people's work, to right click an applet, preferring instead to ssh in, which can be automated :-)
I know I can change the default live gateway with ip route replace default via 1.2.3.4
but this does not update NM's stored connection.
In my case each machine will only have one stored wired connection.
How can I update the stored gateway IP from the command line?
All configuration from Network Manager are in
/etc/NetworkManager/system-connections/
On this please you will find
Wired connection 1
witch is probably configuration file of youlan
connection. You can edit itsudo nano /etc/NetworkManager/system-connections/Wired connection 1
You can change
ip
,network mask
orgateway
. After change you made, save and restartNM
with commandI accepted 2707974's answer (great name) but here for anyone wanting to automate this stuff with a one-liner to change from
1.2.3.4
to5.6.7.8
Of course this assumes that
1.2.3.4
is only found in the files in relation to the appropriate thing - so for me it was the default gateway and so the IP address only occurred once.