Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
docs:user-guide:base-system:network:basic-ipv4-configuration [2018/02/17 16:11] bobafetthotmaildocs:guide-user:network:ipv4:start [2021/11/27 17:36] (current) – split to docs:guide-user:network:ipv4:configuration vgaetera
Line 1: Line 1:
-===== IPv4 ====+====== IPv4 ====== 
 +{{pagequery>* ns:.;sort=ns,title;group;display={title};hidestart;hidejump}}
  
-Due to obvious reasons, IPv4 is fully supported in default firmware. 
- 
-==== Upstream configuration for WAN-Interfaces ==== 
-The following sections describe the configuration of IPv4 connections to your ISP or an upstream router.  
- 
-For an uplink with native IPv4 connectivity you can just use the default configuration. 
- 
-<code>root@lede:/# uci show network 
-... 
-network.wan=interface 
-network.wan.ifname='eth0.2' 
-network.wan.proto='dhcp' 
-...</code> 
- 
-<code>root@lede:/# cat /etc/config/network 
-... 
-config interface 'wan' 
-        option ifname 'eth0.2' 
-        option proto 'dhcp' 
-...</code> 
- 
-=== 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_search'' | list of domain names | no | //(none)// | Search list for host-name lookup | 
-| ''metric'' | integer | no | ''0'' | Specifies the default route metric to use | 
- 
-=== Protocol "dhcp" === 
-^ Name ^ Type ^ Required ^ Default ^ Description ^ 
-| ''<del>gateway</del>'' | <del>string</del> | <del>no</del> | <del>//(none)//</del> | <del>Suppresses DHCP-assigned default gateway if set to 0.0.0.0</del> \\ (deprecated) | 
-| ''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 | //(none)// | Hostname to include in DHCP requests | 
-| ''clientid'' | string | no | //system default// | Override client identifier in DHCP requests | 
-| ''vendorid'' | string | no | //system default// | Override the vendor class in DHCP requests | 
-| ''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''. | 
-| ''zone'' | firewall zone | no | //(none)// | Firewall zone to which this interface should be added | 
- 
-:!: These parameters are handled partially by netifd (in ''interface.c'') and partially by a shell script in ''lib/netifd/proto/dhcp.sh''. 
- 
-FIXME Outdated information, please proofread and test it:  
- 
-:!: If an interface is configured as dhcp client, the default route received by dhcp will be the only one listed and will remove other default route/metrics defined for other interfaces if those interfaces comes "before" the interface with dhcp in terms of "ifname" values. For example: 
-<code> 
-config interface wan 
-    option ifname eth0 
-    option proto static 
-    ..other options.. 
-     
-config interface wan2 
-    option ifname eth1 
-    option proto dhcp 
-    ..other options.. 
-</code> 
-The interface with dhcp comes after (because eth1 comes after eth0 in a lexicografical order) 
-and will overwrite the default routes set up by the interface "wan". While is not true the contrary. 
-If we have: 
-<code> 
-config interface wan 
-    option ifname eth0 
-    option proto dhcp 
-    ..other options.. 
-     
-config interface wan2 
-    option ifname eth1 
-    option proto static 
-    ..other options.. 
-</code> 
-Both default routes set up by wan and wan2 will appear in the routing table. 
- 
- 
-==== Downstream configuration for LAN-Interfaces ==== 
-For a downlink with IPv4 connectivity you can just use the default configuration, dhcp server is enabled bu default, please see [[docs:user-guide:dhcp_configuration|DHCP configuration]] for more details on that. 
- 
-<code>root@lede:/# uci show network 
-... 
-network.lan=interface 
-network.lan.type='bridge' 
-network.lan.ifname='eth0.1' 
-network.lan.proto='static' 
-network.lan.netmask='255.255.255.0' 
-network.lan.ip6assign='60' 
-network.lan.ipaddr='192.168.1.1' 
-...</code> 
- 
-<code>root@lede:/# cat /etc/config/network 
-... 
-config interface 'lan' 
-        option type 'bridge' 
-        option ifname 'eth0.1' 
-        option proto 'static' 
-        option netmask '255.255.255.0' 
-        option ip6assign '60' 
-        option ipaddr '192.168.1.1' 
- 
-...</code> 
- 
-===== Examples ===== 
- 
-Below are a few examples for special, non-standard interface configurations. 
- 
-==== Bridge without IP ==== 
- 
-<code>config 'interface' 'example' 
-        option 'type'    'bridge' 
-        option 'proto'   'none' 
-        option 'ifname'  'eth0 eth1' 
-        option 'auto'    '1'</code> 
- 
-==== DHCP without default gateway ==== 
- 
-<code>config 'interface' 'example' 
-        option 'proto'   'dhcp' 
-        option 'ifname'  'eth0' 
-        option 'defaultroute' '0' 
-</code> 
- 
-==== DHCP and IPv6 ==== 
- 
-<code>config 'interface' 'example' 
-        option 'proto'     'dhcp' 
-        option 'ifname'    'eth0' 
- 
-config 'alias' 
-        option 'interface' 'example' 
-        option 'proto'     'static' 
-        option 'ip6addr'   '2001:0DB8:100:F00:BA3::1'</code> 
- 
-==== Static IP configuration with multiple dnses ==== 
-<code>config 'interface' 'example' 
-        option 'proto'     'static' 
-        option 'ifname'    'eth0' 
-        option 'ipaddr'    '192.168.1.200' 
-        option 'netmask'   '255.255.255.0' 
-        list   'dns'       '192.168.1.1' 
-        list   'dns'       '192.168.10.1' 
-</code> 
-:!: the last dns listed will be the first one to be chosen for the name resolution. 
- 
-:!: LEDE will use the new dns configured only after a reboot or a ''/etc/init.d/dnsmasq restart''. 
-==== Static IP configuration and default gateway with non-zero metric ==== 
- 
-<code>config 'interface' 'example' 
-        option 'proto'     'static' 
-        option 'ifname'    'eth0' 
-        option 'ipaddr'    '192.168.1.200' 
-        option 'netmask'   '255.255.255.0' 
-        option 'dns'       '192.168.1.1' 
- 
-config 'route' 
-        option 'interface' 'example' 
-        option 'target'    '0.0.0.0' 
-        option 'netmask'   '0.0.0.0' 
-        option 'gateway'   '192.168.1.1' 
-        option 'metric'    '100'</code> 
-         
-===== Multiple IP addresses ===== 
-Assigning multiple ip addresses to the same interface: 
-<code> 
-config interface foo 
-  option ifname eth1 
-  list ipaddr 10.8.0.1/24 
-  list ipaddr 10.9.0.1/24 
-  list ip6addr fdca:abcd::1/64 
-  list ip6addr fdca:cdef::1/64 
-</code> 
-Specifying multiple interfaces sharing the same device: 
-<code> 
-config interface foo 
-  option ifname eth1 
-  option ipaddr 10.8.0.1 
-  option netmask 255.255.255.0 
-  option ip6addr fdca:abcd::1/64 
- 
-config interface foo2 
-  option ifname eth1 
-  option ipaddr 10.9.0.1 
-  option netmask 255.255.255.0 
-  option ip6addr fdca:cdef::1/64 
-</code> 
-Originally posted at [[https://dev.openwrt.org/ticket/2829#comment:7]]. 
  • Last modified: 2021/11/27 17:36
  • by vgaetera