You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

121 lines
4.4 KiB

  1. <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
  2. <topology xmlns="http://www.cisco.com/VIRL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" schemaVersion="0.95" xsi:schemaLocation="http://www.cisco.com/VIRL https://raw.github.com/CiscoVIRL/schema/v0.95/virl.xsd">
  3. <node name="flat-1" type="ASSET" subtype="FLAT" location="429,190">
  4. <interface id="0" name="link0"/>
  5. </node>
  6. <node name="lxc-1" type="SIMPLE" subtype="lxc" location="520,247">
  7. <extensions>
  8. <entry key="config" type="String">#cloud-config&#xD;
  9. bootcmd:&#xD;
  10. - ln -s -t /etc/rc.d /etc/rc.local&#xD;
  11. hostname: lxc-1&#xD;
  12. manage_etc_hosts: true&#xD;
  13. runcmd:&#xD;
  14. - systemctl start rc-local&#xD;
  15. - sed -i '/^\s*PasswordAuthentication\s\+no/d' /etc/ssh/sshd_config&#xD;
  16. - echo "UseDNS no" &gt;&gt; /etc/ssh/sshd_config&#xD;
  17. - service ssh restart&#xD;
  18. - service sshd restart&#xD;
  19. users:&#xD;
  20. - default&#xD;
  21. - gecos: User configured by VIRL Configuration Engine 0.23.9&#xD;
  22. lock-passwd: false&#xD;
  23. name: cisco&#xD;
  24. plain-text-passwd: cisco&#xD;
  25. shell: /bin/bash&#xD;
  26. ssh-authorized-keys:&#xD;
  27. - VIRL-USER-SSH-PUBLIC-KEY&#xD;
  28. sudo: ALL=(ALL) ALL&#xD;
  29. write_files:&#xD;
  30. - path: /etc/systemd/system/dhclient@.service&#xD;
  31. content: |&#xD;
  32. [Unit]&#xD;
  33. Description=Run dhclient on %i interface&#xD;
  34. After=network.target&#xD;
  35. [Service]&#xD;
  36. Type=oneshot&#xD;
  37. ExecStart=/sbin/dhclient %i -pf /var/run/dhclient.%i.pid -lf /var/lib/dhclient/dhclient.%i.lease&#xD;
  38. RemainAfterExit=yes&#xD;
  39. owner: root:root&#xD;
  40. permissions: '0644'&#xD;
  41. - path: /etc/rc.local&#xD;
  42. owner: root:root&#xD;
  43. permissions: '0755'&#xD;
  44. content: |-&#xD;
  45. #!/bin/sh&#xD;
  46. ifconfig eth1 up&#xD;
  47. dhclient -nw eth1&#xD;
  48. systemctl start dhclient@eth1.service&#xD;
  49. # add second nic connecting clients&#xD;
  50. ifconfig eth2 10.10.0.1 netmask 255.255.0.0&#xD;
  51. # set default gateway to VIRL host in flat1 &#xD;
  52. route del -net default&#xD;
  53. route add -net default gw 172.16.1.1&#xD;
  54. # change dns&#xD;
  55. echo "nameserver 8.8.8.8" &gt;/etc/resolv.conf&#xD;
  56. echo "nameserver 8.8.4.4" &gt;&gt;/etc/resolv.conf &#xD;
  57. # enable routing and NAT for 10.10.0.0/16&#xD;
  58. sysctl -w net.ipv4.ip_forward=1&#xD;
  59. iptables -A POSTROUTING -t nat -s 10.10.0.0/16 -o eth1 -j MASQUERADE&#xD;
  60. exit 0&#xD;
  61. </entry>
  62. </extensions>
  63. <interface id="0" name="eth1"/>
  64. <interface id="1" name="eth2"/>
  65. </node>
  66. <node name="lxc-2" type="SIMPLE" subtype="lxc" location="659,241">
  67. <extensions>
  68. <entry key="config" type="String">#cloud-config&#xD;
  69. bootcmd:&#xD;
  70. - ln -s -t /etc/rc.d /etc/rc.local&#xD;
  71. hostname: lxc-2&#xD;
  72. manage_etc_hosts: true&#xD;
  73. runcmd:&#xD;
  74. - systemctl start rc-local&#xD;
  75. - sed -i '/^\s*PasswordAuthentication\s\+no/d' /etc/ssh/sshd_config&#xD;
  76. - echo "UseDNS no" &gt;&gt; /etc/ssh/sshd_config&#xD;
  77. - service ssh restart&#xD;
  78. - service sshd restart&#xD;
  79. users:&#xD;
  80. - default&#xD;
  81. - gecos: User configured by VIRL Configuration Engine 0.23.9&#xD;
  82. lock-passwd: false&#xD;
  83. name: cisco&#xD;
  84. plain-text-passwd: cisco&#xD;
  85. shell: /bin/bash&#xD;
  86. ssh-authorized-keys:&#xD;
  87. - VIRL-USER-SSH-PUBLIC-KEY&#xD;
  88. sudo: ALL=(ALL) ALL&#xD;
  89. write_files:&#xD;
  90. - path: /etc/systemd/system/dhclient@.service&#xD;
  91. content: |&#xD;
  92. [Unit]&#xD;
  93. Description=Run dhclient on %i interface&#xD;
  94. After=network.target&#xD;
  95. [Service]&#xD;
  96. Type=oneshot&#xD;
  97. ExecStart=/sbin/dhclient %i -pf /var/run/dhclient.%i.pid -lf /var/lib/dhclient/dhclient.%i.lease&#xD;
  98. RemainAfterExit=yes&#xD;
  99. owner: root:root&#xD;
  100. permissions: '0644'&#xD;
  101. - path: /etc/rc.local&#xD;
  102. owner: root:root&#xD;
  103. permissions: '0755'&#xD;
  104. content: |-&#xD;
  105. #!/bin/sh&#xD;
  106. ifconfig eth1 10.10.0.100 netmask 255.255.0.0&#xD;
  107. # set default gateway to VIRL host in flat1 &#xD;
  108. route del -net default&#xD;
  109. route add -net default gw 10.10.0.1&#xD;
  110. # change dns&#xD;
  111. echo "nameserver 8.8.8.8" &gt;/etc/resolv.conf&#xD;
  112. echo "nameserver 8.8.4.4" &gt;&gt;/etc/resolv.conf &#xD;
  113. exit 0&#xD;
  114. </entry>
  115. </extensions>
  116. <interface id="0" name="eth1"/>
  117. </node>
  118. <annotations/>
  119. <connection dst="/virl:topology/virl:node[2]/virl:interface[1]" src="/virl:topology/virl:node[1]/virl:interface[1]"/>
  120. <connection dst="/virl:topology/virl:node[3]/virl:interface[1]" src="/virl:topology/virl:node[2]/virl:interface[2]"/>
  121. </topology>