#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 #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