Struct nmstate::InterfaceIpv4
source · #[non_exhaustive]pub struct InterfaceIpv4 {
pub enabled: bool,
pub dhcp: Option<bool>,
pub dhcp_client_id: Option<Dhcpv4ClientId>,
pub addresses: Option<Vec<InterfaceIpAddr>>,
pub auto_dns: Option<bool>,
pub auto_gateway: Option<bool>,
pub auto_routes: Option<bool>,
pub auto_table_id: Option<u32>,
pub allow_extra_address: bool,
pub auto_route_metric: Option<u32>,
/* private fields */
}
Expand description
IPv4 configuration of interface. Example YAML output of interface holding static IPv4:
---
interfaces:
- name: eth1
state: up
mtu: 1500
ipv4:
address:
- ip: 192.0.2.252
prefix-length: 24
- ip: 192.0.2.251
prefix-length: 24
dhcp: false
enabled: true
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.enabled: bool
Whether IPv4 stack is enabled. When set to false, all IPv4 address will be removed from this interface.
dhcp: Option<bool>
Whether DHCPv4 is enabled.
dhcp_client_id: Option<Dhcpv4ClientId>
DHCPv4 client ID.
Serialize and deserialize to/from dhcp-client-id
.
addresses: Option<Vec<InterfaceIpAddr>>
IPv4 addresses. Will be ignored when applying with
DHCP enabled.
When applying with None
, current IP address will be preserved.
When applying with Some(Vec::new())
, all IP address will be removed.
The IP addresses will apply to kernel with the same order specified
which result the IP addresses after first one holding the secondary
flag.
auto_dns: Option<bool>
Whether to apply DNS resolver information retrieved from DHCP server.
Serialize and deserialize to/from auto-dns
.
auto_gateway: Option<bool>
Whether to set default gateway retrieved from DHCP server.
Serialize and deserialize to/from auto-gateway
.
auto_routes: Option<bool>
Whether to set routes(including default gateway) retrieved from DHCP
server.
Serialize and deserialize to/from auto-routes
.
auto_table_id: Option<u32>
The route table ID used to hold routes(including default gateway)
retrieved from DHCP server.
If not defined, the main(254) will be used.
Serialize and deserialize to/from auto-table-id
.
allow_extra_address: bool
By default(true), nmstate verification process allows extra IP address
found as long as desired IP address matched.
When set to false, the verification process of nmstate do exact equal
check on IP address.
Ignore when serializing.
Deserialize from allow-extra-address
auto_route_metric: Option<u32>
Metric for routes retrieved from DHCP server.
Only available for DHCPv4 enabled interface.
Deserialize from auto-route-metric
Implementations§
source§impl InterfaceIpv4
impl InterfaceIpv4
sourcepub fn new() -> Self
pub fn new() -> Self
Create InterfaceIpv4 with IP disabled.
Trait Implementations§
source§impl Clone for InterfaceIpv4
impl Clone for InterfaceIpv4
source§fn clone(&self) -> InterfaceIpv4
fn clone(&self) -> InterfaceIpv4
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for InterfaceIpv4
impl Debug for InterfaceIpv4
source§impl Default for InterfaceIpv4
impl Default for InterfaceIpv4
source§impl<'de> Deserialize<'de> for InterfaceIpv4
impl<'de> Deserialize<'de> for InterfaceIpv4
source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
source§impl PartialEq<InterfaceIpv4> for InterfaceIpv4
impl PartialEq<InterfaceIpv4> for InterfaceIpv4
source§fn eq(&self, other: &InterfaceIpv4) -> bool
fn eq(&self, other: &InterfaceIpv4) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl Serialize for InterfaceIpv4
impl Serialize for InterfaceIpv4
impl Eq for InterfaceIpv4
impl StructuralEq for InterfaceIpv4
impl StructuralPartialEq for InterfaceIpv4
Auto Trait Implementations§
impl RefUnwindSafe for InterfaceIpv4
impl Send for InterfaceIpv4
impl Sync for InterfaceIpv4
impl Unpin for InterfaceIpv4
impl UnwindSafe for InterfaceIpv4
Blanket Implementations§
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.