Sebastian Rieger
8 years ago
1 changed files with 315 additions and 0 deletions
@ -0,0 +1,315 @@ |
|||||
|
<?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"> |
||||
|
<extensions> |
||||
|
<entry key="management_network" type="String">exclusive</entry> |
||||
|
<entry key="AutoNetkit.enable_cdp" type="Boolean">true</entry> |
||||
|
</extensions> |
||||
|
<node name="client1" type="SIMPLE" subtype="lxc" location="340,301"> |
||||
|
<extensions> |
||||
|
<entry key="config" type="String">#cloud-config
 |
||||
|
bootcmd:
 |
||||
|
- ln -s -t /etc/rc.d /etc/rc.local
 |
||||
|
hostname: client
 |
||||
|
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 10.0.0.20 netmask 255.255.0.0
 |
||||
|
route add -host 192.168.0.1 gw 10.0.0.1 dev eth1
 |
||||
|
route add -net 10.0.0.0/16 gw 10.0.0.1 dev eth1
 |
||||
|
route add default gw 10.0.0.1
 |
||||
|
echo "nameserver 8.8.8.8" >/etc/resolv.conf
 |
||||
|
exit 0
 |
||||
|
- path: /home/cisco/udpserver.py
 |
||||
|
owner: cisco:cisco
 |
||||
|
permissions: '0755'
 |
||||
|
content: |-
 |
||||
|
#!/usr/bin/python
 |
||||
|
from socket import *
 |
||||
|

 |
||||
|
# UDP Port auf dem der Server lauschen soll...
 |
||||
|
serverPort = 17000
 |
||||
|

 |
||||
|
# Server-Socket als Internet (INET) UDP (DGRAM) erzeugen und an o.g. Port binden
 |
||||
|
serverSocket = socket(AF_INET, SOCK_DGRAM)
 |
||||
|
serverSocket.bind(("", serverPort))
 |
||||
|
print "UDP Server ist bereit fuer den Empfang von Daten..."
 |
||||
|

 |
||||
|
# Endlosschleife
 |
||||
|
while 1:
 |
||||
|
# Eingehende Nachrichten von Clients empfangen
 |
||||
|
message, clientAddress = serverSocket.recvfrom(2048)
 |
||||
|
# Alle Buchstaben der Nachricht in Grossbuchstaben umwandeln und an den
 |
||||
|
# Client zuruecksenden
 |
||||
|
modifiedMessage = message.upper()
 |
||||
|
serverSocket.sendto(modifiedMessage, clientAddress)
 |
||||
|
- path: /home/cisco/udpclient.py
 |
||||
|
owner: cisco:cisco
 |
||||
|
permissions: '0755'
 |
||||
|
content: |-
 |
||||
|
#!/usr/bin/python
 |
||||
|
from socket import *
 |
||||
|

 |
||||
|
# Server-Adresse und Port
 |
||||
|
serverName = "localhost"
 |
||||
|
serverPort = 17000
 |
||||
|

 |
||||
|
# Client Socket (IP, UDP) oeffnen
 |
||||
|
clientSocket = socket(AF_INET, SOCK_DGRAM)
 |
||||
|

 |
||||
|
# Nachricht vom Benutzer erfragen und versenden
 |
||||
|
message = raw_input("UDP Nachricht in Kleinbuchstaben eingeben:")
 |
||||
|
clientSocket.sendto(message,(serverName, serverPort))
 |
||||
|

 |
||||
|
# Antwort des Server aus Socket lesen und ausgeben
 |
||||
|
modifiedMessage, serverAddress = clientSocket.recvfrom(2048)
 |
||||
|
print "Antwort des Servers: ", modifiedMessage
 |
||||
|
raw_input("Fertig...")
 |
||||
|

 |
||||
|
# Verbindung schliessen
 |
||||
|
clientSocket.close()
 |
||||
|
- path: /home/cisco/tcpserver.py
 |
||||
|
owner: cisco:cisco
 |
||||
|
permissions: '0755'
 |
||||
|
content: |-
 |
||||
|
#!/usr/bin/python
 |
||||
|
from socket import *
 |
||||
|

 |
||||
|
# TCP Port auf dem der Server lauschen soll...
 |
||||
|
serverPort = 17000
 |
||||
|
# Server-Socket als Internet (INET) TCP (STREAM) erzeugen und an o.g. Port binden
 |
||||
|
serverSocket = socket(AF_INET,SOCK_STREAM)
 |
||||
|
serverSocket.bind(("",serverPort))
 |
||||
|
serverSocket.listen(1)
 |
||||
|
print "TCP Server ist bereit fuer den Empfang von Daten..."
 |
||||
|

 |
||||
|
# Endlosschleife
 |
||||
|
while 1:
 |
||||
|
# Eingehende Nachrichten akzeptieren und von Clients empfangen
 |
||||
|
connectionSocket, addr = serverSocket.accept()
 |
||||
|
sentence = connectionSocket.recv(1024)
 |
||||
|
# Alle Buchstaben der Nachricht in Grossbuchstaben umwandeln und an den
 |
||||
|
# Client zuruecksenden
 |
||||
|
capitalizedSentence = sentence.upper()
 |
||||
|
connectionSocket.send(capitalizedSentence)
 |
||||
|
# Verbindung schliessen
 |
||||
|
connectionSocket.close()
 |
||||
|
- path: /home/cisco/tcpclient.py
 |
||||
|
owner: cisco:cisco
 |
||||
|
permissions: '0755'
 |
||||
|
content: |-
 |
||||
|
#!/usr/bin/python
 |
||||
|
from socket import *
 |
||||
|

 |
||||
|
# Serveradresse und TCP Port auf den der Server hoert...
 |
||||
|
serverName = "localhost"
 |
||||
|
serverPort = 17000
 |
||||
|
# Socket fuer IP (INET) und TCP (STREAM) konfigurieren
 |
||||
|
clientSocket = socket(AF_INET, SOCK_STREAM)
 |
||||
|
clientSocket.connect((serverName,serverPort))
 |
||||
|

 |
||||
|
# Nachricht vom Benutzer abfragen und an den Server senden
 |
||||
|
sentence = raw_input("TCP Nachricht in Kleinbuchstaben eingeben:")
 |
||||
|
clientSocket.send(sentence)
 |
||||
|

 |
||||
|
# Antwort des Servers ausgeben
 |
||||
|
modifiedSentence = clientSocket.recv(1024)
 |
||||
|
print "Antwort des Servers:", modifiedSentence
 |
||||
|
raw_input("Fertig...")
 |
||||
|

 |
||||
|
# Verbindung schliessen
 |
||||
|
clientSocket.close()
 |
||||
|
</entry> |
||||
|
</extensions> |
||||
|
<interface id="0" name="eth1" ipv4="10.0.0.2" netPrefixLenV4="16"/> |
||||
|
</node> |
||||
|
<node name="server1" type="SIMPLE" subtype="lxc" location="584,301"> |
||||
|
<extensions> |
||||
|
<entry key="config" type="String">#cloud-config
 |
||||
|
bootcmd:
 |
||||
|
- ln -s -t /etc/rc.d /etc/rc.local
 |
||||
|
hostname: server
 |
||||
|
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 10.0.0.30 netmask 255.255.0.0
 |
||||
|
route add -host 192.168.0.1 gw 10.0.0.1 dev eth1
 |
||||
|
route add -net 10.0.0.0/16 gw 10.0.0.1 dev eth1
 |
||||
|
route add default gw 10.0.0.1
 |
||||
|
echo "nameserver 8.8.8.8" >/etc/resolv.conf
 |
||||
|
exit 0
 |
||||
|
</entry> |
||||
|
</extensions> |
||||
|
<interface id="0" name="eth1" ipv4="10.0.0.3" netPrefixLenV4="16"/> |
||||
|
</node> |
||||
|
<node name="switch1" type="SIMPLE" subtype="Unmanaged Switch" location="446,227"> |
||||
|
<interface id="0" name="link1"/> |
||||
|
<interface id="1" name="link2"/> |
||||
|
<interface id="2" name="link3"/> |
||||
|
</node> |
||||
|
<node name="router1" type="SIMPLE" subtype="IOSv" location="446,106"> |
||||
|
<extensions> |
||||
|
<entry key="AutoNetkit.mgmt_ip" type="string"></entry> |
||||
|
<entry key="Auto-generate config" type="Boolean">false</entry> |
||||
|
<entry key="config" type="String">! IOS Config generated on 2016-12-05 08:28
 |
||||
|
! by autonetkit_0.23.5
 |
||||
|
!
 |
||||
|
hostname router1
 |
||||
|
boot-start-marker
 |
||||
|
boot-end-marker
 |
||||
|
!
 |
||||
|
vrf definition Mgmt-intf
 |
||||
|
!
 |
||||
|
address-family ipv4
 |
||||
|
exit-address-family
 |
||||
|
!
 |
||||
|
address-family ipv6
 |
||||
|
exit-address-family
 |
||||
|
!
 |
||||
|
!
 |
||||
|
!
 |
||||
|
no aaa new-model
 |
||||
|
!
 |
||||
|
!
 |
||||
|
ip cef
 |
||||
|
ipv6 unicast-routing
 |
||||
|
ipv6 cef
 |
||||
|
!
 |
||||
|
!
 |
||||
|
service timestamps debug datetime msec
 |
||||
|
service timestamps log datetime msec
 |
||||
|
no service password-encryption
 |
||||
|
no service config
 |
||||
|
enable password cisco
 |
||||
|
ip classless
 |
||||
|
ip subnet-zero
 |
||||
|
no ip domain lookup
 |
||||
|
ip domain name virl.info
 |
||||
|
crypto key generate rsa modulus 768
 |
||||
|
ip ssh server algorithm authentication password
 |
||||
|
username cisco privilege 15 secret cisco
 |
||||
|
line vty 0 4
 |
||||
|
transport input ssh telnet
 |
||||
|
exec-timeout 720 0
 |
||||
|
password cisco
 |
||||
|
login local
 |
||||
|
line con 0
 |
||||
|
password cisco
 |
||||
|
!
 |
||||
|
cdp run
 |
||||
|
!
 |
||||
|
!
 |
||||
|
interface Loopback0
 |
||||
|
description Loopback
 |
||||
|
ip address 192.168.0.1 255.255.255.255
 |
||||
|
!
 |
||||
|
interface GigabitEthernet0/0
 |
||||
|
description OOB Management
 |
||||
|
vrf forwarding Mgmt-intf
 |
||||
|
! Configured on launch
 |
||||
|
no ip address
 |
||||
|
cdp enable
 |
||||
|
duplex full
 |
||||
|
speed auto
 |
||||
|
no shutdown
 |
||||
|
!
 |
||||
|
interface GigabitEthernet0/1
 |
||||
|
description to Internet
 |
||||
|
no ip address
 |
||||
|
ip nat outside
 |
||||
|
cdp enable
 |
||||
|
duplex full
 |
||||
|
speed auto
 |
||||
|
no shutdown
 |
||||
|
!
 |
||||
|
interface GigabitEthernet0/2
 |
||||
|
description to switch1
 |
||||
|
ip address 10.0.0.1 255.255.0.0
 |
||||
|
ip nat inside
 |
||||
|
cdp enable
 |
||||
|
ip ospf cost 1
 |
||||
|
duplex full
 |
||||
|
speed auto
 |
||||
|
no shutdown
 |
||||
|
!
 |
||||
|
! NAT stuff
 |
||||
|
!
 |
||||
|
ip nat inside source list 1 interface GigabitEthernet0/1 overload
 |
||||
|
ip route 0.0.0.0 0.0.0.0 172.16.1.1
 |
||||
|
access-list 1 permit 10.0.0.0 0.0.255.255
 |
||||
|
!
 |
||||
|
end</entry> |
||||
|
</extensions> |
||||
|
<interface id="0" name="GigabitEthernet0/1"/> |
||||
|
<interface id="1" name="GigabitEthernet0/2" ipv4="10.0.0.1" netPrefixLenV4="16"/> |
||||
|
</node> |
||||
|
<node name="Internet" type="ASSET" subtype="FLAT" location="337,55"> |
||||
|
<interface id="0" name="link0"/> |
||||
|
</node> |
||||
|
<annotations/> |
||||
|
<connection dst="/virl:topology/virl:node[4]/virl:interface[1]" src="/virl:topology/virl:node[5]/virl:interface[1]"/> |
||||
|
<connection dst="/virl:topology/virl:node[3]/virl:interface[1]" src="/virl:topology/virl:node[4]/virl:interface[2]"/> |
||||
|
<connection dst="/virl:topology/virl:node[1]/virl:interface[1]" src="/virl:topology/virl:node[3]/virl:interface[2]"/> |
||||
|
<connection dst="/virl:topology/virl:node[2]/virl:interface[1]" src="/virl:topology/virl:node[3]/virl:interface[3]"/> |
||||
|
</topology> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue