Este conteúdo não está disponível no idioma selecionado.

4.2. Configuring Static Routes Using nmcli


To configure static routes using the nmcli tool, use one of the following:
  • the nmcli command line
  • the nmcli interactive editor

Example 4.1. Configuring Static Routes Using nmcli

To configure a static route for an existing Ethernet connection using the command line:
~]# nmcli connection modify enp1s0 +ipv4.routes "192.168.122.0/24 10.10.10.1"
Copy to Clipboard Toggle word wrap
This will direct traffic for the 192.168.122.0/24 subnet to the gateway at 10.10.10.1

Example 4.2. Configuring Static Routes with nmcli Editor

To configure a static route for an Ethernet connection using the interactive editor:
~]$ nmcli con edit ens3
===| nmcli interactive connection editor |===

Editing existing '802-3-ethernet' connection: 'ens3'

Type 'help' or '?' for available commands.
Type 'describe [<setting>.<prop>]' for detailed property description.

You may edit the following settings: connection, 802-3-ethernet (ethernet), 802-1x, dcb, ipv4, ipv6, tc, proxy
nmcli> set ipv4.routes 192.168.122.0/24 10.10.10.1
nmcli> save persistent
Connection 'ens3' (23f8b65a-8f3d-41a0-a525-e3bc93be83b8) successfully updated.
nmcli> quit
Copy to Clipboard Toggle word wrap
Voltar ao topo
Red Hat logoGithubredditYoutubeTwitter

Aprender

Experimente, compre e venda

Comunidades

Sobre a documentação da Red Hat

Ajudamos os usuários da Red Hat a inovar e atingir seus objetivos com nossos produtos e serviços com conteúdo em que podem confiar. Explore nossas atualizações recentes.

Tornando o open source mais inclusivo

A Red Hat está comprometida em substituir a linguagem problemática em nosso código, documentação e propriedades da web. Para mais detalhes veja o Blog da Red Hat.

Sobre a Red Hat

Fornecemos soluções robustas que facilitam o trabalho das empresas em plataformas e ambientes, desde o data center principal até a borda da rede.

Theme

© 2025 Red Hat