Skip to content

Instantly share code, notes, and snippets.

@spangenberg
Created August 31, 2016 11:34
Show Gist options
  • Select an option

  • Save spangenberg/aba363698b370561b68b0d3374c0b9ba to your computer and use it in GitHub Desktop.

Select an option

Save spangenberg/aba363698b370561b68b0d3374c0b9ba to your computer and use it in GitHub Desktop.
/config/scripts/post-config.d/patch_arp.sh
#!/bin/sh
read -r -d '' ARP_ACCEPT <<'EOF'
help: Enable arp-accept on this interface
create:expression: "sudo sh -c \"echo 1 > /proc/sys/net/ipv4/conf/$VAR(../../@)/arp_accept\" "
delete:expression: "sudo sh -c \"echo 0 > /proc/sys/net/ipv4/conf/$VAR(../../@)/arp_accept\" "
EOF
mkdir -p /opt/vyatta/share/vyatta-cfg/templates/interfaces/ethernet/node.tag/ip/enable-arp-accept
echo $ARP_ACCEPT > /opt/vyatta/share/vyatta-cfg/templates/interfaces/ethernet/node.tag/ip/enable-arp-accept/node.def
read -r -d '' ARP_ANNOUNCE <<'EOF'
help: Enable arp-announce on this interface
create:expression: "sudo sh -c \"echo 1 > /proc/sys/net/ipv4/conf/$VAR(../../@)/arp_announce\" "
delete:expression: "sudo sh -c \"echo 0 > /proc/sys/net/ipv4/conf/$VAR(../../@)/arp_announce\" "
EOF
mkdir -p /opt/vyatta/share/vyatta-cfg/templates/interfaces/ethernet/node.tag/ip/enable-arp-announce
echo $ARP_ANNOUNCE > /opt/vyatta/share/vyatta-cfg/templates/interfaces/ethernet/node.tag/ip/enable-arp-announce/node.def
read -r -d '' ARP_FILTER <<'EOF'
help: Disable arp-filter on this interface
create:expression: "sudo sh -c \"echo 0 > /proc/sys/net/ipv4/conf/$VAR(../../@)/arp_filter\" "
delete:expression: "sudo sh -c \"echo 1 > /proc/sys/net/ipv4/conf/$VAR(../../@)/arp_filter\" "
EOF
mkdir -p /opt/vyatta/share/vyatta-cfg/templates/interfaces/ethernet/node.tag/ip/disable-arp-filter
echo $ARP_FILTER > /opt/vyatta/share/vyatta-cfg/templates/interfaces/ethernet/node.tag/ip/disable-arp-filter/node.def
read -r -d '' ARP_IGNORE <<'EOF'
help: Enable arp-ignore on this interface
create:expression: "sudo sh -c \"echo 1 > /proc/sys/net/ipv4/conf/$VAR(../../@)/arp_ignore\" "
delete:expression: "sudo sh -c \"echo 0 > /proc/sys/net/ipv4/conf/$VAR(../../@)/arp_ignore\" "
EOF
mkdir -p /opt/vyatta/share/vyatta-cfg/templates/interfaces/ethernet/node.tag/ip/enable-arp-ignore
echo $ARP_IGNORE > /opt/vyatta/share/vyatta-cfg/templates/interfaces/ethernet/node.tag/ip/enable-arp-ignore/node.def
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment