f22: how to change default gateway via line command
Ed Greshko
ed.greshko at greshko.com
Tue Jun 9 07:44:29 UTC 2015
On 06/09/15 15:26, James Hogarth wrote:
>
>
> On 8 Jun 2015 13:12, "Dario Lesca" <d.lesca at solinos.it <mailto:d.lesca at solinos.it>> wrote:
> >
> > Il giorno sab, 06/06/2015 alle 21.43 +0300, Alchemist ha scritto:
> > > Couple of possible solutions
> >
> > Thanks Alchemist, one of that sure probably partially solves my
> > problem.
> >
> > But the question is: Why in f22 (or new version of NetworkManager?) it
> > has removed the option to change the default gateway via "ip r rep..."
> > command line, like i do in previous version or all other version of
> > redhat or centos?
> >
> > I thing this is a issue, not a feature.
> >
> > Thanks
> >
>
> Think of it this way.
>
> You have your network manager configured (via static or dhcp) to have your default route pointed somewhere.
>
> NM tries to maintain its configuration so when it notices you've changed the route at the kernel level it doesn't know it's an admin override and fixes what it thinks is a broken setup.
>
> On NM based systems instead of using ip route try the nmcli command.
>
> Something like this ought to work:
>
> nmcli conn mod <connection-profile-name> ipv4.gateway <ip-address-of-gateway>
>
> You can see the present configuration NM thinks it should be with:
>
> nmcli conn show <connection-profile-name>
>
>
Or not....
[root at f22k ~]# nmcli conn mod enp0s3 ipv4.gateway 192.168.1.18
Error: Failed to modify connection 'enp0s3': ipv4.gateway: gateway cannot be set if there are no addresses configured
FWIW, on this system ....
[root at f22k ~]# ip route sho
default via 192.168.1.1 dev enp0s3 proto static metric 100
192.168.1.0/24 dev enp0s3 proto kernel scope link src 192.168.1.224 metric 100
[root at f22k ~]# nmcli conn show enp0s3 | grep 192.168.1.1
IP4.GATEWAY: 192.168.1.1
IP4.DNS[1]: 192.168.1.1
DHCP4.OPTION[5]: domain_name_servers = 192.168.1.1
DHCP4.OPTION[8]: dhcp_server_identifier = 192.168.1.1
DHCP4.OPTION[17]: routers = 192.168.1.1
DHCP4.OPTION[29]: next_server = 192.168.1.1
I'm not the OP, but I figured I'd test it out anyway.
More information about the users
mailing list