Skip to content

Instantly share code, notes, and snippets.

@koheyamada
Created July 13, 2018 04:13
Show Gist options
  • Save koheyamada/b1c250158610a12fd82430acd2d80ffc to your computer and use it in GitHub Desktop.
Save koheyamada/b1c250158610a12fd82430acd2d80ffc to your computer and use it in GitHub Desktop.
IDCFクラウドでVyOSの冗長化を行う。 ref: https://qiita.com/kooohei/items/74e87ac66f242d49f96d
$ cloudstack-api addIpToNic --nicid <Masterで利用しているNIC ID> --ipaddress <VIP>
{
"addiptovmnicresponse": {
"id": "********-****-****-****-************",
"jobid": "********-****-****-****-************"
}
}
$ cloudstack-api enableStaticNat --ipaddressid <NAT用パブリックIPのID> --virtualmachineid <MasterのMachineID> --vmguestip <フロントエンド用VIP>
{
"enablestaticnatresponse": {
"success": "true"
}
}
$ configure
# set system host-name <ホスト名>
$ configure
[edit]
# edit interfaces ethernet eth0
[edit interfaces ethernet eth0]
# set vrrp vrrp-group 100
[edit interfaces ethernet eth0]
# set vrrp vrrp-group 100 virtual-address <フロント側VIP>
[edit interfaces ethernet eth0]
# set vrrp vrrp-group 100 priority 150 ※Backup側はpriorityを100にする。
[edit interfaces ethernet eth0]
# exit
exit
# edit interfaces ethernet eth1
[edit interfaces ethernet eth1]
# set address dhcp
[edit interfaces ethernet eth1]
# set duplex auto
[edit interfaces ethernet eth1]
# set smp_affinity auto
[edit interfaces ethernet eth1]
# set speed auto
[edit interfaces ethernet eth1]
# set vrrp vrrp-group 100
[edit interfaces ethernet eth1]
# set vrrp vrrp-group 100 virtual-address <バック側VIP>
[edit interfaces ethernet eth1]
# set vrrp vrrp-group 100 priority 150 ※Backup側はpriorityを100にする。
[edit interfaces ethernet eth1]
# commit
[ system host-name Master ]
Stopping enhanced syslogd: rsyslogd.
Starting enhanced syslogd: rsyslogd.
[edit interfaces ethernet eth0]
# save
Saving configuration to '/config/config.boot'...
Done
[edit]
# exit
exit
[Master]
$ show vrrp
RFC Addr Last Sync
Interface Group State Compliant Owner Transition Group
--------- ----- ----- --------- ----- ---------- -----
eth0 100 MASTER no no 4m55s <none>
eth1 100 MASTER no no 11s <none>
[Backup]
$ show vrrp
RFC Addr Last Sync
Interface Group State Compliant Owner Transition Group
--------- ----- ----- --------- ----- ---------- -----
eth0 100 BACKUP no no 30s <none>
eth1 100 BACKUP no no 11s <none>
[Master]
$ show interfaces
Codes: S - State, L - Link, u - Up, D - Down, A - Admin Down
Interface IP Address S/L Description
--------- ---------- --- -----------
eth0 <フロント側VIP> u/u
**.**.*.***/**
eth1 <バック側VIP> u/u
**.**.*.***/**
lo 127.0.0.1/8 u/u
::1/128
[Backup]
$ show interfaces
Codes: S - State, L - Link, u - Up, D - Down, A - Admin Down
Interface IP Address S/L Description
--------- ---------- --- -----------
eth0 **.**.*.***/** u/u
eth1 **.**.*.***/** u/u
lo 127.0.0.1/8 u/u
::1/128
$ cloudstack-api listNics --nicid <Masterで利用しているNIC ID> --virtualmachineid <MasterのMacineID>
{
"listnicsresponse": {
"count": 1,
"nic": [
{
"broadcasturi": "vlan://****",
"deviceid": "0",
"gateway": "10.15.0.1",
"id": "********-****-****-****-************",
"ipaddress": "10.15.0.101",
"isdefault": true,
"isolationuri": "vlan://****",
"macaddress": "**:**:**:**:**:**",
"netmask": "255.255.248.0",
"networkid": "********-****-****-****-************",
"secondaryip": [
{
"id": "********-****-****-****-************",
"ipaddress": "10.15.0.100"
}
],
"traffictype": "Guest",
"type": "Isolated",
"virtualmachineid": "********-****-****-****-************"
}
]
}
}
$ cloudstack-api listPublicIpAddresses -t tags,ipaddress,id
+------------------------------------------------+-----------------+--------------------------------------+
| tags | ipaddress | id |
+------------------------------------------------+-----------------+--------------------------------------+
| [] | ***.***.***.*** | ********-****-****-****-************ |
| [{'key': 'cloud-description', 'value': 'NAT'}] | 210.140.99.136 | ********-****-****-****-************ |
+------------------------------------------------+-----------------+--------------------------------------+
$ cloudstack-api listVirtualMachines -t displayname,id
+-------------+--------------------------------------+
| displayname | id |
+-------------+--------------------------------------+
| Master | ********-****-****-****-************ |
| Backup | ********-****-****-****-************ |
+-------------+--------------------------------------+
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment