[root@web03 scripts]# cat prevent_arp.sh 
#!/bin/bash

lo_ip=$(ip a s lo|grep "10.0.0.1[3]/32"|wc -l)

if [ $lo_ip -eq 0 ]
then
    ip addr add 10.0.0.13/32 dev lo
fi

ip_cnf=$(egrep "net.ipv4.conf" /etc/sysctl.conf|wc -l)

if [ $ip_cnf -lt 4 ]
then
    
    cat >>/etc/sysctl.conf<<-EOF
    net.ipv4.conf.all.arp_ignore = 1
    net.ipv4.conf.all.arp_announce = 2
    net.ipv4.conf.lo.arp_ignore = 1
    net.ipv4.conf.lo.arp_announce = 2
    EOF


    sysctl -p
fi

 

相关文章:

  • 2022-12-23
  • 2021-08-18
  • 2021-10-14
  • 2022-01-18
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-01-06
  • 2021-06-30
  • 2022-02-11
  • 2022-12-23
  • 2021-05-16
  • 2022-12-23
相关资源
相似解决方案