I just started learning openwrt. It's been a day, the keepalive still doesn't work. I reset the 2 openwrt routers and only configure static WAN. Everything else is default. I really appreciate it if someone could give me some advice or help.
-
openwrt_a
LAN ip: 192.168.1.1/24
WAN IP, gateway: static 192.168.50.3/24 gw 192.168.50.1 -
openwrt_b (haven't configured it yet)
LAN ip: 192.168.1.2/24
WAN IP, gateway: static 192.168.50.4/24 gw 192.168.50.1
openwrt_a:
/etc/keepalived/keepalived.conf
vrrp_sync_group G1 {
group {
E1
}
}
vrrp_instance E1 {
state MASTER
interface eth1
virtual_router_id 51
priority 101
advert_int 1
virtual_ipaddress {
192.168.50.5/24 dev eth1
}
virtual_routes {
src 192.168.50.5 to 0.0.0.0/0 via 192.168.50.1 dev eth1 metric 5
}
authentication {
auth_type PASS
auth_pass s3cret
}
nopreempt
}
then I type "/etc/init.d/keepalived start" to start it
As follows, I can't see this virtual IP by using ifconfig and route -n
root@OpenWrt:~# ifconfig
br-lan Link encap:Ethernet HWaddr 00:F1:F3:1F:DA:24
inet addr:192.168.1.1 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fd6b:8b1c:a13d::1/60 Scope:Global
inet6 addr: fe80::2f1:f3ff:fe1f:da24/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:8393 errors:0 dropped:0 overruns:0 frame:0
TX packets:3305 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1267167 (1.2 MiB) TX bytes:826470 (807.0 KiB)
eth0 Link encap:Ethernet HWaddr 00:F1:F3:1F:DA:24
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:8414 errors:0 dropped:8 overruns:0 frame:0
TX packets:3383 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1386418 (1.3 MiB) TX bytes:831022 (811.5 KiB)
Memory:b2100000-b21fffff
eth1 Link encap:Ethernet HWaddr 00:F1:F3:1F:DA:25
inet addr:**192.168.50.3** Bcast:192.168.50.255 Mask:255.255.255.0
inet6 addr: fe80::2f1:f3ff:fe1f:da25/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:5704 errors:0 dropped:1425 overruns:0 frame:0
TX packets:48 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:840412 (820.7 KiB) TX bytes:4690 (4.5 KiB)
Memory:b1e00000-b1efffff
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:778 errors:0 dropped:0 overruns:0 frame:0
TX packets:778 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:60879 (59.4 KiB) TX bytes:60879 (59.4 KiB)
root@OpenWrt:~# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.50.1 0.0.0.0 UG 0 0 0 eth1
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 br-lan
192.168.50.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1