Monday, October 17, 2016

[lunar.lab] Build My Lab Network Using VyOS

Am trying to build my own lab. The idea is to have three "virtual datacenter" as described in the following figure. Datacenter A and datacenter B would be two independent datacenter, where later I can simulate DR failover, workload mobility, stretch network, etc across those two datacenter.  Each datacenter will have their own ESXi hosts and vCenter. Datacenter C is where I keep shared services which are required by either datacenter A or B, but not relevant to the test that I want to perform. Other than that, datacenter C will hosts some workload which mimic as user accessing workload on datacenter A or B. Each datacenter will have their own router, and dynamic routing should be configured between those 3 datacenter as later I want to explore NSX multi site capabilities. You can see the network and address that I plan to use on the following figure.

I build my lab on top of two MacBook Pro and VMware Fusion provided by my company. Each MBP has enough but not unlimited resource, so I try to be really mindful on the resource I allocate for each VM. To satisfy the network described above, I choose to use VyOS (formerly Vyatta) as afaik it only require little resource, free, rich features, and easy to configure. (Disclaimer: Am not network expert, only know just enough). I deploy three VM,  2 on one MBP, and 1 on another MBP. Each VM configured with 1 vCPU, 512MB RAM, and 2GB virtual disk, and 2 network adapter. One network adapter bridged to the physical network adapter, and later will be used as eth0 to allow communication between router, including between router across MBP. The other network adapter set to use network which private to my MBP and will be used for eth1.

The installation and configuration is very simple. You may follow the guidance from VyOS user guide here and here. Below I share the result of show configuration command from rou01c. For other router, I only need to adjust the address, description, network, and other router specific information accordingly. I only enable DHCP service at this rou01c as other datacenter not require that service. After all router configured and tested, now my "physical" network is ready. Yeay!


Configuration
Remark
interfaces {
    ethernet eth0 {
        address 192.168.9.11/29
        description WAN
        duplex auto
        hw-id 00:0c:29:5f:75:ba
        smp_affinity auto
        speed auto
    }


Use appropriate address for eth0 on each router.
    ethernet eth1 {
        address 192.168.30.254/24
        description DatacenterC
        duplex auto
        hw-id 00:0c:29:5f:75:c4
        smp_affinity auto
        speed auto
    }

Use appropriate address for eth1 on each router.
    loopback lo {
        address 3.3.3.3/32
    }
}
Use appropriate address for loopback on each router. This interface required for OSPF routing configuration.
policy {
    route-map CONNECT {
        rule 10 {
            action permit
            match {
                interface lo
            }
        }
    }
}


protocols {
    ospf {
        area 0 {
            network 192.168.30.0/24
            network 192.168.9.8/29
        }
        log-adjacency-changes {
        }
        parameters {
            abr-type cisco
            router-id 3.3.3.3
        }
        redistribute {
            connected {
                metric-type 2
                route-map CONNECT
            }
        }
    }
}



List down all network which directly connect to this router here.
service {
    dhcp-server {
        disabled false
        shared-network-name dhcp_eth1 {
            authoritative disable
            subnet 192.168.30.0/24 {
                default-router 192.168.30.254
                dns-server 192.168.30.1
                domain-name lunar.lab
                lease 86400
                start 192.168.30.51 {
                    stop 192.168.30.60
                }
            }
        }
    }

I enable dhcp service on eth1 as later I would need this service. The configuration should be self explainable.
https {
        http-redirect enable
    }
    telnet {
        port 23
    }
}

system {
    config-management {
        commit-revisions 20
    }
    console {
    }

domain-name lunar.lab
    gateway-address 192.168.9.11
    host-name rou01c
    login {
        user vyos {
            authentication {
                encrypted-password ****************
                plaintext-password ****************
            }
            level admin
        }
    }
    name-server 192.168.30.1

ntp {
        server 0.pool.ntp.org {
        }
        server 1.pool.ntp.org {
        }
        server 2.pool.ntp.org {
        }
    }
    package {
        auto-sync 1
        repository community {
            components main
            distribution helium
            password ****************
            url http://packages.vyos.net/vyos
            username ""
        }
    }
    syslog {
        global {
            facility all {
                level notice
            }
            facility protocols {
                level debug
            }
        }
    }
    time-zone UTC
}





No comments:

Post a Comment