昨天使用yum命令安装ipvsadm的时候发现异常
yum install ipvsadm
# ipvsadm
FATAL: Error inserting ip_vs (/lib/modules/2.6.32-573.8.1.el6.x86_64/kernel/net/netfilter/ipvs/ip_vs.ko): Unknown symbol in module, or unknown parameter (see dmesg)
Can't initialize ipvs: Protocol not available
Are you sure that IP Virtual Server is built in the kernel or as module?
查看dmesg
报如下错误
ip_vs: Unknown symbol ip6_local_out
ip_vs: Unknown symbol ip6_route_me_harder
ip_vs: Unknown symbol ipv6_dev_get_saddr
ip_vs: Unknown symbol ip6_route_output
ip_vs: Unknown symbol icmpv6_send
查看/etc/modprobe.d/
解决其实很简单,但是根据错误去baidu/google找不到比较简单的答案
#mv ipv6.conf ipv6.conf.bak
#touch disable_ipv6.conf
内容贴进去即可
alias net-pf-10 off
alias ipv6 off
options ipv6 disable=1
这样再次执行 ipvsadm 正常就不会报错了
这里设定对外的虚IP是 10.0.2.222
lvs:
ifconfig eth0:0 10.0.2.222 broadcast 10.0.2.222 netmask 255.255.255.255 up
route add -host 10.0.2.222 dev eth0:0
ipvsadm -C
ipvsadm -A -t 10.0.2.222:80 -s rr -p 600
ipvsadm -a -t 10.0.2.222:80 -r 10.0.2.68:80 -g
ipvsadm
rs:
ifconfig lo:0 10.0.2.222 broadcast 10.0.2.222 netmask 255.255.255.255 up
route add -host 10.0.2.222 dev lo:0
echo "1" >/proc/sys/net/ipv4/conf/lo/arp_ignore
echo "2" >/proc/sys/net/ipv4/conf/lo/arp_announce
echo "1" >/proc/sys/net/ipv4/conf/all/arp_ignore
echo "2" >/proc/sys/net/ipv4/conf/all/arp_announce
sysctl -p
这个是否正常就会生效了,具体可以使用tcpdump跟踪看看