Virtual Ethernet
The veth devices are virtual Ethernet devices. They can act as tunnels between network namespaces to create a bridge to a physical network device in another namespace or VRF, but can also be used as standalone network devices.
Note
veth interfaces need to be created in pairs - it’s called the peer name
Configuration
Common interface configuration
Configure interface <interface> with one or more interface addresses.
address can be specified multiple times as IPv4 and/or IPv6 address, e.g. 192.0.2.1/24 and/or 2001:db8::1/64
dhcp interface address is received by DHCP from a DHCP server on this segment.
dhcpv6 interface address is received by DHCPv6 from a DHCPv6 server on this segment.
Example:
set interfaces virtual-ethernet veth0 address 192.0.2.1/24
set interfaces virtual-ethernet veth0 address 2001:db8::1/64
set interfaces virtual-ethernet veth0 address dhcp
set interfaces virtual-ethernet veth0 address dhcpv6
Set a human readable, descriptive alias for this connection. Alias is used by
e.g. the show interfaces
command or SNMP based monitoring tools.
Example:
set interfaces virtual-ethernet veth0 description 'This is an awesome interface running on VyOS'
Disable given <interface>. It will be placed in administratively down
(A/D
) state.
Example:
set interfaces virtual-ethernet veth0 disable
Place interface in given VRF instance.
See also
There is an entire chapter about how to configure a VRF, please check this for additional information.
Example:
set interfaces virtual-ethernet veth0 vrf red
Operation
Show brief interface information.
[email protected]:~$ show interfaces virtual-ethernet
Codes: S - State, L - Link, u - Up, D - Down, A - Admin Down
Interface IP Address S/L Description
--------- ---------- --- -----------
veth10 100.64.0.0/31 u/u
veth11 100.64.0.1/31 u/u
Show detailed information on given <interface>
[email protected]:~$ show interfaces virtual-ethernet veth11
10: [email protected]: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master red state UP group default qlen 1000
link/ether b2:7b:df:47:e9:11 brd ff:ff:ff:ff:ff:ff
inet 100.64.0.1/31 scope global veth11
valid_lft forever preferred_lft forever
inet6 fe80::b07b:dfff:fe47:e911/64 scope link
valid_lft forever preferred_lft forever
RX: bytes packets errors dropped overrun mcast
0 0 0 0 0 0
TX: bytes packets errors dropped carrier collisions
1369707 4267 0 0 0 0
Example
Interconnect the global VRF with vrf “red” using the veth10 <-> veth 11 pair
set interfaces virtual-ethernet veth10 address '100.64.0.0/31'
set interfaces virtual-ethernet veth10 peer-name 'veth11'
set interfaces virtual-ethernet veth11 address '100.64.0.1/31'
set interfaces virtual-ethernet veth11 peer-name 'veth10'
set interfaces virtual-ethernet veth11 vrf 'red'
set vrf name red table '1000'
[email protected]:~$ ping 100.64.0.1
PING 100.64.0.1 (100.64.0.1) 56(84) bytes of data.
64 bytes from 100.64.0.1: icmp_seq=1 ttl=64 time=0.080 ms
64 bytes from 100.64.0.1: icmp_seq=2 ttl=64 time=0.119 ms