Coder Social home page Coder Social logo

ipvs-vagrant's Introduction

ipvs-vagrant

this is a test ipvs(NAT) Vagrantfile.

vm

vm role ip
lb0 LVS director 192.168.66.11(DIP)、192.168.55.11(external interface)
lb1 LVS director 192.168.66.12(DIP)、192.168.55.12(external interface)
- VIP 192.168.55.100
rs0 RealServer 192.168.66.111(RIP)
rs1 RealServer 192.168.66.112(RIP)
cl0 Client 192.168.55.200

start

vagrant up lb0 lb1 && vagrant reload lb0 lb1

vagrant up rs0 rs1

vagrant up cl0

lb0 interface

vagrant@lb0:~$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 02:56:36:6f:95:58 brd ff:ff:ff:ff:ff:ff
    inet 10.0.2.15/24 brd 10.0.2.255 scope global dynamic enp0s3
       valid_lft 85750sec preferred_lft 85750sec
    inet6 fe80::56:36ff:fe6f:9558/64 scope link 
       valid_lft forever preferred_lft forever
3: enp0s8: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 08:00:27:90:fd:43 brd ff:ff:ff:ff:ff:ff
    inet 192.168.66.11/24 brd 192.168.66.255 scope global enp0s8
       valid_lft forever preferred_lft forever
    inet 192.168.66.100/32 scope global enp0s8
       valid_lft forever preferred_lft forever
    inet 192.168.55.100/32 scope global enp0s8
       valid_lft forever preferred_lft forever
    inet6 fe80::a00:27ff:fe90:fd43/64 scope link 
       valid_lft forever preferred_lft forever
4: enp0s9: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 08:00:27:9c:bb:05 brd ff:ff:ff:ff:ff:ff
    inet 192.168.55.11/24 brd 192.168.55.255 scope global enp0s9
       valid_lft forever preferred_lft forever
    inet6 fe80::a00:27ff:fe9c:bb05/64 scope link 
       valid_lft forever preferred_lft forever
root@lb0:~# ipvsadm -L -n
IP Virtual Server version 1.2.1 (size=4096)
Prot LocalAddress:Port Scheduler Flags
  -> RemoteAddress:Port           Forward Weight ActiveConn InActConn
TCP  192.168.55.100:80 wrr
  -> 192.168.66.111:80            Masq    100    0          0         
  -> 192.168.66.112:80            Masq    100    0          0         

rs0 interface

vagrant@rs0:~$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 02:56:36:6f:95:58 brd ff:ff:ff:ff:ff:ff
    inet 10.0.2.15/24 brd 10.0.2.255 scope global dynamic enp0s3
       valid_lft 83646sec preferred_lft 83646sec
    inet6 fe80::56:36ff:fe6f:9558/64 scope link 
       valid_lft forever preferred_lft forever
3: enp0s8: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 08:00:27:05:30:c1 brd ff:ff:ff:ff:ff:ff
    inet 192.168.66.111/24 brd 192.168.66.255 scope global enp0s8
       valid_lft forever preferred_lft forever
    inet6 fe80::a00:27ff:fe05:30c1/64 scope link 
       valid_lft forever preferred_lft forever
vagrant@rs0:~$ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.66.100  0.0.0.0         UG    0      0        0 enp0s8
0.0.0.0         10.0.2.2        0.0.0.0         UG    100    0        0 enp0s3
10.0.2.0        0.0.0.0         255.255.255.0   U     0      0        0 enp0s3
10.0.2.2        0.0.0.0         255.255.255.255 UH    100    0        0 enp0s3
192.168.66.0    0.0.0.0         255.255.255.0   U     0      0        0 enp0s8

cl0

vagrant@cl0:~$ curl http://192.168.55.100
rs0
vagrant@cl0:~$ curl http://192.168.55.100
rs1
vagrant@cl0:~$ curl http://192.168.55.100
rs0
vagrant@cl0:~$ curl http://192.168.55.100
rs1
vagrant@cl0:~$ curl http://192.168.55.100
rs0
vagrant@cl0:~$ curl http://192.168.55.100
rs1
vagrant halt rs1
vagrant@cl0:~$ curl http://192.168.55.100
rs0
vagrant@cl0:~$ curl http://192.168.55.100
rs0
vagrant@cl0:~$ curl http://192.168.55.100
rs0
## compulsively --provision for `route add default gw <GATEWAY>`
vagrant up rs1 --provision

ref

ipvs-vagrant's People

Contributors

dyrnq avatar

Watchers

 avatar

Forkers

c0deoo1 yusiwen

ipvs-vagrant's Issues

VBoxManage: error: VBoxNetAdpCtl: Error while adding new interface: failed to open /dev/vboxnetctl: No such file or directory

There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.

Command: ["hostonlyif", "create"]

Stderr: 0%...
Progress state: NS_ERROR_FAILURE
VBoxManage: error: Failed to create the host-only adapter
VBoxManage: error: VBoxNetAdpCtl: Error while adding new interface: failed to open /dev/vboxnetctl: No such file or directory
VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component HostNetworkInterfaceWrap, interface IHostNetworkInterface
VBoxManage: error: Context: "RTEXITCODE handleCreate(HandlerArg *)" at line 95 of file VBoxManageHostonly.cpp

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.