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
Next revisionBoth sides next revision
docs:guide-user:network:ipv4:start [2018/03/03 20:13] – ↷ Page moved from docs:user-guide:network:ipv4:start to docs:guide-user:network:ipv4:start bobafetthotmaildocs:guide-user:network:ipv4:start [2019/11/21 08:44] – [Downstream configuration for LAN-Interfaces] tpyo ukleinek
Line 1: Line 1:
-===== IPv4 ====+====== IPv4 ======
  
 Due to obvious reasons, IPv4 is fully supported in default firmware. Due to obvious reasons, IPv4 is fully supported in default firmware.
  
-==== Upstream configuration for WAN-Interfaces ====+===== Upstream configuration for WAN-Interfaces =====
 The following sections describe the configuration of IPv4 connections to your ISP or an upstream router.  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. For an uplink with native IPv4 connectivity you can just use the default configuration.
  
-<code>root@lede:/# uci show network+<code bash> 
 +# uci show network
 ... ...
 network.wan=interface network.wan=interface
 network.wan.ifname='eth0.2' network.wan.ifname='eth0.2'
 network.wan.proto='dhcp' network.wan.proto='dhcp'
-...</code>+... 
 +</code>
  
-<code>root@lede:/# cat /etc/config/network+<code bash># cat /etc/config/network
 ... ...
 config interface 'wan' config interface 'wan'
         option ifname 'eth0.2'         option ifname 'eth0.2'
         option proto 'dhcp'         option proto 'dhcp'
-...</code>+... 
 +</code>
  
-=== Protocol "static", IPv4 ==+===== Protocol "static", IPv4 =====
 ^ Name ^ Type ^ Required ^ Default ^ Description ^ ^ 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. | | ''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. |
Line 32: Line 35:
 | ''metric'' | integer | no | ''0'' | Specifies the default route metric to use | | ''metric'' | integer | no | ''0'' | Specifies the default route metric to use |
  
-=== Protocol "dhcp" ===+===== Protocol "dhcp" =====
 ^ Name ^ Type ^ Required ^ Default ^ Description ^ ^ 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) | | ''<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) |
Line 48: Line 51:
 | ''reqopts'' | string | no | //(none)// | Space-separated list of additional DHCP options to request from the server | | ''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''. | | ''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 | | ''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''.+:!: These parameters are handled partially by netifd (in ''interface.c'') and partially by a shell script in ''lib/netifd/proto/dhcp.sh''.  Note prior to commit 3cee6f3f24 the norelease option was known as release and had the opposite sense.
  
 FIXME Outdated information, please proofread and test it:  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: :!: 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>+ 
 +<code bash>
 config interface wan config interface wan
     option ifname eth0     option ifname eth0
Line 66: Line 71:
     ..other options..     ..other options..
 </code> </code>
 +
 The interface with dhcp comes after (because eth1 comes after eth0 in a lexicografical order) 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. and will overwrite the default routes set up by the interface "wan". While is not true the contrary.
 If we have: If we have:
-<code>+ 
 +<code bash>
 config interface wan config interface wan
     option ifname eth0     option ifname eth0
Line 80: Line 87:
     ..other options..     ..other options..
 </code> </code>
 +
 Both default routes set up by wan and wan2 will appear in the routing table. 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 by default, please see [[docs:guide-user:base-system:dhcp|DHCP configuration]] for more details on that.
  
-==== Downstream configuration for LAN-Interfaces ==== +<code bash># uci show network
-For a downlink with IPv4 connectivity you can just use the default configuration, dhcp server is enabled bu default, please see [[docs:user-guide:base-system:dhcp_configuration|DHCP configuration]] for more details on that. +
- +
-<code>root@lede:/# uci show network+
 ... ...
 network.lan=interface network.lan=interface
Line 95: Line 102:
 network.lan.ip6assign='60' network.lan.ip6assign='60'
 network.lan.ipaddr='192.168.1.1' network.lan.ipaddr='192.168.1.1'
-...</code>+... 
 +</code>
  
-<code>root@lede:/# cat /etc/config/network+<code bash># cat /etc/config/network
 ... ...
 config interface 'lan' config interface 'lan'
Line 106: Line 114:
         option ip6assign '60'         option ip6assign '60'
         option ipaddr '192.168.1.1'         option ipaddr '192.168.1.1'
- +... 
-...</code>+</code>
  
 ===== Examples ===== ===== Examples =====
- 
 Below are a few examples for special, non-standard interface configurations. Below are a few examples for special, non-standard interface configurations.
  
 ==== Bridge without IP ==== ==== Bridge without IP ====
- +<code bash> 
-<code>config 'interface' 'example'+config 'interface' 'example'
         option 'type'    'bridge'         option 'type'    'bridge'
         option 'proto'   'none'         option 'proto'   'none'
         option 'ifname'  'eth0 eth1'         option 'ifname'  'eth0 eth1'
-        option 'auto'    '1'</code>+        option 'auto'    '1' 
 +</code>
  
 ==== DHCP without default gateway ==== ==== DHCP without default gateway ====
- +<code bash> 
-<code>config 'interface' 'example'+config 'interface' 'example'
         option 'proto'   'dhcp'         option 'proto'   'dhcp'
         option 'ifname'  'eth0'         option 'ifname'  'eth0'
Line 130: Line 138:
  
 ==== DHCP and IPv6 ==== ==== DHCP and IPv6 ====
- +<code bash> 
-<code>config 'interface' 'example'+config 'interface' 'example'
         option 'proto'     'dhcp'         option 'proto'     'dhcp'
         option 'ifname'    'eth0'         option 'ifname'    'eth0'
Line 138: Line 146:
         option 'interface' 'example'         option 'interface' 'example'
         option 'proto'     'static'         option 'proto'     'static'
-        option 'ip6addr'   '2001:0DB8:100:F00:BA3::1'</code>+        option 'ip6addr'   '2001:0DB8:100:F00:BA3::1' 
 +</code>
  
-==== Static IP configuration with multiple dnses ==== +==== Static IP configuration with multiple DNS servers ==== 
-<code>config 'interface' 'example'+<code bash> 
 +config 'interface' 'example'
         option 'proto'     'static'         option 'proto'     'static'
         option 'ifname'    'eth0'         option 'ifname'    'eth0'
Line 149: Line 159:
         list   'dns'       '192.168.10.1'         list   'dns'       '192.168.10.1'
 </code> </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''. +:!: The last DNS listed will be the first one to be chosen for the name resolution.
-==== Static IP configuration and default gateway with non-zero metric ====+
  
-<code>config 'interface' 'example'+:!: Restart the service to apply the new DNS configuration: ''service dnsmasq restart'' 
 + 
 +==== Static IP configuration and default gateway with non-zero metric ==== 
 +<code bash> 
 +config 'interface' 'example'
         option 'proto'     'static'         option 'proto'     'static'
         option 'ifname'    'eth0'         option 'ifname'    'eth0'
Line 166: Line 178:
         option 'netmask'   '0.0.0.0'         option 'netmask'   '0.0.0.0'
         option 'gateway'   '192.168.1.1'         option 'gateway'   '192.168.1.1'
-        option 'metric'    '100'</code>+        option 'metric'    '100' 
 +</code>
                  
 ===== Multiple IP addresses ===== ===== Multiple IP addresses =====
 Assigning multiple ip addresses to the same interface: Assigning multiple ip addresses to the same interface:
-<code>+ 
 +<code bash>
 config interface foo config interface foo
   option ifname eth1   option ifname eth1
Line 178: Line 192:
   list ip6addr fdca:cdef::1/64   list ip6addr fdca:cdef::1/64
 </code> </code>
 +
 Specifying multiple interfaces sharing the same device: Specifying multiple interfaces sharing the same device:
-<code>+ 
 +<code bash>
 config interface foo config interface foo
   option ifname eth1   option ifname eth1
Line 192: Line 208:
   option ip6addr fdca:cdef::1/64   option ip6addr fdca:cdef::1/64
 </code> </code>
 +
 Originally posted at [[https://dev.openwrt.org/ticket/2829#comment:7]]. Originally posted at [[https://dev.openwrt.org/ticket/2829#comment:7]].
 +
  • Last modified: 2021/11/27 17:36
  • by vgaetera