Ethernet Interfaces in VyOS

Ethernet interfaces are the primary type of physical network interface in VyOS.

Basic Configuration

IP Addressing

Static IPv4 address:

set interfaces ethernet eth0 address 192.168.1.1/24

Static IPv6 address:

set interfaces ethernet eth0 address 2001:db8::1/64

Multiple addresses:

set interfaces ethernet eth0 address 192.168.1.1/24
set interfaces ethernet eth0 address 192.168.2.1/24
set interfaces ethernet eth0 address 2001:db8::1/64

DHCP Client

DHCPv4:

set interfaces ethernet eth0 address dhcp

DHCPv6:

set interfaces ethernet eth0 address dhcpv6

Interface Description

set interfaces ethernet eth0 description 'Primary LAN Interface'

MAC Address

Changing the MAC address:

set interfaces ethernet eth0 mac '00:50:56:00:00:01'

Physical Parameters

Speed and Duplex

Automatic detection (default):

set interfaces ethernet eth0 speed auto
set interfaces ethernet eth0 duplex auto

Fixed values:

set interfaces ethernet eth0 speed 1000
set interfaces ethernet eth0 duplex full

Available speeds:

  • 10 - 10 Mbps
  • 100 - 100 Mbps
  • 1000 - 1 Gbps
  • 2500 - 2.5 Gbps
  • 5000 - 5 Gbps
  • 10000 - 10 Gbps
  • 25000 - 25 Gbps
  • 40000 - 40 Gbps
  • 50000 - 50 Gbps
  • 100000 - 100 Gbps
  • auto - autodetection

Duplex modes:

  • half - half duplex
  • full - full duplex
  • auto - autodetection

MTU (Maximum Transmission Unit)

set interfaces ethernet eth0 mtu 1500

Typical MTU values:

  • 1500 - standard Ethernet
  • 9000 - Jumbo frames (requires hardware support)
  • 1492 - for PPPoE (accounts for the 8-byte overhead)

Flow Control

Data flow control to prevent congestion:

set interfaces ethernet eth0 flow-control enable

Offloading (Hardware Acceleration)

Generic Receive Offload (GRO)

set interfaces ethernet eth0 offload gro

Generic Segmentation Offload (GSO)

set interfaces ethernet eth0 offload gso

Large Receive Offload (LRO)

set interfaces ethernet eth0 offload lro

Scatter-Gather (SG)

set interfaces ethernet eth0 offload sg

TCP Segmentation Offload (TSO)

set interfaces ethernet eth0 offload tso

UDP Fragmentation Offload (UFO)

set interfaces ethernet eth0 offload ufo

Note: Offload features can improve performance, but in some cases they may cause problems with certain traffic types or when using tunnels.

Ring Buffer

Configuring the size of the ring buffers to optimize performance:

set interfaces ethernet eth0 ring-buffer rx 512
set interfaces ethernet eth0 ring-buffer tx 512

Increasing the buffer size can help when handling high loads.

VLAN (802.1Q)

Creating a VLAN Interface

set interfaces ethernet eth0 vif 100 address 192.168.100.1/24
set interfaces ethernet eth0 vif 100 description 'VLAN 100 - Guests'

Multiple VLANs

set interfaces ethernet eth0 vif 10 address 192.168.10.1/24
set interfaces ethernet eth0 vif 10 description 'VLAN 10 - Management'

set interfaces ethernet eth0 vif 20 address 192.168.20.1/24
set interfaces ethernet eth0 vif 20 description 'VLAN 20 - Servers'

set interfaces ethernet eth0 vif 30 address 192.168.30.1/24
set interfaces ethernet eth0 vif 30 description 'VLAN 30 - Workstations'

QinQ (802.1ad)

Double VLAN tagging:

set interfaces ethernet eth0 vif-s 100 vif-c 200 address 10.0.0.1/24

Advanced IPv4 Settings

ARP

ARP cache timeout:

set interfaces ethernet eth0 ip arp-cache-timeout 3600

Proxy ARP:

set interfaces ethernet eth0 ip enable-proxy-arp

ARP announce:

set interfaces ethernet eth0 ip enable-arp-announce

ARP ignore:

set interfaces ethernet eth0 ip enable-arp-ignore

Source Validation

Source address validation to prevent spoofing:

set interfaces ethernet eth0 ip source-validation strict

Modes:

  • strict - strict mode (RFC 3704)
  • loose - loose mode
  • disable - disabled

Disable Forwarding

Disabling IP forwarding on the interface:

set interfaces ethernet eth0 ip disable-forwarding

Advanced IPv6 Settings

Autoconfiguration (SLAAC)

set interfaces ethernet eth0 ipv6 address autoconf

Duplicate Address Detection (DAD)

Number of attempts to detect duplicate addresses:

set interfaces ethernet eth0 ipv6 dup-addr-detect-transmits 1

Disabling IPv6

set interfaces ethernet eth0 ipv6 disable

Disable Forwarding

set interfaces ethernet eth0 ipv6 disable-forwarding

DHCP Options

DHCPv4 Client

Client ID:

set interfaces ethernet eth0 dhcp-options client-id 'my-client-id'

Hostname:

set interfaces ethernet eth0 dhcp-options host-name 'vyos-router'

Vendor class ID:

set interfaces ethernet eth0 dhcp-options vendor-class-id 'vyos'

Default route distance:

set interfaces ethernet eth0 dhcp-options default-route-distance 210

Rejecting the default route from DHCP:

set interfaces ethernet eth0 dhcp-options no-default-route

DHCPv6 Client

Prefix delegation:

set interfaces ethernet eth0 dhcpv6-options pd 0 interface eth1 address 1
set interfaces ethernet eth0 dhcpv6-options pd 0 length 56

Rapid commit:

set interfaces ethernet eth0 dhcpv6-options rapid-commit

Temporary addresses:

set interfaces ethernet eth0 dhcpv6-options temporary

Binding to a VRF

set interfaces ethernet eth0 vrf RED

Traffic Mirroring

Inbound traffic:

set interfaces ethernet eth0 mirror ingress eth1

Outbound traffic:

set interfaces ethernet eth0 mirror egress eth1

Traffic Policies (QoS)

set interfaces ethernet eth0 traffic-policy in MY-SHAPER
set interfaces ethernet eth0 traffic-policy out MY-LIMITER

Operational Commands

Viewing State

All Ethernet interfaces:

show interfaces ethernet

A specific interface:

show interfaces ethernet eth0

Brief information:

show interfaces ethernet eth0 brief

Physical Parameters

show interfaces ethernet eth0 physical

The output includes:

  • Speed and duplex
  • Auto-negotiation status
  • Link state (link up/down)
  • Error statistics

Interface Counters

show interfaces ethernet eth0 statistics

Clearing Counters

clear interfaces ethernet eth0 counters

Traffic Monitoring

monitor interfaces ethernet eth0 traffic

Traffic Capture

monitor traffic interface eth0
monitor traffic interface eth0 filter 'port 80'

Configuration Examples

Simple LAN Interface

set interfaces ethernet eth0 address 192.168.1.1/24
set interfaces ethernet eth0 description 'LAN'
set interfaces ethernet eth0 speed 1000
set interfaces ethernet eth0 duplex full

WAN Interface with DHCP

set interfaces ethernet eth1 address dhcp
set interfaces ethernet eth1 description 'WAN'
set interfaces ethernet eth1 dhcp-options default-route-distance 210

Trunk Port with Multiple VLANs

set interfaces ethernet eth2 description 'Trunk to switch'
set interfaces ethernet eth2 mtu 1500

set interfaces ethernet eth2 vif 10 address 192.168.10.1/24
set interfaces ethernet eth2 vif 10 description 'VLAN 10 - Management'

set interfaces ethernet eth2 vif 20 address 192.168.20.1/24
set interfaces ethernet eth2 vif 20 description 'VLAN 20 - Data'

set interfaces ethernet eth2 vif 30 address 192.168.30.1/24
set interfaces ethernet eth2 vif 30 description 'VLAN 30 - Voice'

Interface with Jumbo Frames

set interfaces ethernet eth3 address 10.0.0.1/24
set interfaces ethernet eth3 description 'Storage network'
set interfaces ethernet eth3 mtu 9000
set interfaces ethernet eth3 speed 10000
set interfaces ethernet eth3 duplex full

Dual-Stack (IPv4 + IPv6)

set interfaces ethernet eth0 address 192.168.1.1/24
set interfaces ethernet eth0 address 2001:db8:1::1/64
set interfaces ethernet eth0 description 'Dual-stack LAN'
set interfaces ethernet eth0 ipv6 dup-addr-detect-transmits 1

Troubleshooting

Interface in Down State

Check the physical connection:

show interfaces ethernet eth0 physical

Check whether the interface is disabled:

show interfaces ethernet eth0 | grep disable

Enable the interface if it is disabled:

delete interfaces ethernet eth0 disable
commit

Performance Problems

Check for errors and collisions:

show interfaces ethernet eth0 statistics

Try disabling offload:

delete interfaces ethernet eth0 offload
commit

Increase the ring buffer:

set interfaces ethernet eth0 ring-buffer rx 1024
set interfaces ethernet eth0 ring-buffer tx 1024
commit

Auto-negotiation Problems

Fix the speed and duplex:

set interfaces ethernet eth0 speed 1000
set interfaces ethernet eth0 duplex full
commit

VLAN Problems

Make sure the parent interface is active:

show interfaces ethernet eth0

Check the VLAN ID:

show interfaces ethernet eth0 vif

Best Practices

  1. Use descriptions for all interfaces and VLANs
  2. Fix the speed/duplex for critical connections
  3. Plan the MTU - account for the VLAN tag (4 bytes)
  4. Test offload - it may cause problems with some hardware
  5. Monitor errors - check the counters regularly
  6. Document VLANs - use clear descriptions
  7. Back up the configuration before making changes

Next Steps

  • Bridge - for creating an L2 bridge between interfaces
  • Bond - for aggregating Ethernet links
  • VLAN - detailed VLAN configuration
Reviewed by OpenNix LLC · Last updated on