From 84cbe3c94df038b7d1c5084304222b059d0c385d Mon Sep 17 00:00:00 2001 From: Sebastian Rieger <sebastian.rieger@informatik.hs-fulda.de> Date: Fri, 16 Dec 2016 16:20:34 +0100 Subject: [PATCH] added webserver, port forwarding an unbug commands --- .../kommprot-lab3-wanem.virl | 26 +++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/GIT-VIRL-HS-Fulda/Kommunikationsnetze und -protokolle (Bachelor AI)/kommprot-lab3-wanem.virl b/GIT-VIRL-HS-Fulda/Kommunikationsnetze und -protokolle (Bachelor AI)/kommprot-lab3-wanem.virl index 4a36680..9bab321 100644 --- a/GIT-VIRL-HS-Fulda/Kommunikationsnetze und -protokolle (Bachelor AI)/kommprot-lab3-wanem.virl +++ b/GIT-VIRL-HS-Fulda/Kommunikationsnetze und -protokolle (Bachelor AI)/kommprot-lab3-wanem.virl @@ -298,7 +298,7 @@ end <interface id="1" name="GigabitEthernet0/2"/> <interface id="2" name="GigabitEthernet0/3"/> </node> - <node name="Client" type="SIMPLE" subtype="lxc" location="186,310"> + <node name="Client" type="SIMPLE" subtype="lxc" location="154,308"> <extensions> <entry key="Auto-generate config" type="Boolean">false</entry> <entry key="config" type="String">#cloud-config
 @@ -356,6 +356,7 @@ write_files:
 route del default
 route add default gw 192.168.1.1
 arp -i eth1 -s 192.168.1.1 aa:aa:aa:aa:aa:aa
 + echo "alias unbug='sudo arp -d 192.168.1.1'" >>/home/cisco/.bashrc
 exit 0
 
 - path: /etc/resolv.conf
 @@ -370,6 +371,7 @@ write_files:
 </node> <node name="ISP" type="SIMPLE" subtype="lxc" location="343,149"> <extensions> + <entry key="Auto-generate config" type="Boolean">false</entry> <entry key="config" type="String">#cloud-config
 bootcmd:
 - ln -s -t /etc/rc.d /etc/rc.local
 @@ -440,8 +442,13 @@ write_files:
 iptables -t nat -A POSTROUTING -o eth3 -j MASQUERADE
 iptables -P FORWARD ACCEPT
 iptables -F FORWARD
 +
 + iptables -t nat -A PREROUTING -i eth3 -p tcp -m tcp --dport 80 -j DNAT --to-destination 192.168.2.100:80
 + iptables -t nat -A PREROUTING -i eth3 -p tcp -m tcp --dport 22 -j DNAT --to-destination 192.168.2.100:22
 
 /sbin/tc qdisc add dev eth2 root handle 1:1 netem delay 100ms loss 5%
 + echo "alias unbug='sudo tc qdisc del dev eth2 root'" >>/home/cisco/.bashrc
 +
 service ssh start
 
 hostname ISP
 @@ -449,7 +456,6 @@ write_files:
 exit 0
 
 </entry> - <entry key="Auto-generate config" type="Boolean">false</entry> </extensions> <interface id="0" name="eth1"/> <interface id="1" name="eth2"/> @@ -468,6 +474,7 @@ runcmd:
 - start ttyS0
 - systemctl start getty@ttyS0.service
 - systemctl start rc-local
 +- systemctl start install-webserver
 - sed -i '/^\s*PasswordAuthentication\s\+no/d' /etc/ssh/sshd_config
 - echo "UseDNS no" >> /etc/ssh/sshd_config
 - service ssh restart
 @@ -513,7 +520,22 @@ write_files:
 ifconfig eth1 up 192.168.2.100 netmask 255.255.255.0
 route del default
 route add default gw 192.168.2.1
 + route add -net 192.168.1.0/24 gw 127.0.0.1
 + echo "alias unbug='sudo route del -net 192.168.1.0/24'" >>/home/cisco/.bashrc
 echo "nameserver 8.8.8.8" >/etc/resolv.conf
 + screen -dmS install-webserver /tmp/install-webserver &
 + exit 0
 +- path: /tmp/install-webserver
 + owner: root:root
 + permissions: '0755'
 + content: |-
 + #!/bin/bash
 + echo "Waiting for internet connectivity"
 + until echo -n "." && ping -c1 archive.ubuntu.com &>/dev/null; do :; done
 + apt-get -y update
 + apt-get -y install apache2
 + echo "<h1>Willkommen auf Server-B!</h1>" >/var/www/html/index.html
 + read -p "Press any key..."
 exit 0
 </entry> </extensions> -- GitLab