Browse Source

added webserver, port forwarding an unbug commands

master
Sebastian Rieger 8 years ago
parent
commit
84cbe3c94d
  1. 26
      GIT-VIRL-HS-Fulda/Kommunikationsnetze und -protokolle (Bachelor AI)/kommprot-lab3-wanem.virl

26
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="1" name="GigabitEthernet0/2"/>
<interface id="2" name="GigabitEthernet0/3"/> <interface id="2" name="GigabitEthernet0/3"/>
</node> </node>
<node name="Client" type="SIMPLE" subtype="lxc" location="186,310">
<node name="Client" type="SIMPLE" subtype="lxc" location="154,308">
<extensions> <extensions>
<entry key="Auto-generate config" type="Boolean">false</entry> <entry key="Auto-generate config" type="Boolean">false</entry>
<entry key="config" type="String">#cloud-config&#xD; <entry key="config" type="String">#cloud-config&#xD;
@ -356,6 +356,7 @@ write_files:&#xD;
route del default&#xD; route del default&#xD;
route add default gw 192.168.1.1&#xD; route add default gw 192.168.1.1&#xD;
arp -i eth1 -s 192.168.1.1 aa:aa:aa:aa:aa:aa&#xD; arp -i eth1 -s 192.168.1.1 aa:aa:aa:aa:aa:aa&#xD;
echo "alias unbug='sudo arp -d 192.168.1.1'" &gt;&gt;/home/cisco/.bashrc&#xD;
exit 0&#xD; exit 0&#xD;
&#xD; &#xD;
- path: /etc/resolv.conf&#xD; - path: /etc/resolv.conf&#xD;
@ -370,6 +371,7 @@ write_files:&#xD;
</node> </node>
<node name="ISP" type="SIMPLE" subtype="lxc" location="343,149"> <node name="ISP" type="SIMPLE" subtype="lxc" location="343,149">
<extensions> <extensions>
<entry key="Auto-generate config" type="Boolean">false</entry>
<entry key="config" type="String">#cloud-config&#xD; <entry key="config" type="String">#cloud-config&#xD;
bootcmd:&#xD; bootcmd:&#xD;
- ln -s -t /etc/rc.d /etc/rc.local&#xD; - ln -s -t /etc/rc.d /etc/rc.local&#xD;
@ -440,8 +442,13 @@ write_files:&#xD;
iptables -t nat -A POSTROUTING -o eth3 -j MASQUERADE&#xD; iptables -t nat -A POSTROUTING -o eth3 -j MASQUERADE&#xD;
iptables -P FORWARD ACCEPT&#xD; iptables -P FORWARD ACCEPT&#xD;
iptables -F FORWARD&#xD; iptables -F FORWARD&#xD;
&#xD;
iptables -t nat -A PREROUTING -i eth3 -p tcp -m tcp --dport 80 -j DNAT --to-destination 192.168.2.100:80&#xD;
iptables -t nat -A PREROUTING -i eth3 -p tcp -m tcp --dport 22 -j DNAT --to-destination 192.168.2.100:22&#xD;
&#xD; &#xD;
/sbin/tc qdisc add dev eth2 root handle 1:1 netem delay 100ms loss 5%&#xD; /sbin/tc qdisc add dev eth2 root handle 1:1 netem delay 100ms loss 5%&#xD;
echo "alias unbug='sudo tc qdisc del dev eth2 root'" &gt;&gt;/home/cisco/.bashrc&#xD;
&#xD;
service ssh start&#xD; service ssh start&#xD;
&#xD; &#xD;
hostname ISP&#xD; hostname ISP&#xD;
@ -449,7 +456,6 @@ write_files:&#xD;
exit 0&#xD; exit 0&#xD;
&#xD; &#xD;
</entry> </entry>
<entry key="Auto-generate config" type="Boolean">false</entry>
</extensions> </extensions>
<interface id="0" name="eth1"/> <interface id="0" name="eth1"/>
<interface id="1" name="eth2"/> <interface id="1" name="eth2"/>
@ -468,6 +474,7 @@ runcmd:&#xD;
- start ttyS0&#xD; - start ttyS0&#xD;
- systemctl start getty@ttyS0.service&#xD; - systemctl start getty@ttyS0.service&#xD;
- systemctl start rc-local&#xD; - systemctl start rc-local&#xD;
- systemctl start install-webserver&#xD;
- sed -i '/^\s*PasswordAuthentication\s\+no/d' /etc/ssh/sshd_config&#xD; - sed -i '/^\s*PasswordAuthentication\s\+no/d' /etc/ssh/sshd_config&#xD;
- echo "UseDNS no" &gt;&gt; /etc/ssh/sshd_config&#xD; - echo "UseDNS no" &gt;&gt; /etc/ssh/sshd_config&#xD;
- service ssh restart&#xD; - service ssh restart&#xD;
@ -513,7 +520,22 @@ write_files:&#xD;
ifconfig eth1 up 192.168.2.100 netmask 255.255.255.0&#xD; ifconfig eth1 up 192.168.2.100 netmask 255.255.255.0&#xD;
route del default&#xD; route del default&#xD;
route add default gw 192.168.2.1&#xD; route add default gw 192.168.2.1&#xD;
route add -net 192.168.1.0/24 gw 127.0.0.1&#xD;
echo "alias unbug='sudo route del -net 192.168.1.0/24'" &gt;&gt;/home/cisco/.bashrc&#xD;
echo "nameserver 8.8.8.8" &gt;/etc/resolv.conf&#xD; echo "nameserver 8.8.8.8" &gt;/etc/resolv.conf&#xD;
screen -dmS install-webserver /tmp/install-webserver &amp;&#xD;
exit 0&#xD;
- path: /tmp/install-webserver&#xD;
owner: root:root&#xD;
permissions: '0755'&#xD;
content: |-&#xD;
#!/bin/bash&#xD;
echo "Waiting for internet connectivity"&#xD;
until echo -n "." &amp;&amp; ping -c1 archive.ubuntu.com &amp;&gt;/dev/null; do :; done&#xD;
apt-get -y update&#xD;
apt-get -y install apache2&#xD;
echo "&lt;h1&gt;Willkommen auf Server-B!&lt;/h1&gt;" &gt;/var/www/html/index.html&#xD;
read -p "Press any key..."&#xD;
exit 0&#xD; exit 0&#xD;
</entry> </entry>
</extensions> </extensions>

Loading…
Cancel
Save