f22: how to change default gateway via line command
Rick Stevens
ricks at alldigital.com
Tue Jun 9 22:50:51 UTC 2015
On 06/09/2015 03:40 PM, Dario Lesca wrote:
> Il giorno mar, 09/06/2015 alle 15.44 +0800, Ed Greshko ha scritto:
>> 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.
>
> I have the same error:
>
> [lesca at dodo ~]$ nmcli conn show p6p1 | grep -E '(192.168.61.|ipv4.add)'
> ipv4.addresses:
> IP4.INDIRIZZO[1]: 192.168.61.80/24
> IP4.GATEWAY: 192.168.61.254
> IP4.DNS[1]: 192.168.61.254
> DHCP4.OPZIONE[4]: server_name = 192.168.61.254
> DHCP4.OPZIONE[5]: domain_name_servers = 192.168.61.254
> DHCP4.OPZIONE[7]: ip_address = 192.168.61.80
> DHCP4.OPZIONE[10]: dhcp_server_identifier = 192.168.61.254
> DHCP4.OPZIONE[13]: broadcast_address = 192.168.61.255
> DHCP4.OPZIONE[18]: routers = 192.168.61.254
> DHCP4.OPZIONE[28]: network_number = 192.168.61.0
> DHCP4.OPZIONE[30]: next_server = 192.168.61.254
>
> [lesca at dodo ~]$ LANG=c sudo nmcli conn mod p6p1 ipv4.gateway 192.168.61.250
> Error: Failed to modify connection 'p6p1': ipv4.gateway: gateway cannot be set if there are no addresses configured
>
> This occur why the field "ipv4.addresses" is empty, like many other
> "ipv4.*" flags:
>
> [lesca at dodo ~]$ nmcli conn show p6p1 | grep ipv4.
> ipv4.method: auto
> ipv4.dns:
> ipv4.dns-search:
> ipv4.addresses:
> ipv4.gateway: --
> ipv4.routes:
> ipv4.route-metric: -1
> ipv4.ignore-auto-routes: no
> ipv4.ignore-auto-dns: no
> ipv4.dhcp-client-id: --
> ipv4.dhcp-send-hostname: yes
> ipv4.dhcp-hostname: --
> ipv4.never-default: no
> ipv4.may-fail: yes
I think you have to change the method to "manual", then set the IP
address and route:
sudo nmcli conn mod p6p1 ipv4.method manual ipv4.address
192.168.61.80/24 ipv4.gateway 192.168.61.254
The "auto" method for an ethernet port means DHCP.
----------------------------------------------------------------------
- Rick Stevens, Systems Engineer, AllDigital ricks at alldigital.com -
- AIM/Skype: therps2 ICQ: 226437340 Yahoo: origrps2 -
- -
- I'm telling you that the kernel is stable not because it's a -
- kernel, but because I refuse to listen to arguments like this. -
- -- Linus Torvalds -
----------------------------------------------------------------------
More information about the users
mailing list