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