Wednesday, January 11, 2017

configure vrrp, on cisco and linux host

1- on router cisco configure with the following command
interface FastEthernet0/0
 ip address 192.168.2.1 255.255.255.0
 ip nat inside
 ip virtual-reassembly
 duplex auto
 speed auto
 vrrp 1 ip 192.168.2.254
 vrrp 1 timers learn
 vrrp 1 priority 120
!
interface FastEthernet0/1
 ip address 192.168.203.12 255.255.255.0
 ip nat outside
 ip virtual-reassembly
 duplex auto
 speed auto
!
ip forward-protocol nd
!
!        
no ip http server
no ip http secure-server
ip nat inside source list 1 interface FastEthernet0/1 overload
!
access-list 1 permit 192.168.2.0 0.0.0.255




2- on linux host use the following command
$ sudo apt-get install vrrpd
$ sudo sysctl -w net.ipv4.ip_forward=1
$ sudo iptables -t nat -A POSTROUTING -o eth1 -j MASQUERAD
$ sudo ifconfig eth0 192.168.2.5/24 up
$ sudo ifconfig eth0 192.168.203.5/24 up
$ sudo vrrpd -i eth0 -v 1 -p 200 192.168.2.254



3- because linux host has higher priority (200 vs 120), so it becomes the master, below is shown using cisco router
R1#show vrrp
FastEthernet0/0 - Group 1 
  State is Backup 
  Virtual IP address is 192.168.2.254
  Virtual MAC address is 0000.5e00.0101
  Advertisement interval is 1.000 sec
  Preemption enabled
  Priority is 120
  Master Router is 192.168.2.5, priority is 200
  Master Advertisement interval is 1.000 sec
  Master Down interval is 3.531 sec (expires in 2.647 sec) Learning




then when the linux host go down, the cisco router will take over, shown as below

R1#show vrrp
FastEthernet0/0 - Group 1 
  State is Master 
  Virtual IP address is 192.168.2.254
  Virtual MAC address is 0000.5e00.0101
  Advertisement interval is 1.000 sec
  Preemption enabled
  Priority is 120
  Master Router is 192.168.2.1 (local), priority is 120
  Master Advertisement interval is 1.000 sec
  Master Down interval is 3.531 sec

No comments:

Post a Comment