tag: priority: 800 type: txt help: L2TPv3 interface val_help: ; L2TPv3 interface name syntax:expression: pattern $VAR(@) "^l2tpeth[0-9]+$" \ ; "tunnel must be (l2tpeth0-l2tpeth999)" commit:expression: $VAR(./local-ip/) != "" ; \ "Must configure the l2tpv3 local-ip for $VAR(@)" commit:expression: $VAR(./remote-ip/) != "" ; \ "Must configure the l2tpv3 remote-ip for $VAR(@)" commit:expression: $VAR(./tunnel-id/) != "" ; \ "Must configure the l2tpv3 tunnel-id for $VAR(@)" commit:expression: $VAR(./peer-tunnel-id/) != "" ; \ "Must configure the l2tpv3 peer-tunnel-id for $VAR(@)" commit:expression: $VAR(./session-id/) != "" ; \ "Must configure the l2tpv3 session-id for $VAR(@)" commit:expression: $VAR(./peer-session-id/) != "" ; \ "Must configure the l2tpv3 peer-session-id for $VAR(@)" begin: [ -d /sys/module/l2tp_eth ] || sudo modprobe l2tp_eth [ -d /sys/module/l2tp_netlink ] || sudo modprobe l2tp_netlink if [ "$VAR(./encapsulation/@)" = "ip" ]; then if [ ! -d /sys/module/l2tp_ip ]; then sudo modprobe l2tp_ip fi if [ ! -d /sys/module/l2tp_ip6 ]; then sudo modprobe l2tp_ip6 fi fi create: sudo ip l2tp add tunnel tunnel_id $VAR(./tunnel-id/@) \ peer_tunnel_id $VAR(./peer-tunnel-id/@) \ udp_sport $VAR(./source-port/@) \ udp_dport $VAR(./destination-port/@) \ encap $VAR(./encapsulation/@) \ local $VAR(./local-ip/@) \ remote $VAR(./remote-ip/@) sudo ip l2tp add session session_id $VAR(./session-id/@) \ tunnel_id $VAR(./tunnel-id/@) \ peer_session_id $VAR(./peer-session-id/@) \ name $VAR(@) sudo ip link set $VAR(@) up delete: sudo ip link set $VAR(@) down if [ -n "$VAR(./tunnel-id/@)" ] && [ -n "$VAR(./session-id/@)" ] ; then sudo ip l2tp del session tunnel_id $VAR(./tunnel-id/@) session_id $VAR(./session-id/@) fi if [ -n "$VAR(./tunnel-id/@)" ] ; then sudo ip l2tp del tunnel tunnel_id $VAR(./tunnel-id/@) fi