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

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<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">
<node name="flat-1" type="ASSET" subtype="FLAT" location="429,190">
<interface id="0" name="link0"/>
</node>
<node name="lxc-1" type="SIMPLE" subtype="lxc" location="520,247">
<extensions>
<entry key="config" type="String">#cloud-config&#xD;
bootcmd:&#xD;
- ln -s -t /etc/rc.d /etc/rc.local&#xD;
hostname: lxc-1&#xD;
manage_etc_hosts: true&#xD;
runcmd:&#xD;
- systemctl start rc-local&#xD;
- sed -i '/^\s*PasswordAuthentication\s\+no/d' /etc/ssh/sshd_config&#xD;
- echo "UseDNS no" &gt;&gt; /etc/ssh/sshd_config&#xD;
- service ssh restart&#xD;
- service sshd restart&#xD;
users:&#xD;
- default&#xD;
- gecos: User configured by VIRL Configuration Engine 0.23.9&#xD;
lock-passwd: false&#xD;
name: cisco&#xD;
plain-text-passwd: cisco&#xD;
shell: /bin/bash&#xD;
ssh-authorized-keys:&#xD;
- VIRL-USER-SSH-PUBLIC-KEY&#xD;
sudo: ALL=(ALL) ALL&#xD;
write_files:&#xD;
- path: /etc/systemd/system/dhclient@.service&#xD;
content: |&#xD;
[Unit]&#xD;
Description=Run dhclient on %i interface&#xD;
After=network.target&#xD;
[Service]&#xD;
Type=oneshot&#xD;
ExecStart=/sbin/dhclient %i -pf /var/run/dhclient.%i.pid -lf /var/lib/dhclient/dhclient.%i.lease&#xD;
RemainAfterExit=yes&#xD;
owner: root:root&#xD;
permissions: '0644'&#xD;
- path: /etc/rc.local&#xD;
owner: root:root&#xD;
permissions: '0755'&#xD;
content: |-&#xD;
#!/bin/sh&#xD;
ifconfig eth1 up&#xD;
dhclient -nw eth1&#xD;
systemctl start dhclient@eth1.service&#xD;
# add second nic connecting clients&#xD;
ifconfig eth2 10.10.0.1 netmask 255.255.0.0&#xD;
# set default gateway to VIRL host in flat1 &#xD;
route del -net default&#xD;
route add -net default gw 172.16.1.1&#xD;
# change dns&#xD;
echo "nameserver 8.8.8.8" &gt;/etc/resolv.conf&#xD;
echo "nameserver 8.8.4.4" &gt;&gt;/etc/resolv.conf &#xD;
# enable routing and NAT for 10.10.0.0/16&#xD;
sysctl -w net.ipv4.ip_forward=1&#xD;
iptables -A POSTROUTING -t nat -s 10.10.0.0/16 -o eth1 -j MASQUERADE&#xD;
exit 0&#xD;
</entry>
</extensions>
<interface id="0" name="eth1"/>
<interface id="1" name="eth2"/>
</node>
<node name="lxc-2" type="SIMPLE" subtype="lxc" location="659,241">
<extensions>
<entry key="config" type="String">#cloud-config&#xD;
bootcmd:&#xD;
- ln -s -t /etc/rc.d /etc/rc.local&#xD;
hostname: lxc-2&#xD;
manage_etc_hosts: true&#xD;
runcmd:&#xD;
- systemctl start rc-local&#xD;
- sed -i '/^\s*PasswordAuthentication\s\+no/d' /etc/ssh/sshd_config&#xD;
- echo "UseDNS no" &gt;&gt; /etc/ssh/sshd_config&#xD;
- service ssh restart&#xD;
- service sshd restart&#xD;
users:&#xD;
- default&#xD;
- gecos: User configured by VIRL Configuration Engine 0.23.9&#xD;
lock-passwd: false&#xD;
name: cisco&#xD;
plain-text-passwd: cisco&#xD;
shell: /bin/bash&#xD;
ssh-authorized-keys:&#xD;
- VIRL-USER-SSH-PUBLIC-KEY&#xD;
sudo: ALL=(ALL) ALL&#xD;
write_files:&#xD;
- path: /etc/systemd/system/dhclient@.service&#xD;
content: |&#xD;
[Unit]&#xD;
Description=Run dhclient on %i interface&#xD;
After=network.target&#xD;
[Service]&#xD;
Type=oneshot&#xD;
ExecStart=/sbin/dhclient %i -pf /var/run/dhclient.%i.pid -lf /var/lib/dhclient/dhclient.%i.lease&#xD;
RemainAfterExit=yes&#xD;
owner: root:root&#xD;
permissions: '0644'&#xD;
- path: /etc/rc.local&#xD;
owner: root:root&#xD;
permissions: '0755'&#xD;
content: |-&#xD;
#!/bin/sh&#xD;
ifconfig eth1 10.10.0.100 netmask 255.255.0.0&#xD;
# set default gateway to VIRL host in flat1 &#xD;
route del -net default&#xD;
route add -net default gw 10.10.0.1&#xD;
# change dns&#xD;
echo "nameserver 8.8.8.8" &gt;/etc/resolv.conf&#xD;
echo "nameserver 8.8.4.4" &gt;&gt;/etc/resolv.conf &#xD;
exit 0&#xD;
</entry>
</extensions>
<interface id="0" name="eth1"/>
</node>
<annotations/>
<connection dst="/virl:topology/virl:node[2]/virl:interface[1]" src="/virl:topology/virl:node[1]/virl:interface[1]"/>
<connection dst="/virl:topology/virl:node[3]/virl:interface[1]" src="/virl:topology/virl:node[2]/virl:interface[2]"/>
</topology>