Configuração IPv4
Por razões óbvias, o IPv4 é totalmente suportado no firmware padrão.
Veja também: Rotas IPv4 estáticas
Configuração upstream para interfaces WAN
As seções a seguir descrevem a configuração de conexões IPv4 com seu ISP ou um roteador upstream.
Para um uplink com conectividade IPv4 nativa, você pode usar a configuração padrão.
config interface 'wan' option device 'eth0.2' option proto 'dhcp'
Protocol "static", IPv4
Name | Type | Required | Default | Description |
---|---|---|---|---|
ipaddr | ip address | yes, if no ip6addr is set. | (none) | IP address. [openwrt 12.09] It could be a list of ipaddr , that is: several ipaddresses will be assigned to the interface. If, instead of a list, several ipaddr are specified as options, only the last is applied. |
netmask | netmask | yes, if no ip6addr is set | (none) | Netmask |
gateway | ip address | no | (none) | Default gateway |
broadcast | ip address | no | (none) | Broadcast address (autogenerated if not set) |
dns | list of ip addresses | no | (none) | DNS server(s) |
dns_metric | integer | no | 0 | DNS metric |
dns_search | list of domain names | no | (none) | Search list for host-name lookup, relevant only for the router |
metric | integer | no | 0 | Specifies the default route metric to use |
Protocol "dhcp"
Name | Type | Required | Default | Description |
---|---|---|---|---|
broadcast | boolean | no | 0 | Enable the broadcast flag in DHCP requests, required for certain ISPs, e.g. Charter with DOCSIS 3 |
ipaddr | IP address | no | (none) | IP address to request from the DHCP server |
hostname | string | no | system hostname | Hostname to include in DHCP requests (option 12) |
clientid | string | no | (none) | Override client identifier in DHCP requests (option 61) |
vendorid | string | no | udhcp VERSION | Override the vendor class in DHCP requests (option 60) |
dns | list of ip addresses | no | (none) | Supplement DHCP-assigned DNS server(s), or use only these if peerdns is 0 |
peerdns | boolean | no | 1 | Use DHCP-provided DNS server(s) |
defaultroute | boolean | no | 1 | Whether to create a default route via the received gateway |
customroutes | string | no | (none) | Space-separated list of additional routes to insert via the received gateway |
metric | integer | no | 0 | Specifies the route metric to use for both default route and custom routes |
classlessroute | boolean | no | 1 | Whether to request the “classless route” option (DHCP option 121) — available since LEDE r2001 |
reqopts | string | no | (none) | Space-separated list of additional DHCP options to request from the server |
sendopts | string | no | (none) | Space-separated list of additional DHCP options to send to the server. Syntax: option:value where option is either an integer code or a symbolic name such as hostname . |
norelease | boolean | no | 0 | If set DO NOT release DHCP address on interface shutdown |
zone | firewall zone | no | (none) | Firewall zone to which this interface should be added |
Esses parâmetros são gerenciados parcialmente pelo netifd (em
interface.c
) e parcialmente por um script de shell em lib/netifd/proto/dhcp.sh
.
Observe que, antes do commit 3cee6f3f24, a opção norelease era conhecida como release e tinha o sentido oposto.
Informações desatualizadas. Por favor, revise e teste:
Se uma interface estiver configurada como cliente DHCP, a rota padrão recebida pelo DHCP será a única listada e removerá outras rotas/métricas padrão definidas para outras interfaces se essas interfaces vierem “antes” da interface com DHCP em termos de valores de “dispositivo”.
Por exemplo:
config interface 'wan' option device 'eth0' option proto 'static' config interface 'wan2' option device 'eth1' option proto 'dhcp'
A interface com DHCP vem depois (porque eth1 vem depois de eth0 em ordem lexicográfica) e substituirá as rotas padrão configuradas pela interface “wan”, enquanto o contrário não é verdadeiro:
config interface 'wan' option device 'eth0' option proto 'dhcp' config interface 'wan2' option device 'eth1' option proto 'static'
Ambas as rotas padrão configuradas por WAN e WAN2 aparecerão na tabela de roteamento.
Configuração de downstream para interfaces LAN
Para um downlink com conectividade IPv4, você pode usar a configuração padrão. O servidor DHCP é habilitado por padrão. Consulte Configuração DHCP para obter mais detalhes.
config interface 'lan' option device 'br-lan' option proto 'static' option netmask '255.255.255.0' option ip6assign '60' option ipaddr '192.168.1.1' config device 'lan_dev' option name 'br-lan' option type 'bridge' list ports 'lan3' list ports 'lan4'