lvs-snat
lvs-snat copied to clipboard
messages一直在刷错
Jun 11 17:05:07 CNC-BJ-1-1A7 kernel: [84631.265509] IPVS: SNAT: no destination available Jun 11 17:05:08 CNC-BJ-1-1A7 kernel: [84632.063625] IPVS: SNAT: no destination available Jun 11 17:05:09 CNC-BJ-1-1A7 kernel: [84633.061335] IPVS: SNAT: no destination available Jun 11 17:05:10 CNC-BJ-1-1A7 kernel: [84634.059535] IPVS: SNAT: no destination available Jun 11 17:05:11 CNC-BJ-1-1A7 kernel: [84635.057864] IPVS: SNAT: no destination available Jun 11 17:05:12 CNC-BJ-1-1A7 kernel: [84636.055955] IPVS: SNAT: no destination available Jun 11 17:05:13 CNC-BJ-1-1A7 kernel: [84637.054262] IPVS: SNAT: no destination available Jun 11 17:05:14 CNC-BJ-1-1A7 kernel: [84638.052525] IPVS: SNAT: no destination available Jun 11 17:05:15 CNC-BJ-1-1A7 kernel: [84639.050664] IPVS: SNAT: no destination available Jun 11 17:05:16 CNC-BJ-1-1A7 kernel: [84640.048951] IPVS: SNAT: no destination available Jun 11 17:05:17 CNC-BJ-1-1A7 kernel: [84641.047151] IPVS: SNAT: no destination available Jun 11 17:05:18 CNC-BJ-1-1A7 kernel: [84642.045409] IPVS: SNAT: no destination available
添加规则后,ipvsadm -ln也显示不出来,但是添加的时候是成功的 [root@CNC-BJ-1-1A7 log]# ipvsadm -ln IP Virtual Server version 1.2.2 (size=4194304) Prot LocalAddress:Port Scheduler Flags -> SourceAddr DestAddr GW Oif SnatIp Algo NewGW ActConn InActConn FWM 1 snat_sched
添加命令 ipvsadm -A -f 1 -s snat_sched ipvsadm -K -f 1 -F 172.16.222.0/24 -W 192.168.3.1 --oif em1 -U 192.168.3.216 -O sdh
过程如下: [root@CNC-BJ-1-1A7 ~]# ipvsadm -A -f 1 -s snat_sched Service already exists [root@CNC-BJ-1-1A7 ~]# ipvsadm -K -f 1 -F 172.16.222.0/24 -W 192.168.3.1 --oif em1 -U 192.168.3.216 -O sdh Success [root@CNC-BJ-1-1A7 ~]# ipvsadm -ln IP Virtual Server version 1.2.2 (size=4194304) Prot LocalAddress:Port Scheduler Flags -> SourceAddr DestAddr GW Oif SnatIp Algo NewGW ActConn InActConn FWM 1 snat_sched [root@CNC-BJ-1-1A7 ~]#
除了IPVS: SNAT: no destination available,添加规则的时候,系统日志有没有相关错误日志?
有这个 Jun 11 13:52:48 CNC-BJ-1-1A7 Keepalived_vrrp: Configuration is using : 3656989 Bytes Jun 11 13:52:48 CNC-BJ-1-1A7 Keepalived_vrrp: Using LinkWatch kernel netlink reflector... Jun 11 13:52:48 CNC-BJ-1-1A7 Keepalived_healthcheckers: IPVS: Bad address Jun 11 13:52:48 CNC-BJ-1-1A7 Keepalived_healthcheckers: Adding snat rule[-F 172.16.222.0/24 -T 0.0.0.0/0 -W 192.168.3.1 --oi f em1 -U 192.168.3.216-192.168.3.218 -O sdh -N 0.0.0.0] Jun 11 13:52:48 CNC-BJ-1-1A7 Keepalived_healthcheckers: IPVS: Bad address Jun 11 13:52:48 CNC-BJ-1-1A7 Keepalived_healthcheckers: Using LinkWatch kernel netlink reflector... Jun 11 13:52:48 CNC-BJ-1-1A7 kernel: [73112.727959] IPVS: set_ctl: invalid protocol: 0 0.0.0.0:0 snat_sched
有这个 Jun 11 13:52:48 CNC-BJ-1-1A7 Keepalived_vrrp: Configuration is using : 3656989 Bytes Jun 11 13:52:48 CNC-BJ-1-1A7 Keepalived_vrrp: Using LinkWatch kernel netlink reflector... Jun 11 13:52:48 CNC-BJ-1-1A7 Keepalived_healthcheckers: IPVS: Bad address Jun 11 13:52:48 CNC-BJ-1-1A7 Keepalived_healthcheckers: Adding snat rule[-F 172.16.222.0/24 -T 0.0.0.0/0 -W 192.168.3.1 --oi f em1 -U 192.168.3.216-192.168.3.218 -O sdh -N 0.0.0.0] Jun 11 13:52:48 CNC-BJ-1-1A7 Keepalived_healthcheckers: IPVS: Bad address Jun 11 13:52:48 CNC-BJ-1-1A7 Keepalived_healthcheckers: Using LinkWatch kernel netlink reflector... Jun 11 13:52:48 CNC-BJ-1-1A7 kernel: [73112.727959] IPVS: set_ctl: invalid protocol: 0 0.0.0.0:0 snat_sched
看样子是编译的时候没有用到netlink,而是用了socket_ops 编译时,在keepalived目录下运行configure时,看下libnl是no还是yes,如下: Keepalived configuration
Keepalived version : 1.2.6 Compiler : gcc Compiler flags : -g -O2 Extra Lib : -lpopt -lssl -lcrypto -lnl Use IPVS Framework : Yes IPVS sync daemon support : Yes IPVS use libnl : Yes Use VRRP Framework : Yes Use Debug flags : No
这样的 Keepalived configuration
Keepalived version : 1.2.2 Compiler : gcc Compiler flags : -g -O2 Extra Lib : -lpopt -lssl -lcrypto -lnl Use IPVS Framework : No IPVS sync daemon support : No Use VRRP Framework : Yes Use Debug flags : No
看是没有IPVS use libnl 这一行
看是没有IPVS use libnl 这一行
configure要带如下参数
cd LVS/tools/keepalived
./configure --with-kernel-dir="/lib/modules/uname -r
/build" --prefix=/usr/ --sysconfdir=/etc/
make
make install
cd ../ipvsadm
make
make install
rpm -qa|grep libnl 看下有没有装,没有就yum装一下
lingjw [email protected] 于2019年6月12日周三 下午2:37写道:
之前就带参数了,现在在执行也是一样 Keepalived configuration
Keepalived version : 1.2.2 Compiler : gcc Compiler flags : -g -O2 Extra Lib : -lpopt -lssl -lcrypto -lnl Use IPVS Framework : No IPVS sync daemon support : No Use VRRP Framework : Yes Use Debug flags : No
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/jlijian3/lvs-snat/issues/7?email_source=notifications&email_token=AAZO4B53IEIXEM6GMPKDRA3P2CKRHA5CNFSM4HW4FFS2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODXPMZ6Y#issuecomment-501140731, or mute the thread https://github.com/notifications/unsubscribe-auth/AAZO4B33VBXLGXJ6ZBJII23P2CKRHANCNFSM4HW4FFSQ .
rpm -qa|grep libnl 看下有没有装,没有就yum装一下libnl-devel
已经可以了,感谢!